Class DefaultValueTranslator


  • public class DefaultValueTranslator
    extends java.lang.Object
    Turns partial compound default values into complete values as EASy allows only one default assignment per variable.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • DefaultValueTranslator

        public DefaultValueTranslator()
    • Method Detail

      • translateDefaultValue

        public static ConstraintSyntaxTree translateDefaultValue​(ConstraintSyntaxTree cst)
                                                          throws CSTSemanticException
        Translates a default value into its complete one-time default assignment value by including nested default values of the defining compound/container types.
        Parameters:
        cst - the constraint to be translated
        Returns:
        the translated constraint or cst
        Throws:
        CSTSemanticException - if constraint expressions cannot correctly be built
      • translateDefaultValues

        private static void translateDefaultValues​(Compound type,
                                                   java.util.Map<java.lang.String,​ConstraintSyntaxTree> values,
                                                   java.util.Map<java.lang.String,​AbstractVariable> decls)
                                            throws CSTSemanticException
        Recursively translates the default values of type into values and decls, but only if the slots are not already allocated.
        Parameters:
        type - the type to be translated
        values - the values, i.e., slot name to value expression mappings
        decls - the declarations, i.e., slot name to declaration mappings
        Throws:
        CSTSemanticException - if constraint expressions cannot correctly be built
      • createTranslatedCompoundInitializer

        private static CompoundInitializer createTranslatedCompoundInitializer​(Compound type,
                                                                               java.util.Map<java.lang.String,​ConstraintSyntaxTree> values,
                                                                               java.util.Map<java.lang.String,​AbstractVariable> decls)
                                                                        throws CSTSemanticException
        Creates a translated compound initializer.
        Parameters:
        type - the type initializer represents
        values - the values, i.e., slot name to value expression mappings
        decls - the declarations, i.e., slot name to declaration mappings
        Returns:
        the created initializer
        Throws:
        CSTSemanticException - if constraint expressions cannot correctly be built