Class IvmlUtils


  • public class IvmlUtils
    extends java.lang.Object
    Utilities to access IVML/configuration values.
    Author:
    Holger Eichelberger, SSE
    • Constructor Summary

      Constructors 
      Constructor Description
      IvmlUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean getBooleanValue​(net.ssehub.easy.varModel.confModel.IDecisionVariable var, boolean deflt)
      Returns a Boolean value from the given var.
      static net.ssehub.easy.varModel.model.values.Value getConstValue​(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst)
      Returns the constant value of cst if cst is a constant expression.
      static net.ssehub.easy.varModel.model.values.EnumValue getEnumValue​(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
      Returns an enum value from the given var.
      static int getIntValue​(net.ssehub.easy.varModel.confModel.IDecisionVariable var, int deflt)
      Returns an integer value from the given var.
      static int getIntValue​(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst, int dflt)
      Returns the constant int value of cst if cst is a constant int expression.
      static net.ssehub.easy.varModel.confModel.IDecisionVariable getNestedSafe​(net.ssehub.easy.varModel.confModel.IDecisionVariable var, java.lang.String nested)
      Returns a nested variable, returning null if var is null.
      static java.lang.String getStringValue​(net.ssehub.easy.varModel.confModel.IDecisionVariable var, java.lang.String deflt)
      Returns a string value from the given var.
      static java.lang.String getVarNameSafe​(net.ssehub.easy.varModel.model.AbstractVariable var, java.lang.String dflt)
      Returns the name of var taking null into account.
      static boolean isOfCompoundType​(net.ssehub.easy.varModel.confModel.IDecisionVariable var, java.lang.String typeName)
      Returns whether the given var is of compound type with name typeName.
      static java.lang.String toName​(net.ssehub.easy.varModel.model.values.EnumValue value, java.lang.String deflt)
      Turns an enum value to its name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IvmlUtils

        public IvmlUtils()
    • Method Detail

      • isOfCompoundType

        public static boolean isOfCompoundType​(net.ssehub.easy.varModel.confModel.IDecisionVariable var,
                                               java.lang.String typeName)
        Returns whether the given var is of compound type with name typeName.
        Parameters:
        var - the variable
        typeName - the type name of the compound
        Returns:
        true if var is of a compound type with typeName, false else
      • getNestedSafe

        public static net.ssehub.easy.varModel.confModel.IDecisionVariable getNestedSafe​(net.ssehub.easy.varModel.confModel.IDecisionVariable var,
                                                                                         java.lang.String nested)
        Returns a nested variable, returning null if var is null.
        Parameters:
        var - the variable
        nested - the name of the nested variable
        Returns:
        the nested variable or null
      • getStringValue

        public static java.lang.String getStringValue​(net.ssehub.easy.varModel.confModel.IDecisionVariable var,
                                                      java.lang.String deflt)
        Returns a string value from the given var.
        Parameters:
        var - the variable (may be null)
        deflt - the default value to return if no value can be obtained
        Returns:
        the value or deflt
      • getEnumValue

        public static net.ssehub.easy.varModel.model.values.EnumValue getEnumValue​(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
        Returns an enum value from the given var.
        Parameters:
        var - the variable (may be null)
        Returns:
        the value or null
      • toName

        public static java.lang.String toName​(net.ssehub.easy.varModel.model.values.EnumValue value,
                                              java.lang.String deflt)
        Turns an enum value to its name.
        Parameters:
        value - the value, may be null
        deflt - the default value to return if no value can be obtained
        Returns:
        the name of the enum literal or deflt
      • getIntValue

        public static int getIntValue​(net.ssehub.easy.varModel.confModel.IDecisionVariable var,
                                      int deflt)
        Returns an integer value from the given var.
        Parameters:
        var - the variable (may be null)
        deflt - the default value to return if no value can be obtained
        Returns:
        the value or deflt
      • getBooleanValue

        public static boolean getBooleanValue​(net.ssehub.easy.varModel.confModel.IDecisionVariable var,
                                              boolean deflt)
        Returns a Boolean value from the given var.
        Parameters:
        var - the variable (may be null)
        deflt - the default value to return if no value can be obtained
        Returns:
        the value or deflt
      • getVarNameSafe

        public static java.lang.String getVarNameSafe​(net.ssehub.easy.varModel.model.AbstractVariable var,
                                                      java.lang.String dflt)
        Returns the name of var taking null into account.
        Parameters:
        var - the variable
        dflt - the default if var is null
        Returns:
        the name or dflt
      • getConstValue

        public static net.ssehub.easy.varModel.model.values.Value getConstValue​(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst)
        Returns the constant value of cst if cst is a constant expression.
        Parameters:
        cst - the constraint syntax tree
        Returns:
        the constant value or null
      • getIntValue

        public static int getIntValue​(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst,
                                      int dflt)
        Returns the constant int value of cst if cst is a constant int expression.
        Parameters:
        cst - the constraint syntax tree
        dflt - the default value if cst is not a constant int expression
        Returns:
        the constant value or dflt