Class Reasoner.ReasonerInstance
- java.lang.Object
-
- net.ssehub.easy.reasoning.sseReasoner.Reasoner.ReasonerInstance
-
- All Implemented Interfaces:
IReasonerInstance
- Enclosing class:
- Reasoner
private class Reasoner.ReasonerInstance extends java.lang.Object implements IReasonerInstance
A reusable reasoner instance.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private Configurationcfgprivate Engineengineprivate IReasonerInterceptorinterceptorprivate ReasonerConfigurationreasonerConfiguration
-
Constructor Summary
Constructors Modifier Constructor Description privateReasonerInstance(Configuration cfg, ReasonerConfiguration reasonerConfiguration, IReasonerInterceptor interceptor)Creates a reusable reasoner instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReasoningResultcheck(ProgressObserver observer)Checks the configuration according to the given project structure and does not affect the configuration.ValueCreationResultcreateValue(AbstractVariable var, IDatatype type, ProgressObserver observer)Creates the value for a certain IVML type/variable.EvaluationResultevaluate(java.util.List<Constraint> constraints, ProgressObserver observer)Evaluates a given list of constraints (in the sense of boolean conditions) which are related to and valid in the context of the given project and configuration.ReasonerDescriptorgetDescriptor()Returns a descriptor stating common information about this reasoner.ProjectgetProject()Returns the project this instance is attached to.ReasonerConfigurationgetReasonerConfiguration()Returns the reasoner configuration this project is running with.ReasoningResultisConsistent(ProgressObserver observer)Checks whether a given variability model (project) is satisfiable.booleanisRunning()Returns whether the reasoner is (still) operating.voidnotify(IReasonerMessage message)Is called when a reasoner message is issued.ReasoningResultpropagate(ProgressObserver observer)Checks the configuration according to the given model and propagates values, if possible.booleanstop()Stops/terminates reasoning.
-
-
-
Field Detail
-
engine
private Engine engine
-
cfg
private Configuration cfg
-
reasonerConfiguration
private ReasonerConfiguration reasonerConfiguration
-
interceptor
private IReasonerInterceptor interceptor
-
-
Constructor Detail
-
ReasonerInstance
private ReasonerInstance(Configuration cfg, ReasonerConfiguration reasonerConfiguration, IReasonerInterceptor interceptor)
Creates a reusable reasoner instance.- Parameters:
cfg- the configuration as a basis for the evaluationreasonerConfiguration- the reasoner configuration to be used for reasoning (e.g. taken from the UI, may be null)interceptor- the optional reasoner interceptor (may be null)
-
-
Method Detail
-
getDescriptor
public ReasonerDescriptor getDescriptor()
Description copied from interface:IReasonerInstanceReturns a descriptor stating common information about this reasoner.- Specified by:
getDescriptorin interfaceIReasonerInstance- Returns:
- the descriptor
-
isConsistent
public ReasoningResult isConsistent(ProgressObserver observer)
Description copied from interface:IReasonerInstanceChecks whether a given variability model (project) is satisfiable.- Specified by:
isConsistentin interfaceIReasonerInstance- Parameters:
observer- an optional progress observer, shall beProgressObserver.NO_OBSERVERif unused- Returns:
- The result of this reasoning step. Can have the status
Status.UNSUPPORTEDif the concrete reasoner does not support this operation.
-
check
public ReasoningResult check(ProgressObserver observer)
Description copied from interface:IReasonerInstanceChecks the configuration according to the given project structure and does not affect the configuration.- Specified by:
checkin interfaceIReasonerInstance- Parameters:
observer- an optional progress observer, shall beProgressObserver.NO_OBSERVERif unused- Returns:
- The result of this reasoning step. Can have the status
Status.UNSUPPORTEDif the concrete reasoner does not support this operation.
-
propagate
public ReasoningResult propagate(ProgressObserver observer)
Description copied from interface:IReasonerInstanceChecks the configuration according to the given model and propagates values, if possible.- Specified by:
propagatein interfaceIReasonerInstance- Parameters:
observer- an optional progress observer, shall beProgressObserver.NO_OBSERVERif unused- Returns:
- The result of this reasoning step. Can have the status
Status.UNSUPPORTEDif the concrete reasoner does not support this operation.
-
evaluate
public EvaluationResult evaluate(java.util.List<Constraint> constraints, ProgressObserver observer)
Description copied from interface:IReasonerInstanceEvaluates a given list of constraints (in the sense of boolean conditions) which are related to and valid in the context of the given project and configuration.- Specified by:
evaluatein interfaceIReasonerInstance- Parameters:
constraints- the constraints (expressions which evaluate to a boolean value)observer- an optional progress observer, shall beProgressObserver.NO_OBSERVERif unused- Returns:
- The result of this reasoning step. Can have the status
Status.UNSUPPORTEDif the concrete reasoner does not support this operation.
-
createValue
public ValueCreationResult createValue(AbstractVariable var, IDatatype type, ProgressObserver observer)
Description copied from interface:IReasonerInstanceCreates the value for a certain IVML type/variable.- Specified by:
createValuein interfaceIReasonerInstance- Parameters:
var- the variable to create the value for (may be null iftypeis given, may imply additional constraints)type- the type to create the value for (may be null ifvaris given)observer- an optional progress observer, shall beProgressObserver.NO_OBSERVERif unused- Returns:
- the value creation result
-
notify
public void notify(IReasonerMessage message)
Description copied from interface:IReasonerInstanceIs called when a reasoner message is issued.- Specified by:
notifyin interfaceIReasonerInstance- Parameters:
message- the message sent
-
isRunning
public boolean isRunning()
Description copied from interface:IReasonerInstanceReturns whether the reasoner is (still) operating.- Specified by:
isRunningin interfaceIReasonerInstance- Returns:
truefor operating,falseelse
-
stop
public boolean stop()
Description copied from interface:IReasonerInstanceStops/terminates reasoning. If possible, a reasoner shall stop the reasoning operations as quick as possible. A reasoner must not implement this operation.- Specified by:
stopin interfaceIReasonerInstance- Returns:
trueif the reasoner tries to stop,falseelse (operation not implemented)- See Also:
ReasoningResult.setStopped(boolean)
-
getProject
public Project getProject()
Description copied from interface:IReasonerInstanceReturns the project this instance is attached to.- Specified by:
getProjectin interfaceIReasonerInstance- Returns:
- the project
-
getReasonerConfiguration
public ReasonerConfiguration getReasonerConfiguration()
Description copied from interface:IReasonerInstanceReturns the reasoner configuration this project is running with.- Specified by:
getReasonerConfigurationin interfaceIReasonerInstance- Returns:
- the reasoner configuration
-
-