Class EvaluationUtils

java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.EvaluationUtils

class EvaluationUtils extends Object
Some evaluation utility methods.
Author:
Holger Eichelberger
  • Constructor Details

    • EvaluationUtils

      EvaluationUtils()
  • Method Details

    • createSpaces

      static String createSpaces(int count)
      Creates a string of count spaces. (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 Map<IDatatype,List<AbstractVariable>> groupQuantors(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 for
      decl - the attribute declaration
      byName - 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 dispatch
      returns - the return type of the operation to be dispatched (for checking)
      argTypes - the actual argument types
      Returns:
      the difference, 0 in case of signature equality, -1 if 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 type
      paramType - the parameter type
      Returns:
      0 in case of type equality, -1 if the signature does not match the required types, 1 in case of assignable (not equal) types else
    • diff

      private static int diff(Compound type, IDatatype opType)
      Calculates the difference between the compound type and its refinement hierarcy and opType.
      Parameters:
      type - the compound type to iterate over
      opType - 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 signature
      paramCont - the parameter / argument container type allowed to iterate to compare refined types
      Returns:
      the difference, -1 in case of a type mismatch