Class ContainerOperations
java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.ContainerOperations
Implements the default container operations.
- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classImplements a container calculation evaluator (just as needed for now).(package private) static interfaceDefines a container/container operation.(package private) static classImplements a container/container operation generically.(package private) static final classA combined container value / accessor.(package private) static interfaceDefines a container/value operation.(package private) static classImplements a container/value operation generically.(package private) static final classImplements the "includes"/"excludes" function.(package private) static final classImplements the "flattens" operation.(package private) static final classImplements the "includesAll"/"excludesAll" function.(package private) static final classImplements the "isEmpty"/"notEmpty" function.(package private) static classImplements the typeSelection operation. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final IOperationEvaluatorImplements the "add" operation.(package private) static final IOperationEvaluatorDefines the "asSequence" operation.(package private) static final IOperationEvaluatorDefines the "asSet" operation.(package private) static final IOperationEvaluatorImplements the "avg" operation.(package private) static final net.ssehub.easy.basics.pool.Pool<ContainerOperations.ContainerArgument> (package private) static final IOperationEvaluatorImplements the "count" operation.(package private) static final IOperationEvaluatorImplements the "intersect" operation generically.(package private) static final IOperationEvaluator(package private) static final IOperationEvaluator(package private) static final IOperationEvaluatorImplementsContainer.SIZE. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static final voidaddAll(ContainerOperations.ContainerArgument cnt, List<Value> result, EvaluationAccessor resAcc) Adds all elements incnttoresult.(package private) static final voidaddAll(ContainerOperations.ContainerArgument cnt, Set<Value> result, EvaluationAccessor resAcc) Adds all elements incnttoresult.private static final EvaluationAccessorconvert(EvaluationAccessor operand, IDatatype targetType) Performs the conversion of the operand to the given (container) datatype.(package private) static voidflatten(Value value, Collection<Value> result) (Recursively) Flattens the given value if needed.(package private) static final EvaluationAccessorfound(EvaluationAccessor operand, EvaluationAccessor[] arguments, boolean negate) Returns whether the first argument value can be found in theoperandgiven that operand is a container.private static final EvaluationAccessormax(EvaluationAccessor operand, EvaluationAccessor[] arguments) Performs the MAX operation the given (container) datatype.private static final EvaluationAccessormin(EvaluationAccessor operand, EvaluationAccessor[] arguments) Performs the MIN operation the given (container) datatype.static voidregister()Registers the defined operations.
-
Field Details
-
CA_POOL
-
SIZE
ImplementsContainer.SIZE. -
ADD
Implements the "add" operation. -
AVG
Implements the "avg" operation. -
AS_SET
Defines the "asSet" operation. Due to the implementation of values in EASy, this operation can be implemented generically. -
AS_SEQUENCE
Defines the "asSequence" operation. Due to the implementation of values in EASy, this operation can be implemented generically. -
MIN
-
MAX
-
INTERSECT
Implements the "intersect" operation generically. -
COUNT
Implements the "count" operation.
-
-
Constructor Details
-
ContainerOperations
private ContainerOperations()Prevent instance creation.
-
-
Method Details
-
register
public static void register()Registers the defined operations. -
convert
Performs the conversion of the operand to the given (container) datatype.- Parameters:
operand- the operand to be convertedtargetType- the target datatype- Returns:
- the converted operand
-
min
private static final EvaluationAccessor min(EvaluationAccessor operand, EvaluationAccessor[] arguments) Performs the MIN operation the given (container) datatype.- Parameters:
operand- the operand to be convertedarguments- the arguments- Returns:
- The result of the arithmetic operation, null if the operation cannot be applied
-
max
private static final EvaluationAccessor max(EvaluationAccessor operand, EvaluationAccessor[] arguments) Performs the MAX operation the given (container) datatype.- Parameters:
operand- the operand to be convertedarguments- the arguments- Returns:
- The result of the arithmetic operation, null if the operation cannot be applied
-
addAll
static final void addAll(ContainerOperations.ContainerArgument cnt, List<Value> result, EvaluationAccessor resAcc) Adds all elements incnttoresult.- Parameters:
cnt- the source of the elementsresult- the target (to be modified as a side effect)resAcc- the accessor tocontfor taking over bound elements
-
addAll
static final void addAll(ContainerOperations.ContainerArgument cnt, Set<Value> result, EvaluationAccessor resAcc) Adds all elements incnttoresult.- Parameters:
cnt- the source of the elementsresult- the target (to be modified as a side effect)resAcc- the accessor tocontfor taking over bound elements
-
found
static final EvaluationAccessor found(EvaluationAccessor operand, EvaluationAccessor[] arguments, boolean negate) Returns whether the first argument value can be found in theoperandgiven that operand is a container.- Parameters:
operand- the operandarguments- the argumentsnegate- negate the result, i.e., from found to not found- Returns:
- whether the first argument was (not) found in
operand
-
flatten
(Recursively) Flattens the given value if needed.- Parameters:
value- the value to be flattenedresult- the flattened values (modified as a side effect)
-