Class Reasoner
- java.lang.Object
-
- net.ssehub.easy.reasoning.sseReasoner.Reasoner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classReasoner.ReasonerInstanceA reusable reasoner instance.
-
Field Summary
Fields Modifier and Type Field Description private static DescriptorDESCRIPTORprivate IReasonerInterceptorinterceptorprivate static EASyLoggerFactory.EASyLoggerLOGGER
-
Constructor Summary
Constructors Constructor Description Reasoner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate(org.osgi.service.component.ComponentContext context)Private method to activate plugin.ReasoningResultcheck(Configuration cfg, ReasonerConfiguration reasonerConfig, ProgressObserver observer)Checks the configuration according to the given project structure and does not affect the configuration.private ConfigurationcreateConfiguration(Project project, Configuration cfg, ReasonerConfiguration rConfig, boolean freshConfig)Method for creating a cleanConfigurationif required.IReasonerInstancecreateInstance(Configuration cfg, ReasonerConfiguration reasonerConfiguration)Creates a reasoner instance for repeated reasoning on the same model (no structural changes allowed during two subsequent reasoning runs).ValueCreationResultcreateValue(Configuration cfg, AbstractVariable var, IDatatype type, ReasonerConfiguration reasonerConfiguration, ProgressObserver observer)Creates the value for a certain IVML type/variable.protected voiddeactivate(org.osgi.service.component.ComponentContext context)Private method to to de-activate plugin.EvaluationResultevaluate(Configuration cfg, java.util.List<Constraint> constraints, ReasonerConfiguration reasonerConfig, 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.ReasoningResultinitialize(Configuration cfg, ReasonerConfiguration reasonerConfig, ProgressObserver observer)Initializes the configuration according to the given model and propagates values, if possible.ReasoningResultisConsistent(Project project, ReasonerConfiguration reasonerConfig, ProgressObserver observer)Checks whether a given variability model (project) is satisfiable.voidnotify(IReasonerMessage message)Is called when a reasoner message is issued.ReasoningResultpropagate(Configuration cfg, ReasonerConfiguration reasonerConfig, ProgressObserver observer)Checks the configuration according to the given model and propagates values, if possible.voidsetInterceptor(IReasonerInterceptor interceptor)Defines the optional interceptor instance.ReasoningResultupgrade(java.net.URI url, ProgressObserver observer)Updates the installation of this reasoner, e.g., in order to obtain a licensed reasoner version.
-
-
-
Field Detail
-
LOGGER
private static final EASyLoggerFactory.EASyLogger LOGGER
-
DESCRIPTOR
private static final Descriptor DESCRIPTOR
-
interceptor
private IReasonerInterceptor interceptor
-
-
Method Detail
-
getDescriptor
public ReasonerDescriptor getDescriptor()
Description copied from interface:IReasonerReturns a descriptor stating common information about this reasoner.- Specified by:
getDescriptorin interfaceIReasoner- Returns:
- the descriptor
-
upgrade
public ReasoningResult upgrade(java.net.URI url, ProgressObserver observer)
Description copied from interface:IReasonerUpdates the installation of this reasoner, e.g., in order to obtain a licensed reasoner version.- Specified by:
upgradein interfaceIReasoner- Parameters:
url- The location of the implementation of the reasoner which should be upgradedobserver- an optional progress observer, shall beProgressObserver.NO_OBSERVERif unused- Returns:
- The result of this upgrade process.
-
isConsistent
public ReasoningResult isConsistent(Project project, ReasonerConfiguration reasonerConfig, ProgressObserver observer)
Description copied from interface:IReasonerChecks whether a given variability model (project) is satisfiable.- Specified by:
isConsistentin interfaceIReasoner- Parameters:
project- The project which should be tested whether it is satisfiable.reasonerConfig- the reasoner configuration to be used for reasoning (e.g. taken from the UI, may be null)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(Configuration cfg, ReasonerConfiguration reasonerConfig, ProgressObserver observer)
Description copied from interface:IReasonerChecks the configuration according to the given project structure and does not affect the configuration.- Specified by:
checkin interfaceIReasoner- Parameters:
cfg- The current configuration to reason on.reasonerConfig- the reasoner configuration to be used for reasoning (e.g. taken from the UI, may be null)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(Configuration cfg, ReasonerConfiguration reasonerConfig, ProgressObserver observer)
Description copied from interface:IReasonerChecks the configuration according to the given model and propagates values, if possible.- Specified by:
propagatein interfaceIReasoner- Parameters:
cfg- The configuration to reason on (may be modified as a side effect of value propagation)reasonerConfig- the reasoner configuration to be used for reasoning (e.g. taken from the UI, may be null)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.
-
initialize
public ReasoningResult initialize(Configuration cfg, ReasonerConfiguration reasonerConfig, ProgressObserver observer)
Description copied from interface:IReasonerInitializes the configuration according to the given model and propagates values, if possible. Reasoners implementing this function and ensure complete and proper (!) initialization of IVML models shall explicitly declareGeneralReasonerCapabilities.INCREMENTAL_REASONING. This method shell obeyConfiguration.getResolutionState().- Specified by:
initializein interfaceIReasoner- Parameters:
cfg- The configuration to reason on (may be modified as a side effect of value propagation)reasonerConfig- the reasoner configuration to be used for reasoning (e.g. taken from the UI, may be null)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(Configuration cfg, java.util.List<Constraint> constraints, ReasonerConfiguration reasonerConfig, ProgressObserver observer)
Description copied from interface:IReasonerEvaluates 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 interfaceIReasoner- Parameters:
cfg- the configuration as a basis for the evaluationconstraints- the constraints (expressions which evaluate to a boolean value)reasonerConfig- the reasoner configuration to be used for reasoning (e.g. taken from the UI, may be null)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.
-
activate
protected void activate(org.osgi.service.component.ComponentContext context)
Private method to activate plugin.- Parameters:
context- Context.
-
deactivate
protected void deactivate(org.osgi.service.component.ComponentContext context)
Private method to to de-activate plugin.- Parameters:
context- Context.
-
notify
public void notify(IReasonerMessage message)
Description copied from interface:IReasonerIs called when a reasoner message is issued.
-
createConfiguration
private Configuration createConfiguration(Project project, Configuration cfg, ReasonerConfiguration rConfig, boolean freshConfig)
Method for creating a cleanConfigurationif required.- Parameters:
project- Project forConfigurationcfg- the initial configurationrConfig- the reasoner configurationfreshConfig- use a fresh (new) configuration (true) instance or operate oncfg(false)- Returns:
- Created
Configuration
-
createInstance
public IReasonerInstance createInstance(Configuration cfg, ReasonerConfiguration reasonerConfiguration)
Description copied from interface:IReasonerCreates a reasoner instance for repeated reasoning on the same model (no structural changes allowed during two subsequent reasoning runs).- Specified by:
createInstancein interfaceIReasoner- 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)- Returns:
- a reusable reasoner instance, return a
DelegatingReasonerInstanceon this reasoner to avoid null pointer checking.
-
setInterceptor
public void setInterceptor(IReasonerInterceptor interceptor)
Description copied from interface:IReasonerDefines the optional interceptor instance.- Specified by:
setInterceptorin interfaceIReasoner- Parameters:
interceptor- the interceptor
-
createValue
public ValueCreationResult createValue(Configuration cfg, AbstractVariable var, IDatatype type, ReasonerConfiguration reasonerConfiguration, ProgressObserver observer)
Description copied from interface:IReasonerCreates the value for a certain IVML type/variable.- Specified by:
createValuein interfaceIReasoner- Parameters:
cfg- the configuration to operate on (will not be modified)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)reasonerConfiguration- the reasoner configuration to be used for reasoning (e.g. taken from the UI, may be null)observer- an optional progress observer, shall beProgressObserver.NO_OBSERVERif unused- Returns:
- the value creation result
-
-