public code v1

This commit is contained in:
2026-05-22 11:14:29 +02:00
parent 427197ec5a
commit b8141736eb
28859 changed files with 575079 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+1
View File
@@ -0,0 +1 @@
/bin/
+34
View File
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>afryca.valueforcer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
line.separator=\n
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
@@ -0,0 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.valueforcer
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: afryca.valueforcer
Require-Bundle: org.eclipse.core.runtime
Automatic-Module-Name: afryca.valueforcer
@@ -0,0 +1,3 @@
#Properties file for afryca.valueforcer
Bundle-Vendor = Sinbad\u00B2
Bundle-Name = Value forcer
@@ -0,0 +1,3 @@
#Archivo de propiedades para afryca.valueforcer
Bundle-Vendor = Sinbad\u00B2
Bundle-Name = Forzador de valores
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/
@@ -0,0 +1,222 @@
package afryca.valueforcer;
import org.eclipse.osgi.util.NLS;
import afryca.valueforcer.l10n.Messages;
/**
* Force a value condition
*
* @author Sinbad²
*
* @version 3.0
*/
public class ValueForcer {
private ValueForcer() {
}
/**
* Not null value
*
* @param value
* Value to test
*
* @throws NullPointerException
* if value is null
*/
public static void notNull(Object value) {
if (value == null) {
throw new NullPointerException(Messages.not_null);
}
}
/**
* Not negative value
*
* @param number
* number
*
* @throws NullPointerException
* if number is null
* @throws IllegalArgumentException
* if number is negative
*/
public static void notNegative(Number number) {
try {
notLowerThan(number, 0);
} catch (IllegalArgumentException exception) {
throw new IllegalArgumentException(NLS.bind(Messages.negative_value, number));
}
}
/**
* Not empty value
*
* @param array
* Object[]
*
* @throws NullPointerException
* if array is empty
*/
public static void notEmpty(Object[] array) {
if (isEmpty(array)) {
throw new IllegalArgumentException(Messages.empty_value);
}
}
public static boolean isEmpty(Object[] parameter) {
notNull(parameter);
return (parameter.length == 0);
}
/**
* Value not lower than limit
*
* @param number
* Number
* @param limit
* Limit
*
* @throws NullPointerException
* if number is null
* @throws NullPointerException
* if limit is null
* @throws IllegalArgumentException
* if value is lower than limit
*/
public static void notLowerThan(Number number, Number limit) {
notNull(number);
notNull(limit);
if (number.doubleValue() < limit.doubleValue()) {
throw new IllegalArgumentException(NLS.bind(Messages.is_lower_than, number, limit));
}
}
/**
* Value not greater than limit
*
* @param number
* Number
* @param limit
* Limit
*
* @throws NullPointerException
* if number is null
* @throws NullPointerException
* if limit is null
* @throws IllegalArgumentException
* if value is greater than limit
*/
public static void notGreaterThan(Number number, Number limit) {
try {
notLowerThan(limit, number);
} catch (IllegalArgumentException exception) {
throw new IllegalArgumentException(NLS.bind(Messages.is_greater_than, number, limit));
}
}
/**
* Value not out of range [lowerLimit, upperLimit]
*
* @param number
* number
* @param lowerLimit
* Lower limit
* @param upperLimit
* Upper limit
*
* @throws NullPointerException
* if number is null
* @throws NullPointerException
* if lowerLimit is null
* @throws NullPointerException
* if upperLimit is null
* @throws IllegalArgumentException
* if upperLimit is lower than lowerLimit
* @throws IllegalArgumentException
* if number is lower than lowerLimit
* @throws IllegalArgumentException
* if number is greater than upperLimit
*/
public static void notOutOfRange(Number number, Number lowerLimit, Number upperLimit) {
notNull(number);
notNull(lowerLimit);
notNull(upperLimit);
notLowerThan(upperLimit, lowerLimit);
try {
notLowerThan(number, lowerLimit);
notLowerThan(upperLimit, number);
} catch (IllegalArgumentException exception) {
throw new IllegalArgumentException(
NLS.bind(Messages.is_out_of_range, new Object[] { number, lowerLimit, upperLimit }));
}
}
/**
* Invalid array size
*
* @param length
* Array length
* @param i
* Valid value
* @param j
* Valid value
* @throws IllegalArgumentException
* The size is not allowed
*/
public static void notInvalidSizeArray(Number length, Number i, Number j) {
if(length != i && length != j) {
throw new IllegalArgumentException(
NLS.bind(Messages.is_out_of_range, new Object[] { length, i, j }));
}
}
public static boolean inRange(double value, double min, double max) {
if (min > max) {
throw new IllegalArgumentException(Messages.is_out_of_range);
}
return ((min <= value) && (value <= max));
}
public static void notIllegalElementType(Object object, String[] types) {
if (!validElementType(object, types)) {
throw new IllegalArgumentException(Messages.illegal_type);
}
}
/**
* Comprueba que un elemento sea de alguno de los tipos indicados.
*
* @param object
* Objeto que debe ser del tipo indicado.
* @param types
* Tipos permitidos.
* @return True si el elemento es de alguno de los tipos indicados, False en
* caso contrario.
* @throw IllegalArgumentException Si object es null o,
* <p>
* si types está vacío o
* <p>
* si types es null.
*/
public static boolean validElementType(Object object, String[] types) {
notEmpty(types);
notNull(object);
String objectClass = object.getClass().toString();
for (String type : types) {
if (objectClass.equals(type)) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,30 @@
package afryca.valueforcer.l10n;
import org.eclipse.osgi.util.NLS;
/**
* Localization messages
*
* @author Sinbad²
* @version 3.0
*/
public class Messages extends NLS {
private static final String BUNDLE_NAME = "afryca.valueforcer.l10n.messages"; //$NON-NLS-1$
public static String is_lower_than;
public static String is_greater_than;
public static String is_out_of_range;
public static String negative_value;
public static String empty_value;
public static String not_null;
public static String illegal_type;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
}
}
@@ -0,0 +1,7 @@
is_greater_than={0} is greater than {1}
is_lower_than={0} is lower than {1}
is_out_of_range={0} is out of range [{1},{2}]
negative_value={0} has a negative value
not_null=Not allowed null value
empty_value=Not allowed empty value
illegal_type=Illegal type
@@ -0,0 +1,7 @@
is_greater_than={0} es mayor que {1}
is_lower_than={0} es menor que {1}
is_out_of_range={0} está fuera del rango [{1},{2}]
negative_value={0} tiene un valor negativo
not_null=Valores nulos no permitidos
empty_value=Valores vacíos no permitidos
illegal_type=Tipo no permitido
@@ -0,0 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.valueforcer
Bundle-Version: 1.0.0.202101221157
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: afryca.valueforcer
Require-Bundle: org.eclipse.core.runtime
Automatic-Module-Name: afryca.valueforcer
@@ -0,0 +1,7 @@
is_greater_than={0} is greater than {1}
is_lower_than={0} is lower than {1}
is_out_of_range={0} is out of range [{1},{2}]
negative_value={0} has a negative value
not_null=Not allowed null value
empty_value=Not allowed empty value
illegal_type=Illegal type
@@ -0,0 +1,7 @@
is_greater_than={0} es mayor que {1}
is_lower_than={0} es menor que {1}
is_out_of_range={0} está fuera del rango [{1},{2}]
negative_value={0} tiene un valor negativo
not_null=Valores nulos no permitidos
empty_value=Valores vacíos no permitidos
illegal_type=Tipo no permitido
@@ -0,0 +1,4 @@
#Fri Jan 22 12:59:14 CET 2021
artifact.main=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.valueforcer\\target\\afryca.valueforcer-1.0.0-SNAPSHOT.jar
artifact.attached.p2artifacts=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.valueforcer\\target\\p2artifacts.xml
artifact.attached.p2metadata=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.valueforcer\\target\\p2content.xml
@@ -0,0 +1,3 @@
artifactId=afryca.valueforcer
groupId=afryca.group
version=1.0.0-SNAPSHOT
@@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<?artifactRepository version='1.1.0'?>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.valueforcer' version='1.0.0.202101221157'>
<properties size='5'>
<property name='artifact.size' value='5651'/>
<property name='download.size' value='5651'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.valueforcer'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
</artifact>
</artifacts>
@@ -0,0 +1,49 @@
<?xml version='1.0' encoding='UTF-8'?>
<units size='1'>
<unit id='afryca.valueforcer' version='1.0.0.202101221157' singleton='false' generation='2'>
<update id='afryca.valueforcer' range='[0.0.0,1.0.0.202101221157)' severity='0'/>
<properties size='9'>
<property name='es.Bundle-Name' value='Forzador de valores'/>
<property name='es.Bundle-Vendor' value='Sinbad²'/>
<property name='df_LT.Bundle-Name' value='Value forcer'/>
<property name='df_LT.Bundle-Vendor' value='Sinbad²'/>
<property name='org.eclipse.equinox.p2.name' value='%Bundle-Name'/>
<property name='org.eclipse.equinox.p2.provider' value='%Bundle-Vendor'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.valueforcer'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
<provides size='7'>
<provided namespace='org.eclipse.equinox.p2.iu' name='afryca.valueforcer' version='1.0.0.202101221157'/>
<provided namespace='osgi.bundle' name='afryca.valueforcer' version='1.0.0.202101221157'/>
<provided namespace='java.package' name='afryca.valueforcer' version='0.0.0'/>
<provided namespace='osgi.identity' name='afryca.valueforcer' version='1.0.0.202101221157'>
<properties size='1'>
<property name='type' value='osgi.bundle'/>
</properties>
</provided>
<provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
<provided namespace='org.eclipse.equinox.p2.localization' name='es' version='1.0.0'/>
<provided namespace='org.eclipse.equinox.p2.localization' name='df_LT' version='1.0.0'/>
</provides>
<requires size='2'>
<required namespace='osgi.bundle' name='org.eclipse.core.runtime' range='0.0.0'/>
<requiredProperties namespace='osgi.ee' match='(&amp;(osgi.ee=JavaSE)(version=1.8))'>
<description>
afryca.valueforcer
</description>
</requiredProperties>
</requires>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.valueforcer' version='1.0.0.202101221157'/>
</artifacts>
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
<touchpointData size='1'>
<instructions size='1'>
<instruction key='manifest'>
Bundle-SymbolicName: afryca.valueforcer&#xA;Bundle-Version: 1.0.0.202101221157&#xA;
</instruction>
</instructions>
</touchpointData>
</unit>
</units>