Class ConfigQuery
java.lang.Object
net.ssehub.easy.varModel.confModel.ConfigQuery
Provides an interface to query
Configurations.- Author:
- El-Sharkawy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddVariableByType(IDecisionVariable variable, IDatatype type, boolean onlyToplevel, List<IDecisionVariable> variables) Recursive part ofcollectVariablesByType(Configuration, IDatatype, boolean), which searches for (nested) variables.static List<IDecisionVariable> collectVariablesByType(Configuration config, IDatatype type, boolean onlyToplevel) Gathers allIDecisionVariables of the givenConfiguration, which match the specified type.(package private) static List<ConstraintSyntaxTree> possibleValuesForReferences(Configuration config, Reference refType) Calculates possible values (ConstraintSyntaxTree-based) for a givenReferencevariable.static ConstraintSyntaxTreetoCST(IDecisionVariable variable) Converts anIDecisionVariableof the configuration to aVariableexpression, so that it can be used for a value assignment, e.g.
-
Constructor Details
-
ConfigQuery
public ConfigQuery()
-
-
Method Details
-
possibleValuesForReferences
static List<ConstraintSyntaxTree> possibleValuesForReferences(Configuration config, Reference refType) Calculates possible values (ConstraintSyntaxTree-based) for a givenReferencevariable.- Parameters:
config- TheConfigurationwhich contains the queried values.refType- The reference for which possible values should be calculated for.- Returns:
- A maybe empty list of possible values for the given
Reference.
-
collectVariablesByType
public static List<IDecisionVariable> collectVariablesByType(Configuration config, IDatatype type, boolean onlyToplevel) Gathers allIDecisionVariables of the givenConfiguration, which match the specified type.- Parameters:
config- TheConfigurationwhich contains the queried variables.type- The type of which the variables shall be returned, or null if all variables should be returned.onlyToplevel-trueonly top level variables will be returned,falsealso nested variables will be returned, e.g. nested inside a compound.- Returns:
- variables The set of variables, which match the given parameters.
-
addVariableByType
private static void addVariableByType(IDecisionVariable variable, IDatatype type, boolean onlyToplevel, List<IDecisionVariable> variables) Recursive part ofcollectVariablesByType(Configuration, IDatatype, boolean), which searches for (nested) variables.- Parameters:
variable- The currently tested variable, which should maybe added.type- The type of which the variables shall be returned, or null if all variables should be returned.onlyToplevel-trueonly top level variables will be returned,falsealso nested variables will be returned, e.g. nested inside a compound.variables- The set of variables to be returned (will be changed as a side-effect).
-
toCST
Converts anIDecisionVariableof the configuration to aVariableexpression, so that it can be used for a value assignment, e.g. for creating a value assignment of aReference.- Parameters:
variable- The variable to be converted, must not be null.- Returns:
- An absolute expression pointing to the given variable, considering nested variables, e.g., of compounds.
- Throws:
ModelQueryException- If the given variable could not be resolved to an unambiguous expression, e.g., if the variable is nested inside aSet.
-