Class GenericOperations
- java.lang.Object
-
- net.ssehub.easy.varModel.cstEvaluation.GenericOperations
-
public class GenericOperations extends java.lang.ObjectGeneric operation implementation for the individual types. Testing shall happen along the operation defining types.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static IOperationEvaluatorAS_TYPEImplements the "asType" operation.(package private) static IOperationEvaluatorASSIGNMENTThe generic assignment operation.(package private) static IOperationEvaluatorCOPYImplements the "copy" operation.(package private) static IOperationEvaluatorEQUALSImplements the generic equals operation.(package private) static IOperationEvaluatorGET_LOCALE(package private) static IOperationEvaluatorIS_DEFINEDImplements the "is defined" operation.(package private) static IOperationEvaluatorIS_KIND_OFImplements the "isKindOf" operation.(package private) static IOperationEvaluatorIS_TYPE_OFImplements the "isTypeOf" operation.(package private) static IOperationEvaluatorSET_LOCALE(package private) static IOperationEvaluatorTO_STRINGImplements the generic toString operation.(package private) static IOperationEvaluatorTYPE_OFImplements the "typeOf" operation.(package private) static IOperationEvaluatorUNEQUALSImplements the generic not-equals operation.
-
Constructor Summary
Constructors Modifier Constructor Description privateGenericOperations()Prevents external instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static EvaluationAccessorassign(EvaluationAccessor operand, EvaluationAccessor[] arguments, boolean asAssignment)Performs a value assignment.(package private) static EvaluationAccessorequals(EvaluationAccessor operand, EvaluationAccessor[] arguments, boolean negate)Implements a generic equality operation for basic values (excluding compounds and containers).(package private) static EvaluationAccessorequalsNull(Value operand, Value argument, EvaluationContext context, boolean negate)Implements a generic equality operation for null values.private static booleanisAssignableCompound(EvaluationAccessor operand)Returns true ifEvaluationAccessoris a compound and all compounds nested elements are undefined.static java.lang.StringlocaleToString(EvaluationAccessor accessor)Turns the locale of the accessor/context into a string.static voidregister()Registers the defined operations.private static IDatatypetoType(Value value)Returns the type ofvalue.
-
-
-
Field Detail
-
ASSIGNMENT
static final IOperationEvaluator ASSIGNMENT
The generic assignment operation.
-
EQUALS
static final IOperationEvaluator EQUALS
Implements the generic equals operation.
-
UNEQUALS
static final IOperationEvaluator UNEQUALS
Implements the generic not-equals operation.
-
TO_STRING
static final IOperationEvaluator TO_STRING
Implements the generic toString operation.
-
IS_DEFINED
static final IOperationEvaluator IS_DEFINED
Implements the "is defined" operation.
-
COPY
static final IOperationEvaluator COPY
Implements the "copy" operation.
-
TYPE_OF
static final IOperationEvaluator TYPE_OF
Implements the "typeOf" operation.
-
IS_TYPE_OF
static final IOperationEvaluator IS_TYPE_OF
Implements the "isTypeOf" operation.
-
IS_KIND_OF
static final IOperationEvaluator IS_KIND_OF
Implements the "isKindOf" operation.
-
AS_TYPE
static final IOperationEvaluator AS_TYPE
Implements the "asType" operation.
-
GET_LOCALE
static final IOperationEvaluator GET_LOCALE
-
SET_LOCALE
static final IOperationEvaluator SET_LOCALE
-
-
Method Detail
-
localeToString
public static java.lang.String localeToString(EvaluationAccessor accessor)
Turns the locale of the accessor/context into a string.- Parameters:
accessor- the accessor- Returns:
- the locale as string
-
register
public static void register()
Registers the defined operations.
-
equals
static EvaluationAccessor equals(EvaluationAccessor operand, EvaluationAccessor[] arguments, boolean negate)
Implements a generic equality operation for basic values (excluding compounds and containers).- Parameters:
operand- the operand valuearguments- the argument valuesnegate- whether the (boolean) result shall be negated- Returns:
- a boolean value if equality can be evaluated, null else
-
equalsNull
static final EvaluationAccessor equalsNull(Value operand, Value argument, EvaluationContext context, boolean negate)
Implements a generic equality operation for null values.- Parameters:
operand- the operand valueargument- the argument valuecontext- the evaluation contextnegate- whether the (boolean) result shall be negated- Returns:
- a boolean value if equality can be evaluated, null else
-
toType
private static IDatatype toType(Value value)
Returns the type ofvalue.- Parameters:
value- the value to be turned into its type- Returns:
- the type (may be null)
-
isAssignableCompound
private static boolean isAssignableCompound(EvaluationAccessor operand)
Returns true ifEvaluationAccessoris a compound and all compounds nested elements are undefined.- Parameters:
operand-EvaluationAccessorto be checked.- Returns:
- true if all nested elements are undefined.
-
assign
private static EvaluationAccessor assign(EvaluationAccessor operand, EvaluationAccessor[] arguments, boolean asAssignment)
Performs a value assignment.- Parameters:
operand- the operandarguments- the argumentsasAssignment- called as part of an assignment (hard constraint,true) or as part of a soft constraint (false)- Returns:
- the result evaluation accessor
-
-