Class ConfigurationContextResolver
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.configuration.ConfigurationContextResolver
-
class ConfigurationContextResolver extends java.lang.ObjectResolves the context around changed variables, including their parent variables, their references and the variables referencing them. Create an instance, callresolve()and obtain the result fromvariables(),attributes()andfilter().- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classConfigurationContextResolver.HashFilterImplements a hash-based filter.private static classConfigurationContextResolver.ResolutionListStores the variables already processed and to be resolved.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Attribute>attributesprivate java.util.Set<AbstractIvmlVariable>changedprivate Configurationconfigurationprivate ConfigurationContextResolver.HashFilterfilterprivate ConfigurationContextResolver.ResolutionListresolveprivate java.util.List<DecisionVariable>variables
-
Constructor Summary
Constructors Constructor Description ConfigurationContextResolver(Configuration configuration, java.util.Set<AbstractIvmlVariable> changed)Creates a context resolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attribute[]attributes()Returns the attributes to be used in the configuration.private voidaugment(IDecisionVariable dVar, boolean viaParent)AugmentsdVarand its transitive parents.private voidcollectReference(IDecisionVariable var, Value val, java.util.Map<AbstractVariable,java.util.List<IDecisionVariable>> references)Collects the references for a variable and a single value (entry in case of a collection).private java.util.Map<AbstractVariable,java.util.List<IDecisionVariable>>collectReferences()Collects all references in the configuration.private voidcollectReferences(IDecisionVariable var, java.util.Map<AbstractVariable,java.util.List<IDecisionVariable>> references)Collects the references for a single variable.private AbstractIvmlVariablecreateVilInstance(IDecisionVariable decVar, Configuration configuration)Obtains a mapping instance fromconfigurationor creates a new one.IVariableFilterfilter()Returns the filter to be used in the configuration.private voidmap(IDecisionVariable var, boolean viaParent)Map the variable and its nested variables to the configuration and follows references.private voidmapVar(IDecisionVariable var, boolean resolve, boolean viaParent)Map the variable (without nested) to the configuration and follows references, but only if frozen.voidresolve()Resolve the context.DecisionVariable[]variables()Returns the variables to be used in the configuration.
-
-
-
Field Detail
-
configuration
private Configuration configuration
-
changed
private java.util.Set<AbstractIvmlVariable> changed
-
variables
private java.util.List<DecisionVariable> variables
-
attributes
private java.util.List<Attribute> attributes
-
filter
private ConfigurationContextResolver.HashFilter filter
-
resolve
private ConfigurationContextResolver.ResolutionList resolve
-
-
Constructor Detail
-
ConfigurationContextResolver
public ConfigurationContextResolver(Configuration configuration, java.util.Set<AbstractIvmlVariable> changed)
Creates a context resolver.- Parameters:
configuration- the configuration to resolve withinchanged- the changed variables to resolve the context for
-
-
Method Detail
-
resolve
public void resolve()
Resolve the context.
-
map
private void map(IDecisionVariable var, boolean viaParent)
Map the variable and its nested variables to the configuration and follows references.- Parameters:
var- the variable to mapviaParent- was this called via a parent recursion?
-
mapVar
private void mapVar(IDecisionVariable var, boolean resolve, boolean viaParent)
Map the variable (without nested) to the configuration and follows references, but only if frozen.- Parameters:
var- the variable to mapresolve- considerdecVarfor reverse reference resolutionviaParent- was called via parent recursion
-
createVilInstance
private AbstractIvmlVariable createVilInstance(IDecisionVariable decVar, Configuration configuration)
Obtains a mapping instance fromconfigurationor creates a new one.- Parameters:
decVar- the decision variable to obtain or createconfiguration- the configuration for lookup- Returns:
- the mapper instance
-
augment
private void augment(IDecisionVariable dVar, boolean viaParent)
AugmentsdVarand its transitive parents.- Parameters:
dVar- the decision variable to augmentviaParent- was called via parent recursion
-
collectReferences
private java.util.Map<AbstractVariable,java.util.List<IDecisionVariable>> collectReferences()
Collects all references in the configuration.- Returns:
- all references in terms of a reference target - referring elements maps
-
collectReferences
private void collectReferences(IDecisionVariable var, java.util.Map<AbstractVariable,java.util.List<IDecisionVariable>> references)
Collects the references for a single variable.- Parameters:
var- the variable to collect the references forreferences- the references in terms of a reference target - referring elements maps (modified as a side effect)
-
collectReference
private void collectReference(IDecisionVariable var, Value val, java.util.Map<AbstractVariable,java.util.List<IDecisionVariable>> references)
Collects the references for a variable and a single value (entry in case of a collection).- Parameters:
var- the variable to collect the references forval- the value (entry)references- the references in terms of a reference target - referring elements maps (modified as a side effect)
-
variables
public DecisionVariable[] variables()
Returns the variables to be used in the configuration.- Returns:
- the variables
-
attributes
public Attribute[] attributes()
Returns the attributes to be used in the configuration.- Returns:
- the attributes
-
filter
public IVariableFilter filter()
Returns the filter to be used in the configuration.- Returns:
- the filter
-
-