public class ReasonerFrontend
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private class |
ReasonerFrontend.DefaultReasonerProvider
Implements the default reasoner provider.
|
| Modifier and Type | Field and Description |
|---|---|
private static ReasonerFrontend |
INSTANCE |
private static java.lang.String |
NO_REASONING_AVAILABE_MSG |
private IReasoner |
reasonerHint |
private ReasonerRegistry |
registry |
private int |
timeout |
| Modifier | Constructor and Description |
|---|---|
private |
ReasonerFrontend()
Singleton constructor for this class.
|
| Modifier and Type | Method and Description |
|---|---|
private static IReasoner |
canInitializeConfig(IReasoner reasoner)
Checks
reasoner for GeneralReasonerCapabilities.CONFIGURATION_INITIALIZATION. |
ReasoningResult |
check(net.ssehub.easy.varModel.confModel.Configuration cfg,
ReasonerConfiguration reasonerConfiguration,
net.ssehub.easy.basics.progress.ProgressObserver observer)
Checks the configuration according to the given project structure and does not affect the configuration.
|
private static IReasoner |
checkForCapabilitiy(IReasoner reasoner,
net.ssehub.easy.varModel.capabilities.IReasonerCapability capability)
Checks
reasoner for the given reasoner capability. |
IReasonerInstance |
createInstance(net.ssehub.easy.varModel.confModel.Configuration cfg,
ReasonerConfiguration reasonerConfiguration)
Creates a reasoner instance for repeated reasoning on the same model (no structural changes allowed
during two subsequent reasoning runs).
|
ValueCreationResult |
createValue(net.ssehub.easy.varModel.confModel.Configuration cfg,
net.ssehub.easy.varModel.model.AbstractVariable var,
net.ssehub.easy.varModel.model.datatypes.IDatatype type,
ReasonerConfiguration reasonerConfiguration,
net.ssehub.easy.basics.progress.ProgressObserver observer)
Creates the value for a certain IVML type/variable.
|
EvaluationResult |
evaluate(net.ssehub.easy.varModel.confModel.Configuration cfg,
java.util.List<net.ssehub.easy.varModel.model.Constraint> constraints,
ReasonerConfiguration reasonerConfiguration,
net.ssehub.easy.basics.progress.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.
|
(package private) IReasoner |
findReasoner(ReasonerDescriptor descriptor)
Finds a reasoner and throws related exceptions.
|
IReasoner |
findReasoner(java.lang.String name,
java.lang.String version)
Returns the first version with given
name and version. |
private IReasoner |
getActualReasoner(net.ssehub.easy.varModel.confModel.Configuration configuration,
java.util.List<net.ssehub.easy.varModel.model.Constraint> constraints,
ReasonerConfiguration reasonerConfiguration)
Returns the actual and matching reasoner.
|
static ReasonerFrontend |
getInstance()
Returns the singleton instance of this class.
|
ReasonerDescriptor |
getPreferredReasoner()
Returns the preferred reasoner descriptor due to internal knowledge about the reasoner implementation status.
|
int |
getReadyForUseCount()
Returns the number of reasoners which are ready for use.
|
ReasonerDescriptor |
getReasonerDescriptor(int index)
Returns the descriptor for a specific reasoner.
|
ReasonerDescriptor |
getReasonerHint()
Returns the current reasoner hint.
|
int |
getReasonersCount()
Returns the number of available reasoners.
|
IReasonerRegistry |
getRegistry()
Getter for the Reasoner registry, capable of handling multiple
IReasoners. |
int |
getTimeout()
Returns the global timeout for reasoning.
|
boolean |
hasReasonerCapability(net.ssehub.easy.varModel.capabilities.IReasonerCapability capability)
Return whether the current reasoner hint has a specific capability.
|
boolean |
hasReasonerCapability(net.ssehub.easy.varModel.capabilities.IReasonerCapability capability,
ReasonerConfiguration reasonerConfiguration)
Return whether the current reasoner hint has a specific capability.
|
private void |
installConfigurationInitializer()
Installs the configuration intializer.
|
boolean |
isChainingReasoner(ReasonerDescriptor descriptor)
Returns whether the reasoner registered for this
descriptor
is a chaining reasoner. |
ReasoningResult |
isConsistent(net.ssehub.easy.varModel.model.Project project,
ReasonerConfiguration reasonerConfiguration,
net.ssehub.easy.basics.progress.ProgressObserver observer)
Checks whether a given variability model (project) is satisfiable.
|
private static boolean |
isReadyForUse(IReasoner reasoner)
Returns whether the given
reasoner is ready for use. |
ReasoningResult |
propagate(net.ssehub.easy.varModel.confModel.Configuration cfg,
ReasonerConfiguration reasonerConfiguration,
net.ssehub.easy.basics.progress.ProgressObserver observer)
Checks the configuration according to the given model and propagates values, if possible.
|
boolean |
reasoningSupported()
Checks whether at least one reasoner is present.
|
void |
register(IMessageListener listener)
Registers a message listener.
|
ReasonerDescriptor |
setPreferredReasoner()
Sets the actually preferred reasoner as
hint. |
void |
setReasonerHint(ReasonerDescriptor descriptor)
Defines that the specified reasoner shall be used.
|
void |
setTimeout(int timeout)
Changes the global timeout for reasoning.
|
void |
unregister(IMessageListener listener)
Unregisters a message listener.
|
ReasoningResult |
upgradeReasoner(ReasonerDescriptor descriptor,
java.net.URI uri,
net.ssehub.easy.basics.progress.ProgressObserver observer)
Updates a reasoner installation, e.g., in order to obtain a licensed reasoner version.
|
private static final java.lang.String NO_REASONING_AVAILABE_MSG
private static final ReasonerFrontend INSTANCE
private ReasonerRegistry registry
private IReasoner reasonerHint
private int timeout
private ReasonerFrontend()
private void installConfigurationInitializer()
private static IReasoner canInitializeConfig(IReasoner reasoner)
reasoner for GeneralReasonerCapabilities.CONFIGURATION_INITIALIZATION.reasoner - the reasoner to checkreasoner if capability is provided, null elsecheckForCapabilitiy(IReasoner, IReasonerCapability)private static IReasoner checkForCapabilitiy(IReasoner reasoner, net.ssehub.easy.varModel.capabilities.IReasonerCapability capability)
reasoner for the given reasoner capability.reasoner - the reasoner to checkcapability - the capability to check forreasoner if capability is provided, null elsepublic static final ReasonerFrontend getInstance()
public IReasonerRegistry getRegistry()
IReasoners.IReasonerRegistry used by this frontend.private IReasoner getActualReasoner(net.ssehub.easy.varModel.confModel.Configuration configuration, java.util.List<net.ssehub.easy.varModel.model.Constraint> constraints, ReasonerConfiguration reasonerConfiguration)
ReasonerDescriptor.isReadyForUse().configuration - the configuration to reason on (may be null)constraints - the additional constraints to reason on (may be null)reasonerConfiguration - the configuration to be used for the specific reasoner call (may be null)private static boolean isReadyForUse(IReasoner reasoner)
reasoner is ready for use.reasoner - the reasoner to check fortrue if reasoner is ready for
use, false elseReasonerDescriptor.isReadyForUse()public ReasoningResult isConsistent(net.ssehub.easy.varModel.model.Project project, ReasonerConfiguration reasonerConfiguration, net.ssehub.easy.basics.progress.ProgressObserver observer)
project - The project which should be tested whether it is satisfiable.reasonerConfiguration - the reasoner configuration to be used for reasoning (e.g. taken from the UI,
may be null)observer - a progress observer indicating the progress, use ProgressObserver.NO_OBSERVER if no
progress shall be indicatedStatus.UNSUPPORTED if the concrete reasoner does not support
this operation.public ReasoningResult check(net.ssehub.easy.varModel.confModel.Configuration cfg, ReasonerConfiguration reasonerConfiguration, net.ssehub.easy.basics.progress.ProgressObserver observer)
cfg - The current configuration based on the given project.reasonerConfiguration - the reasoner configuration to be used for reasoning (e.g. taken from the UI,
may be null)observer - a progress observer indicating the progress, use ProgressObserver.NO_OBSERVER if no
progress shall be indicatedStatus.UNSUPPORTED if the concrete reasoner does not support
this operation.#check(Project, Configuration, ReasonerConfiguration, ProgressObserver)public ReasoningResult propagate(net.ssehub.easy.varModel.confModel.Configuration cfg, ReasonerConfiguration reasonerConfiguration, net.ssehub.easy.basics.progress.ProgressObserver observer)
cfg - The current configuration based on the given project. (may be modified as a side effect
of value propagation)observer - a progress observer indicating the progress, use ProgressObserver.NO_OBSERVER if no
progress shall be indicatedreasonerConfiguration - the reasoner configuration to be used for reasoning (e.g. taken from the UI,
may be null)Status.UNSUPPORTED if the concrete reasoner does not support
this operation.#propagate(Project, Configuration, ReasonerConfiguration, ProgressObserver)public EvaluationResult evaluate(net.ssehub.easy.varModel.confModel.Configuration cfg, java.util.List<net.ssehub.easy.varModel.model.Constraint> constraints, ReasonerConfiguration reasonerConfiguration, net.ssehub.easy.basics.progress.ProgressObserver observer)
cfg - the configuration as a basis for the evaluationconstraints - the constraints (expressions which must evaluate to true)reasonerConfiguration - the reasoner configuration to be used for reasoning (e.g. taken from the UI,
may be null)observer - a progress observer indicating the progress, use ProgressObserver.NO_OBSERVER if no
progress shall be indicatedconstraints. null constraints are ignored and not returned as a result. Can have the
status Status.UNSUPPORTED if the concrete reasoner does not
support this operation.#evaluate(Project, Configuration, List, ReasonerConfiguration, ProgressObserver)public int getReadyForUseCount()
getReasonersCount(), this method counts only reasoners which can be used for reasoning.
This number is ≤ to getReasonersCount().getReasonersCount()public int getReasonersCount()
getReadyForUseCount()public ReasonerDescriptor getReasonerDescriptor(int index)
index - the index of the reasonerjava.lang.IndexOutOfBoundsException - in case that index<0 || index>={getReasonersCount()public ReasoningResult upgradeReasoner(ReasonerDescriptor descriptor, java.net.URI uri, net.ssehub.easy.basics.progress.ProgressObserver observer)
descriptor - the descriptor of the reasoner to be updateduri - the URI where the data for the upgrade is located atobserver - an optional progress observer, shall be ProgressObserver.NO_OBSERVER if unusedStatus.UNSUPPORTED if the concrete reasoner does not support
this operation.java.lang.IllegalArgumentException - in case of illegal argumentspublic void setReasonerHint(ReasonerDescriptor descriptor)
descriptor - the descriptor denoting the reasoner (may be null for clearing an already set hint)java.lang.IllegalArgumentException - in case of illegal argumentspublic boolean hasReasonerCapability(net.ssehub.easy.varModel.capabilities.IReasonerCapability capability)
capability - the capability to look fortrue if the capability is provided, false elsepublic boolean hasReasonerCapability(net.ssehub.easy.varModel.capabilities.IReasonerCapability capability,
ReasonerConfiguration reasonerConfiguration)
capability - the capability to look forreasonerConfiguration - the configuration to consider (may be null)true if the capability is provided, false elsepublic ReasonerDescriptor getReasonerHint()
IReasoner findReasoner(ReasonerDescriptor descriptor)
descriptor - the descriptor of the reasoner to findjava.lang.IllegalArgumentException - in case of illegal arguments such as null or an unmatching descriptorpublic IReasoner findReasoner(java.lang.String name, java.lang.String version)
name and version.name - the name of the reasoner as given in its descriptorversion - the version of the reasoner as given in its descriptor (ignored if null)java.lang.IllegalArgumentException - in case of illegal arguments such as null or an unmatching descriptorpublic void register(IMessageListener listener)
listener - the listener to registerpublic void unregister(IMessageListener listener)
listener - the listener to unregisterpublic boolean reasoningSupported()
public void setTimeout(int timeout)
timeout - the global timeout in ms, shall be ignored if less negative or nullpublic int getTimeout()
public ReasonerDescriptor getPreferredReasoner()
setReasonerHint(ReasonerDescriptor)public ReasonerDescriptor setPreferredReasoner()
hint.getPreferredReasoner(),
setReasonerHint(ReasonerDescriptor)public boolean isChainingReasoner(ReasonerDescriptor descriptor)
descriptor
is a chaining reasoner.descriptor - the descriptortrue for chaining, false elsepublic IReasonerInstance createInstance(net.ssehub.easy.varModel.confModel.Configuration cfg, ReasonerConfiguration reasonerConfiguration)
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)DelegatingReasonerInstance on this reasoner to
avoid null pointer checking.#createInstance(Project, Configuration, ReasonerConfiguration)public ValueCreationResult createValue(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.AbstractVariable var, net.ssehub.easy.varModel.model.datatypes.IDatatype type, ReasonerConfiguration reasonerConfiguration, net.ssehub.easy.basics.progress.ProgressObserver observer)
cfg - the configuration to operate on (will not be modified)var - the variable to create the value for (may be null if type is given, may imply
additional constraints, takes precedence over type)type - the type to create the value for (may be null if var is 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 be ProgressObserver.NO_OBSERVER if unusedCopyright © 2009 - 2018 SSE. All Rights Reserved.