Class ConfigQuery
- java.lang.Object
-
- net.ssehub.easy.varModel.confModel.ConfigQuery
-
public class ConfigQuery extends java.lang.ObjectProvides an interface to queryConfigurations.- Author:
- El-Sharkawy
-
-
Constructor Summary
Constructors Constructor Description ConfigQuery()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidaddVariableByType(IDecisionVariable variable, IDatatype type, boolean onlyToplevel, java.util.List<IDecisionVariable> variables)Recursive part ofcollectVariablesByType(Configuration, IDatatype, boolean), which searches for (nested) variables.static java.util.List<IDecisionVariable>collectVariablesByType(Configuration config, IDatatype type, boolean onlyToplevel)Gathers allIDecisionVariables of the givenConfiguration, which match the specified type.(package private) static java.util.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.
-
-
-
Method Detail
-
possibleValuesForReferences
static java.util.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 java.util.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- true only top level variables will be returned, false also 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, java.util.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- true only top level variables will be returned, false also 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
public static ConstraintSyntaxTree toCST(IDecisionVariable variable) throws ModelQueryException
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.
-
-