Class EvaluationUtils
- java.lang.Object
-
- net.ssehub.easy.varModel.cstEvaluation.EvaluationUtils
-
class EvaluationUtils extends java.lang.ObjectSome evaluation utility methods.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classEvaluationUtils.VariableReplacerImplements a variable replacer.
-
Constructor Summary
Constructors Constructor Description EvaluationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static intcalculateDiff(CustomOperation operation, IDatatype returns, IDatatype[] argTypes)Returns the difference of the operations in terms of different (assignable) types.(package private) static java.lang.StringcreateSpaces(int count)Creates a string ofcountspaces.private static intdiff(Compound type, IDatatype opType)Calculates the difference between the compoundtypeand its refinement hierarcy andopType.private static intdiff(IDatatype opType, IDatatype paramType)Returns the difference indicator between two types.private static intdiffContainer(Container opCont, Container paramCont)Returns the difference of container types in terms of assignable types.(package private) static IDecisionVariablefindAttribute(IDecisionVariable var, AbstractVariable decl, boolean byName)Finds an attribute decision variable for the given decision variable and attribute declaration.(package private) static CompoundgetDeclaringCompound(AbstractVariable decl)Returns the declaring compound type.(package private) static java.util.Map<IDatatype,java.util.List<AbstractVariable>>groupQuantors(java.util.Iterator<AbstractVariable> staticIter)Turns the statically accessed variables into groups of variables belonging to the same compound.(package private) static voidrelease(EvaluationAccessor[] accessors)Releases a bunch of accessors.
-
-
-
Method Detail
-
createSpaces
static java.lang.String createSpaces(int count)
Creates a string ofcountspaces. (debugging)- Parameters:
count- the number of spaces- Returns:
- the string
-
release
static void release(EvaluationAccessor[] accessors)
Releases a bunch of accessors.- Parameters:
accessors- the accessors to be released
-
getDeclaringCompound
static Compound getDeclaringCompound(AbstractVariable decl)
Returns the declaring compound type.- Parameters:
decl- the variable declaration to return the compound parent for- Returns:
- the compound parent or null if there is none
-
groupQuantors
static java.util.Map<IDatatype,java.util.List<AbstractVariable>> groupQuantors(java.util.Iterator<AbstractVariable> staticIter)
Turns the statically accessed variables into groups of variables belonging to the same compound. These groups will then be bound by the same quantor (iterator).- Parameters:
staticIter- the iterator providing access to the statically accessed variables- Returns:
- a mapping of compound types to used variables forming the quantor groups
-
findAttribute
static IDecisionVariable findAttribute(IDecisionVariable var, AbstractVariable decl, boolean byName)
Finds an attribute decision variable for the given decision variable and attribute declaration.- Parameters:
var- the variable to search the decision variable fordecl- the attribute declarationbyName- compare by name or by declaration- Returns:
- the attribute decision variable or null if not found
-
calculateDiff
static int calculateDiff(CustomOperation operation, IDatatype returns, IDatatype[] argTypes)
Returns the difference of the operations in terms of different (assignable) types.- Parameters:
operation- the candidate operation for dispatchreturns- the return type of the operation to be dispatched (for checking)argTypes- the actual argument types- Returns:
- the difference,
0in case of signature equality,-1if the signature does not match the required types, a the number of assignable (not equal) types else
-
diff
private static int diff(IDatatype opType, IDatatype paramType)
Returns the difference indicator between two types.- Parameters:
opType- the operation typeparamType- the parameter type- Returns:
0in case of type equality,-1if the signature does not match the required types,1in case of assignable (not equal) types else
-
diff
private static int diff(Compound type, IDatatype opType)
Calculates the difference between the compoundtypeand its refinement hierarcy andopType.- Parameters:
type- the compound type to iterate overopType- the type to compare- Returns:
- the difference count
-
diffContainer
private static int diffContainer(Container opCont, Container paramCont)
Returns the difference of container types in terms of assignable types.- Parameters:
opCont- the container from the operation signatureparamCont- the parameter / argument container type allowed to iterate to compare refined types- Returns:
- the difference,
-1in case of a type mismatch
-
-