Class GenericOperations
java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.GenericOperations
Generic operation implementation for the individual types. Testing shall happen
along the operation defining types.
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final IOperationEvaluatorImplements the "asType" operation.(package private) static final IOperationEvaluatorThe generic assignment operation.(package private) static final IOperationEvaluatorImplements the "copy" operation.(package private) static final IOperationEvaluatorImplements the generic equals operation.(package private) static final IOperationEvaluator(package private) static final IOperationEvaluatorImplements the "ifDefined" operation.(package private) static final IOperationEvaluatorImplements the "isDefined" operation.(package private) static final IOperationEvaluatorImplements the "isKindOf" operation.(package private) static final IOperationEvaluatorImplements the "isTypeOf" operation.(package private) static final IOperationEvaluator(package private) static final IOperationEvaluatorImplements the generic toString operation.(package private) static final IOperationEvaluatorImplements the "typeOf" operation.(package private) static final IOperationEvaluatorImplements the generic not-equals operation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static EvaluationAccessorassign(EvaluationAccessor operand, EvaluationAccessor[] arguments, boolean asAssignment) Performs a value assignment.private static final EvaluationAccessorcheckDefined(EvaluationAccessor operand, EvaluationAccessor[] arguments, boolean lazy) Common implementation of isDefined/ifDefined.(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 final 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 StringlocaleToString(EvaluationAccessor accessor) Turns the locale of the accessor/context into a string.static voidregister()Registers the defined operations.private static IDatatypeReturns the type ofvalue.
-
Field Details
-
ASSIGNMENT
The generic assignment operation. -
EQUALS
Implements the generic equals operation. -
UNEQUALS
Implements the generic not-equals operation. -
TO_STRING
Implements the generic toString operation. -
IS_DEFINED
Implements the "isDefined" operation. -
IF_DEFINED
Implements the "ifDefined" operation. -
COPY
Implements the "copy" operation. -
TYPE_OF
Implements the "typeOf" operation. -
IS_TYPE_OF
Implements the "isTypeOf" operation. -
IS_KIND_OF
Implements the "isKindOf" operation. -
AS_TYPE
Implements the "asType" operation. -
GET_LOCALE
-
SET_LOCALE
-
-
Constructor Details
-
GenericOperations
private GenericOperations()Prevents external instantiation.
-
-
Method Details
-
localeToString
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
Returns the type ofvalue.- Parameters:
value- the value to be turned into its type- Returns:
- the type (may be null)
-
isAssignableCompound
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
-
checkDefined
private static final EvaluationAccessor checkDefined(EvaluationAccessor operand, EvaluationAccessor[] arguments, boolean lazy) Common implementation of isDefined/ifDefined.- Parameters:
operand- the operandarguments- the operation argumentslazy- whether an undefined, so far assigned variable causes an error (false) or not (lazy,true)- Returns:
- the evaluation result, may be null for undefined
-