Class GenericNumberOperations
- java.lang.Object
-
- net.ssehub.easy.varModel.cstEvaluation.GenericNumberOperations
-
class GenericNumberOperations extends java.lang.ObjectGeneric Number (IntegerType,RealType) operations.- Author:
- El-Sharkawy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interfaceGenericNumberOperations.INumberComparatorStrategy for comparing two numbers.
-
Field Summary
Fields Modifier and Type Field Description private static IOperationEvaluatorABSOLUTEprivate static IOperationEvaluatorGREATERprivate static GenericNumberOperations.INumberComparatorGREATER_COMPARATORprivate static IOperationEvaluatorGREATER_EQUALSprivate static GenericNumberOperations.INumberComparatorGREATER_EQUALS_COMPARATORprivate static IOperationEvaluatorINVERSEprivate static IOperationEvaluatorLESSprivate static GenericNumberOperations.INumberComparatorLESS_COMPARATORprivate static IOperationEvaluatorLESS_EQUALSprivate static GenericNumberOperations.INumberComparatorLESS_EQUALS_COMPARATOR
-
Constructor Summary
Constructors Constructor Description GenericNumberOperations()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static EvaluationAccessorabsolute(EvaluationAccessor operand, EvaluationAccessor[] arguments)Removes the sign of a number (IntegerTypeorRealType).private static EvaluationAccessorcomparisionOperation(EvaluationAccessor operand, EvaluationAccessor[] arguments, GenericNumberOperations.INumberComparator strategy)Compares two numbers.private static EvaluationAccessorinverse(EvaluationAccessor operand, EvaluationAccessor[] arguments)Negates a number (IntegerTypeorRealType).static voidregister()Registers the defined operations.
-
-
-
Field Detail
-
LESS_COMPARATOR
private static final GenericNumberOperations.INumberComparator LESS_COMPARATOR
-
LESS_EQUALS_COMPARATOR
private static final GenericNumberOperations.INumberComparator LESS_EQUALS_COMPARATOR
-
GREATER_COMPARATOR
private static final GenericNumberOperations.INumberComparator GREATER_COMPARATOR
-
GREATER_EQUALS_COMPARATOR
private static final GenericNumberOperations.INumberComparator GREATER_EQUALS_COMPARATOR
-
GREATER
private static final IOperationEvaluator GREATER
-
GREATER_EQUALS
private static final IOperationEvaluator GREATER_EQUALS
-
LESS
private static final IOperationEvaluator LESS
-
LESS_EQUALS
private static final IOperationEvaluator LESS_EQUALS
-
INVERSE
private static final IOperationEvaluator INVERSE
-
ABSOLUTE
private static final IOperationEvaluator ABSOLUTE
-
-
Method Detail
-
register
public static final void register()
Registers the defined operations.
-
comparisionOperation
private static EvaluationAccessor comparisionOperation(EvaluationAccessor operand, EvaluationAccessor[] arguments, GenericNumberOperations.INumberComparator strategy)
Compares two numbers. Supported comparisons are: less, less_equals, greater, and greater_equals.- Parameters:
operand- the operandarguments- the argumentsstrategy- AGenericNumberOperations.INumberComparator, specifying which comparison should be used.- Returns:
- The result of the comparison.
-
inverse
private static EvaluationAccessor inverse(EvaluationAccessor operand, EvaluationAccessor[] arguments)
Negates a number (IntegerTypeorRealType).- Parameters:
operand- The number which shall be negated.arguments- Must be null or empty.- Returns:
- The given operand * -1;
-
absolute
private static EvaluationAccessor absolute(EvaluationAccessor operand, EvaluationAccessor[] arguments)
Removes the sign of a number (IntegerTypeorRealType).- Parameters:
operand- The number which shall be made absolute.arguments- Must be null or empty.- Returns:
- The given |operand|;
-
-