class Resolver
extends java.lang.Object
implements net.ssehub.easy.varModel.cstEvaluation.IResolutionListener
markForReuse() before the first call to
resolve() and after reasoning completed, call clear(). When performing a further reasoning on this
instance, call reInit().| Modifier and Type | Class and Description |
|---|---|
private class |
Resolver.CompoundAnnotationMapper
Implements a compound annotation mapper.
|
private class |
Resolver.ConstraintTranslationVisitor
Visits the contents of a project for translation.
|
private class |
Resolver.OtherConstraintsProcessor
Implements a processor for constraints, for which variables (including the variable mapping) shall be substituted
and the result shall be added to
otherConstraints. |
private static class |
Resolver.ReasonerState
Represents the state of the resolver/reasoner to be kept in case of incremental reasoning.
|
| Modifier and Type | Field and Description |
|---|---|
private Resolver.CompoundAnnotationMapper |
annotationMapper |
private net.ssehub.easy.varModel.confModel.IAssignmentState |
assignmentState |
private net.ssehub.easy.varModel.confModel.Configuration |
config |
private net.ssehub.easy.reasoning.core.reasoner.ConstraintBase |
constraintBase |
private int |
constraintCounter |
private ContextStack |
contexts |
private Resolver.ReasonerState |
copiedState |
private net.ssehub.easy.reasoning.core.reasoner.ConstraintList |
defaultConstraints |
private net.ssehub.easy.reasoning.core.reasoner.ConstraintList |
deferredDefaultConstraints |
private long |
endTimestamp |
private long |
evaluationTime |
private EvalVisitor |
evaluator |
private FailedElements |
failedElements |
private boolean |
hasTimeout |
private boolean |
incremental |
private net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration.IAdditionalInformationLogger |
infoLogger |
private CheckInitializerVisitor |
initChecker |
private net.ssehub.easy.reasoning.core.reasoner.IReasonerInterceptor |
interceptor |
private boolean |
inTopLevelEvals |
private boolean |
isRunning |
private static net.ssehub.easy.basics.logger.EASyLoggerFactory.EASyLogger |
LOGGER |
private static int |
MODE_COMPOUND_ANYWAY |
private static int |
MODE_COMPOUND_NONE |
private static int |
MODE_COMPOUND_REGISTER |
private static int |
MODE_COMPOUND_TRANSLATE |
private net.ssehub.easy.reasoning.core.reasoner.ConstraintList |
otherConstraints |
private Resolver.OtherConstraintsProcessor |
otherConstraintsProc |
private net.ssehub.easy.varModel.model.Project |
project |
private java.util.List<net.ssehub.easy.varModel.model.Project> |
projects |
private Resolver.ConstraintTranslationVisitor |
projectVisitor |
private net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration |
reasonerConfig |
private int |
reevaluationCounter |
private RescheduleValueChangeVisitor |
rescheduler |
private boolean |
reuseInstance |
private ScopeAssignments |
scopeAssignments |
private VariablesInNotSimpleAssignmentConstraintsFinder |
simpleAssignmentFinder |
private SubstitutionVisitor |
substVisitor |
private net.ssehub.easy.reasoning.core.reasoner.ConstraintList |
topLevelConstraints |
private long |
translationTime |
private java.util.Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> |
usedVariables |
private int |
variablesCounter |
private VariablesInConstraintFinder |
variablesFinder |
private int |
variablesInConstraintsCounter |
private VariablesMap |
variablesMap |
private boolean |
wasStopped |
| Constructor and Description |
|---|
Resolver(net.ssehub.easy.varModel.confModel.Configuration config,
net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig)
Main constructor that activates Resolver constructor.
|
Resolver(net.ssehub.easy.varModel.model.Project project,
net.ssehub.easy.varModel.confModel.Configuration config,
net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig)
Main constructor that activates Resolver constructor.
|
Resolver(net.ssehub.easy.varModel.model.Project project,
net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig)
Main constructor that activates Resolver constructor with clean
Configuration. |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addAssignedVariableToScope(net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
Adds an assigned variable to the current scope.
|
private void |
addConstraint(net.ssehub.easy.reasoning.core.reasoner.ConstraintList target,
net.ssehub.easy.varModel.model.Constraint constraint,
boolean checkForInitializers,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
Adding a constraint to a constraint set, checking for contained container/compound initializers if
requested.
|
private void |
analyzeEvaluationResult(net.ssehub.easy.varModel.model.Constraint constraint)
Records information about the evaluation result, failed evaluation messages.
|
(package private) void |
clear()
Clears this instance for reuse to free most of the resources.
|
private void |
conflictingDefault(net.ssehub.easy.varModel.model.AbstractVariable decl)
Will be called after a failure was detected in a default constraint of an
AbstractVariable. |
(package private) int |
constraintCount()
Method for returning the overall count of evaluated constraints in the model.
|
(package private) boolean |
contextContainsMapping(net.ssehub.easy.varModel.model.AbstractVariable var)
Returns whether the current context contains a mapping for
var. |
(package private) void |
contextRegisterMapping(net.ssehub.easy.varModel.model.AbstractVariable var,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree acc)
Registers a mapping between the variable
var and its actual access expression acc into
the current top-most context. |
private net.ssehub.easy.varModel.confModel.Configuration |
createCleanConfiguration(net.ssehub.easy.varModel.model.Project project)
Method for creating a clean
Configuration. |
(package private) net.ssehub.easy.varModel.model.Constraint |
createConstraintVariableConstraint(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst,
net.ssehub.easy.varModel.model.AbstractVariable self,
boolean checkForInitializers,
net.ssehub.easy.varModel.model.IModelElement parent,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
Creates a constraint for a (nested) constraint variable adding the result to
otherConstraints. |
(package private) net.ssehub.easy.varModel.model.Constraint |
createConstraintVariableConstraint(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self,
net.ssehub.easy.varModel.model.IModelElement parent,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
Creates a constraint for a (nested) constraint variable adding the result to
#constraintVariablesConstraints. |
(package private) void |
createContainerConstraintValueConstraints(net.ssehub.easy.varModel.model.values.ContainerValue val,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self,
net.ssehub.easy.varModel.model.IModelElement parent,
net.ssehub.easy.varModel.confModel.IDecisionVariable nestedVariable)
Checks a container value for nested constraint values, i.e., values of nested constraint variables.
|
protected net.ssehub.easy.varModel.cstEvaluation.EvaluationVisitor |
createEvaluationVisitor()
Factory method for creating the evaluation visitor.
|
private void |
evaluateConstraintBase(long start,
net.ssehub.easy.varModel.model.Project project)
Evaluates all constraints in the constraint base.
|
private void |
evaluateConstraints(net.ssehub.easy.varModel.model.Project project)
Evaluates and reschedules failed constraints.
|
(package private) net.ssehub.easy.varModel.confModel.IDecisionVariable |
getConstraintVariable(net.ssehub.easy.varModel.model.Constraint constraint)
Returns the variable currently assigned to
constraint. |
(package private) long |
getEvaluationTime()
Returns the time used for evaluation.
|
private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree |
getFailedConstraintPart()
Method for checking part of a failed constraints against null.
|
(package private) FailedElements |
getFailedElements()
|
(package private) long |
getTranslationTime()
Returns the time used for translation.
|
(package private) boolean |
hasTimeout()
Returns whether reasoning stopped due to a timeout.
|
(package private) boolean |
isRunning()
Returns whether the reasoner is (still) operating.
|
void |
localVariableCreated(net.ssehub.easy.varModel.cstEvaluation.LocalDecisionVariable var) |
void |
localVariableDisposed(net.ssehub.easy.varModel.cstEvaluation.LocalDecisionVariable var) |
(package private) void |
markForReuse()
Marks this instance for re-use.
|
(package private) void |
moveOtherConstraintsToConstraintBase(net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
Moves (temporary) constraints in
otherConstraints as created by constraint translation to the constraint
base. |
void |
notifyResolved(net.ssehub.easy.varModel.model.AbstractVariable declaration,
net.ssehub.easy.varModel.confModel.IDecisionVariable resolved) |
void |
notifyResolved(net.ssehub.easy.varModel.confModel.IDecisionVariable compound,
java.lang.String slotName,
net.ssehub.easy.varModel.confModel.IDecisionVariable resolved) |
(package private) java.util.List<net.ssehub.easy.varModel.model.Constraint> |
obtainConstraints(net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
boolean clear,
java.util.Set<net.ssehub.easy.varModel.model.datatypes.Compound> deleteFilter)
Obtains and if specified clears old constraints in the internal reasoner data structures.
|
private void |
processCompoundEvals(net.ssehub.easy.varModel.model.datatypes.Compound cmpType,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self)
Method for extracting constraints from compounds eval blocks (also refined compounds).
|
private void |
processEvalConstraints(net.ssehub.easy.varModel.model.PartialEvaluationBlock evalBlock,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self)
Method for handling eval blocks - searching for nested eval blocks and extracting constraints.
|
(package private) int |
reevaluationCount()
Method for returning the overall number of reevaluations in the model.
|
private void |
registerCompoundMapping(net.ssehub.easy.varModel.model.datatypes.Compound type,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc,
net.ssehub.easy.varModel.confModel.IDecisionVariable var,
net.ssehub.easy.varModel.cst.Variable declVar,
net.ssehub.easy.varModel.model.datatypes.IDatatype target)
Registers the mapping for a compound type.
|
private void |
registerConstraint(net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.model.Constraint constraint)
Registers a
variable and associated constraint. |
(package private) void |
reInit()
Re-initializes this resolver instance to allocated resources only if really needed.
|
(package private) void |
reschedule(net.ssehub.easy.varModel.model.AbstractVariable declaration)
Tries rescheduling the given constraints.
|
void |
resolve()
Resolves the (initial) values of the configuration.
|
(package private) void |
setAssignmentState(net.ssehub.easy.varModel.confModel.IAssignmentState state)
Sets the desired assignment state.
|
(package private) boolean |
setIncremental(boolean incremental)
Sets whether reasoning shall happen incrementally.
|
(package private) void |
setInterceptor(net.ssehub.easy.reasoning.core.reasoner.IReasonerInterceptor interceptor)
Defines the optional interceptor instance.
|
(package private) boolean |
stop()
Stops/terminates reasoning.
|
(package private) net.ssehub.easy.varModel.cst.ConstraintSyntaxTree |
substituteVariables(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self)
Method for using
SubstitutionVisitor for constraint transformation. |
private void |
translateAnnotationAssignment(net.ssehub.easy.varModel.model.AttributeAssignment.Assignment assignment,
net.ssehub.easy.varModel.model.DecisionVariableDeclaration element,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree compound)
Method for creating attribute constraint for a specific element.
|
private void |
translateAnnotationAssignments(net.ssehub.easy.varModel.model.AttributeAssignment assignment,
net.ssehub.easy.varModel.confModel.IDecisionVariable var,
java.util.List<net.ssehub.easy.varModel.model.AttributeAssignment.Assignment> effectiveAssignments,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree compound)
Translates attribute assignments.
|
private void |
translateAnnotationDeclaration(net.ssehub.easy.varModel.model.Attribute decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
Translates an annotation declaration.
|
private void |
translateAnnotationDeclarations(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
Translates annotation declarations.
|
private void |
translateCompoundContainer(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.model.datatypes.Compound type,
net.ssehub.easy.varModel.model.datatypes.IDatatype declaredContainedType,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
Translates an entire compound container
decl including defaults and constraints for the specific
type cmpType (iterate through all relevant types). |
private void |
translateCompoundContent(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.model.datatypes.Compound type,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
Translates the compound content.
|
private int |
translateCompoundDeclaration(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc,
net.ssehub.easy.varModel.model.datatypes.Compound type,
int mode)
Translates translating compound type declarations, but only if not
ContextStack.alreadyProcessed(IDatatype) in nested collection/compound types. |
private void |
translateConstraints(net.ssehub.easy.varModel.model.Project project)
Translates and collects all constraints in
project by adding the collected constraints to the
constraintBase. |
private void |
translateContainerDeclaration(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable var,
net.ssehub.easy.varModel.model.datatypes.IDatatype type,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
Translates the (transitive) defaults and type constraints for a container declaration.
|
private void |
translateDeclaration(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable var,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
Translates the (transitive) defaults and type constraints for a declaration.
|
private void |
translateDerivedDatatypeConstraints(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.model.datatypes.IDatatype type,
net.ssehub.easy.varModel.model.DecisionVariableDeclaration localDecl,
net.ssehub.easy.varModel.model.IModelElement parent,
int refCounter)
Extracts, translates and collects the internal constraints of
type (if derived or, transitively, a
reference datatype) and stores the constraints in #derivedTypeConstraints. |
(package private) void |
translateValueTypeChange(net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.model.values.Value newValue,
net.ssehub.easy.varModel.model.values.Value oldValue)
Translates/reschedules a change of value types for compound values.
|
(package private) int |
variableCount()
Method for returning the overall number of variables in the model.
|
(package private) int |
variableInConstraintCount()
Method for returning the number of variables involved in constraints.
|
(package private) boolean |
wasStopped()
Returns whether reasoning was stopped due to a user-request.
|
private static final net.ssehub.easy.basics.logger.EASyLoggerFactory.EASyLogger LOGGER
private static final int MODE_COMPOUND_ANYWAY
private static final int MODE_COMPOUND_REGISTER
private static final int MODE_COMPOUND_TRANSLATE
private static final int MODE_COMPOUND_NONE
private net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration.IAdditionalInformationLogger infoLogger
private net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig
private net.ssehub.easy.varModel.confModel.Configuration config
private boolean incremental
private boolean reuseInstance
private net.ssehub.easy.varModel.confModel.IAssignmentState assignmentState
private net.ssehub.easy.reasoning.core.reasoner.IReasonerInterceptor interceptor
private EvalVisitor evaluator
private FailedElements failedElements
private ScopeAssignments scopeAssignments
private VariablesMap variablesMap
private Resolver.ReasonerState copiedState
private net.ssehub.easy.reasoning.core.reasoner.ConstraintBase constraintBase
private net.ssehub.easy.reasoning.core.reasoner.ConstraintList defaultConstraints
private net.ssehub.easy.reasoning.core.reasoner.ConstraintList deferredDefaultConstraints
private net.ssehub.easy.reasoning.core.reasoner.ConstraintList topLevelConstraints
private net.ssehub.easy.reasoning.core.reasoner.ConstraintList otherConstraints
private java.util.List<net.ssehub.easy.varModel.model.Project> projects
private int constraintCounter
private int variablesInConstraintsCounter
private int reevaluationCounter
private int variablesCounter
private boolean hasTimeout
private boolean isRunning
private boolean wasStopped
private long translationTime
private long evaluationTime
private net.ssehub.easy.varModel.model.Project project
private transient java.util.Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> usedVariables
private transient SubstitutionVisitor substVisitor
private transient ContextStack contexts
private transient VariablesInNotSimpleAssignmentConstraintsFinder simpleAssignmentFinder
private transient Resolver.ConstraintTranslationVisitor projectVisitor
private transient VariablesInConstraintFinder variablesFinder
private transient Resolver.OtherConstraintsProcessor otherConstraintsProc
private transient Resolver.CompoundAnnotationMapper annotationMapper
private transient RescheduleValueChangeVisitor rescheduler
private transient CheckInitializerVisitor initChecker
private transient long endTimestamp
private transient boolean inTopLevelEvals
public Resolver(net.ssehub.easy.varModel.model.Project project,
net.ssehub.easy.varModel.confModel.Configuration config,
net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig)
project - Project for evaluation.config - Configuration to reason on.reasonerConfig - the reasoner configuration to be used for reasoning (e.g. taken from the UI,
may be null)public Resolver(net.ssehub.easy.varModel.model.Project project,
net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig)
Configuration.project - Project for evaluation.reasonerConfig - the reasoner configuration to be used for reasoning (e.g. taken from the UI,
may be null)public Resolver(net.ssehub.easy.varModel.confModel.Configuration config,
net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig)
config - Configuration to reason on.reasonerConfig - the reasoner configuration to be used for reasoning (e.g. taken from the UI,
may be null)public void localVariableCreated(net.ssehub.easy.varModel.cstEvaluation.LocalDecisionVariable var)
localVariableCreated in interface net.ssehub.easy.varModel.cstEvaluation.IResolutionListenerpublic void localVariableDisposed(net.ssehub.easy.varModel.cstEvaluation.LocalDecisionVariable var)
localVariableDisposed in interface net.ssehub.easy.varModel.cstEvaluation.IResolutionListenervoid translateValueTypeChange(net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.model.values.Value newValue,
net.ssehub.easy.varModel.model.values.Value oldValue)
oldValue != newValue and both, oldValue and newValue are not null.variable - the variablenewValue - the new value (in variableoldValue - the old valuejava.util.List<net.ssehub.easy.varModel.model.Constraint> obtainConstraints(net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
boolean clear,
java.util.Set<net.ssehub.easy.varModel.model.datatypes.Compound> deleteFilter)
variable - the variable to return the constraints forclear - true for clear variables, false for leave them as they aredeleteFilter - compound types dictating those constraints having them as attached object
that shall be deleted while others shall be left untouched (may be null for delete
all constraints if clear is true.variable, may be nullvoid moveOtherConstraintsToConstraintBase(net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
otherConstraints as created by constraint translation to the constraint
base. Relates constraints with #variable.variable - the variable to relate constraints to (may be null, ignored then)void reschedule(net.ssehub.easy.varModel.model.AbstractVariable declaration)
declaration - the variable declaration to reschedulepublic void notifyResolved(net.ssehub.easy.varModel.confModel.IDecisionVariable compound,
java.lang.String slotName,
net.ssehub.easy.varModel.confModel.IDecisionVariable resolved)
notifyResolved in interface net.ssehub.easy.varModel.cstEvaluation.IResolutionListenerpublic void notifyResolved(net.ssehub.easy.varModel.model.AbstractVariable declaration,
net.ssehub.easy.varModel.confModel.IDecisionVariable resolved)
notifyResolved in interface net.ssehub.easy.varModel.cstEvaluation.IResolutionListenerpublic void resolve()
Utils.discoverImports(net.ssehub.easy.basics.modelManagement.IModel),
translateConstraints(Project),
evaluateConstraintBase(long, Project),
Configuration.freeze(net.ssehub.easy.varModel.confModel.IFreezeSelector)private void evaluateConstraintBase(long start,
net.ssehub.easy.varModel.model.Project project)
start - the start point in time for reasoning statisticsproject - the project to evaluateevaluateConstraints(Project)private void evaluateConstraints(net.ssehub.easy.varModel.model.Project project)
project - the project to evaluate the constraints forresolve()private void translateDerivedDatatypeConstraints(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.model.datatypes.IDatatype type,
net.ssehub.easy.varModel.model.DecisionVariableDeclaration localDecl,
net.ssehub.easy.varModel.model.IModelElement parent,
int refCounter)
type (if derived or, transitively, a
reference datatype) and stores the constraints in #derivedTypeConstraints.decl - VariableDeclaration of DerivedDatatypetype - the type to translatelocalDecl - the declaration of an iterator variable if quantified constraints shall be created,
null for normal constraintsparent - the parent model element for creating constraint instancesrefCounter - the number of intermediary reference types on the path from the top-most call (call with
0)private void translateAnnotationDeclarations(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
decl - AbstractVariable with annotations.variable - IDecisionVariable with annotations.cAcc - CompoundAccess null if variable is not nested, else accessor expression to
variable.private void translateAnnotationDeclaration(net.ssehub.easy.varModel.model.Attribute decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
decl - AbstractVariable with annotations.variable - IDecisionVariable with annotations.cAcc - CompoundAccess null if variable is not nested, else accessor expression to
variable.private void translateDeclaration(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable var,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
decl - The AbstractVariable for which the default value should be resolved.var - the instance of decl (may be null for type-based translation).cAcc - if variable is a nested compound.private void translateContainerDeclaration(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable var,
net.ssehub.easy.varModel.model.datatypes.IDatatype type,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
decl - The AbstractVariable for which the default value should be resolved.var - the instance of decl (may be null for type-based translation).type - the (specific) datatype (Container)cAcc - compound access expressionprivate void translateCompoundContainer(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.model.datatypes.Compound type,
net.ssehub.easy.varModel.model.datatypes.IDatatype declaredContainedType,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
decl including defaults and constraints for the specific
type cmpType (iterate through all relevant types).decl - the declarationtype - the compound type to translate fordeclaredContainedType - the declared contained type of declcAcc - compound access to decl if needed (may be null)private int translateCompoundDeclaration(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc,
net.ssehub.easy.varModel.model.datatypes.Compound type,
int mode)
ContextStack.alreadyProcessed(IDatatype) in nested collection/compound types.decl - The AbstractVariable for which the default value should be resolved.variable - the instance of decl (may be null for based-type translation).cAcc - if variable is a nested compound, the access expression to
decl/variabletype - specific Compound type.mode - the processing mode, either MODE_COMPOUND_ANYWAY for processing the full compound,
MODE_COMPOUND_REGISTER for just registering the compound slot accessor expressions, which
must either be followed with MODE_COMPOUND_TRANSLATE or ContextStack.popContext() on
the same nesting level. Not processing a complete compound allows keeping the registered scope open
for processing related (default) value expressions that may refer to compound slots. May also
be MODE_COMPOUND_NONE for not processing anything.MODE_COMPOUND_NONE or MODE_COMPOUND_TRANSLATE if mode was
MODE_COMPOUND_REGISTERprivate void registerCompoundMapping(net.ssehub.easy.varModel.model.datatypes.Compound type,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc,
net.ssehub.easy.varModel.confModel.IDecisionVariable var,
net.ssehub.easy.varModel.cst.Variable declVar,
net.ssehub.easy.varModel.model.datatypes.IDatatype target)
type - the compound typecAcc - the accessor expression (may be null)var - the variable we are processing for (may be null for type translations)declVar - the compound variable as expressiontarget - the specific target type to cast to (may be null or type for no cast)private void translateCompoundContent(net.ssehub.easy.varModel.model.AbstractVariable decl,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.model.datatypes.Compound type,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cAcc)
decl - the compound variable (self, instead of cAcc)variable - the decision variable holding decl, may be null - ignored thentype - the (specific) compound typecAcc - the compound access expressionprivate void processCompoundEvals(net.ssehub.easy.varModel.model.datatypes.Compound cmpType,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self)
cmpType - Compound to be analyzedselfEx - an expression representing self (ignored if null, self and
selfEx shall never both be specified/not null).self - an variable declaration representing self (ignored if null).private void processEvalConstraints(net.ssehub.easy.varModel.model.PartialEvaluationBlock evalBlock,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self)
evalBlock - Eval block to be processed.selfEx - an expression representing self (ignored if null, self and
selfEx shall never both be specified/not null).self - an variable declaration representing self (ignored if null).void createContainerConstraintValueConstraints(net.ssehub.easy.varModel.model.values.ContainerValue val,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self,
net.ssehub.easy.varModel.model.IModelElement parent,
net.ssehub.easy.varModel.confModel.IDecisionVariable nestedVariable)
val - the container valueselfEx - expression representing self, must never be not null in conjunction with selfself - the variable declaration representing self, must never be not null in conjunction
with selfparent - the parent for new constraintsnestedVariable - the variable holding the constraint valueprivate void translateAnnotationAssignments(net.ssehub.easy.varModel.model.AttributeAssignment assignment,
net.ssehub.easy.varModel.confModel.IDecisionVariable var,
java.util.List<net.ssehub.easy.varModel.model.AttributeAssignment.Assignment> effectiveAssignments,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree compound)
assignment - Attribute assignments on top-level.var - variable holding the assignment, may be null for translating typeseffectiveAssignments - the list of effective current assignments, use null if not recursive.compound - Parent CompoundAccess.private void translateAnnotationAssignment(net.ssehub.easy.varModel.model.AttributeAssignment.Assignment assignment,
net.ssehub.easy.varModel.model.DecisionVariableDeclaration element,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree compound)
assignment - Attribute assignment constraint.element - Elements to which the attribute is assigned.compound - Nesting compound if there is one, may be null for none.private void translateConstraints(net.ssehub.easy.varModel.model.Project project)
project by adding the collected constraints to the
constraintBase.project - the project to translate the constraints forresolve()private void addConstraint(net.ssehub.easy.reasoning.core.reasoner.ConstraintList target,
net.ssehub.easy.varModel.model.Constraint constraint,
boolean checkForInitializers,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
target - the target container for assignment constraints (higher priority)constraint - the constraintcheckForInitializers - check also for initializers if (true), add only if (false)variable - the actually (nested) variable, used to relate the created constraint to, may be null.
This information is particularly relevant for constraints arising from constraint variables.net.ssehub.easy.varModel.model.Constraint createConstraintVariableConstraint(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self,
net.ssehub.easy.varModel.model.IModelElement parent,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
#constraintVariablesConstraints. Performs initializers check upon adding if cst is not
a ConstantValue.cst - the constraintselfEx - the expression representing self in cst, both, self and
selfEx must not be different from null at the same time (may be null for none)self - the declaration of the variable representing self in cst (may be null
for none)parent - the parent for new constraintsvariable - the actually (nested) variable, used to relate the created constraint to, may be nullcreateConstraintVariableConstraint(ConstraintSyntaxTree, AbstractVariable, boolean, IModelElement,
IDecisionVariable)net.ssehub.easy.varModel.model.Constraint createConstraintVariableConstraint(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst,
net.ssehub.easy.varModel.model.AbstractVariable self,
boolean checkForInitializers,
net.ssehub.easy.varModel.model.IModelElement parent,
net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
otherConstraints. Registers the constraint if needed.cst - the constraintself - the declaration of the variable representing self in cst (may be null
for none), just used for loggingcheckForInitializers - whether initializers shall be checked (recursively) when adding aconstraintparent - the parent for new constraintsvariable - the actually (nested) variable, used to relate the created constraint to, may be nulladdConstraint(ConstraintList, Constraint, boolean, IDecisionVariable),
registerConstraint(IDecisionVariable, Constraint)private void registerConstraint(net.ssehub.easy.varModel.confModel.IDecisionVariable variable,
net.ssehub.easy.varModel.model.Constraint constraint)
variable and associated constraint.variable - the variable (may be null, call is ignored then)constraint - the constraint#register(IDecisionVariable, Constraint, Map, Map)private void analyzeEvaluationResult(net.ssehub.easy.varModel.model.Constraint constraint)
constraint - the constraint to record the actual messages fornet.ssehub.easy.varModel.cst.ConstraintSyntaxTree substituteVariables(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx,
net.ssehub.easy.varModel.model.AbstractVariable self)
SubstitutionVisitor for constraint transformation. Uses the actual
variable mapping in #varMap and may consider a mapping for self.cst - Constraint to be transformed.selfEx - an expression representing self (ignored if null, self and
selfEx shall never both be specified/not null).self - an variable declaration representing self (ignored if null).private void conflictingDefault(net.ssehub.easy.varModel.model.AbstractVariable decl)
AbstractVariable.decl - The conflicting declaration of an AbstractVariable.
Call AbstractVariable.getDefaultValue() to retrieve the conflicting constraint.private net.ssehub.easy.varModel.confModel.Configuration createCleanConfiguration(net.ssehub.easy.varModel.model.Project project)
Configuration.project - Project for ConfigurationConfigurationprivate net.ssehub.easy.varModel.cst.ConstraintSyntaxTree getFailedConstraintPart()
net.ssehub.easy.varModel.confModel.IDecisionVariable getConstraintVariable(net.ssehub.easy.varModel.model.Constraint constraint)
constraint.constraint - the constraint to look forint constraintCount()
int variableCount()
int variableInConstraintCount()
int reevaluationCount()
FailedElements getFailedElements()
FailedElementsboolean setIncremental(boolean incremental)
incremental - if reasoning shall happen incrementallyincremental#setConsiderFrozenConstraints(boolean)protected net.ssehub.easy.varModel.cstEvaluation.EvaluationVisitor createEvaluationVisitor()
boolean hasTimeout()
true for timeout, false elseboolean wasStopped()
true for stopped, false elseboolean isRunning()
true for operating, false elseboolean stop()
true if the reasoner tries to stop, false else
(operation not implemented)void markForReuse()
resolve().
Works intentionally only once.void clear()
markForReuse(),
reInit()void reInit()
markForReuse(),
reInit()long getEvaluationTime()
long getTranslationTime()
void setAssignmentState(net.ssehub.easy.varModel.confModel.IAssignmentState state)
AssignmentState.DERIVED, but specific reasoning
operations such as configuration initialization may require a different state.state - the state to usevoid setInterceptor(net.ssehub.easy.reasoning.core.reasoner.IReasonerInterceptor interceptor)
interceptor - the interceptorfinal void addAssignedVariableToScope(net.ssehub.easy.varModel.confModel.IDecisionVariable variable)
variable - the variable to add to the scopefinal boolean contextContainsMapping(net.ssehub.easy.varModel.model.AbstractVariable var)
var.var - the variable to look fortrue if there is a mapping, false elsefinal void contextRegisterMapping(net.ssehub.easy.varModel.model.AbstractVariable var,
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree acc)
var and its actual access expression acc into
the current top-most context. Overrides any existing mapping in the top-most context. Preceeds any
existing mapping in a previous still active context.var - the variableacc - the access expressionCopyright © 2009 - 2018 SSE. All Rights Reserved.