Class Reasoner

  • All Implemented Interfaces:
    IReasoner

    public class Reasoner
    extends java.lang.Object
    implements IReasoner
    This class is the EASy Producer Reasoner implementation for reasoning over IVML projects and configurations.
    Author:
    El-Sharkawy, Sizonenko
    • Constructor Detail

      • Reasoner

        public Reasoner()
    • Method Detail

      • getDescriptor

        public ReasonerDescriptor getDescriptor()
        Description copied from interface: IReasoner
        Returns a descriptor stating common information about this reasoner.
        Specified by:
        getDescriptor in interface IReasoner
        Returns:
        the descriptor
      • upgrade

        public ReasoningResult upgrade​(java.net.URI url,
                                       ProgressObserver observer)
        Description copied from interface: IReasoner
        Updates the installation of this reasoner, e.g., in order to obtain a licensed reasoner version.
        Specified by:
        upgrade in interface IReasoner
        Parameters:
        url - The location of the implementation of the reasoner which should be upgraded
        observer - an optional progress observer, shall be ProgressObserver.NO_OBSERVER if unused
        Returns:
        The result of this upgrade process.
      • isConsistent

        public ReasoningResult isConsistent​(Project project,
                                            ReasonerConfiguration reasonerConfig,
                                            ProgressObserver observer)
        Description copied from interface: IReasoner
        Checks whether a given variability model (project) is satisfiable.
        Specified by:
        isConsistent in interface IReasoner
        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 be ProgressObserver.NO_OBSERVER if unused
        Returns:
        The result of this reasoning step. Can have the status Status.UNSUPPORTED if the concrete reasoner does not support this operation.
      • check

        public ReasoningResult check​(Configuration cfg,
                                     ReasonerConfiguration reasonerConfig,
                                     ProgressObserver observer)
        Description copied from interface: IReasoner
        Checks the configuration according to the given project structure and does not affect the configuration.
        Specified by:
        check in interface IReasoner
        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 be ProgressObserver.NO_OBSERVER if unused
        Returns:
        The result of this reasoning step. Can have the status Status.UNSUPPORTED if the concrete reasoner does not support this operation.
      • propagate

        public ReasoningResult propagate​(Configuration cfg,
                                         ReasonerConfiguration reasonerConfig,
                                         ProgressObserver observer)
        Description copied from interface: IReasoner
        Checks the configuration according to the given model and propagates values, if possible.
        Specified by:
        propagate in interface IReasoner
        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 be ProgressObserver.NO_OBSERVER if unused
        Returns:
        The result of this reasoning step. Can have the status Status.UNSUPPORTED if 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: IReasoner
        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.
        Specified by:
        evaluate in interface IReasoner
        Parameters:
        cfg - the configuration as a basis for the evaluation
        constraints - 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 be ProgressObserver.NO_OBSERVER if unused
        Returns:
        The result of this reasoning step. Can have the status Status.UNSUPPORTED if 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: IReasoner
        Is called when a reasoner message is issued.
        Specified by:
        notify in interface IReasoner
        Parameters:
        message - the message sent
      • createInstance

        public IReasonerInstance createInstance​(Configuration cfg,
                                                ReasonerConfiguration reasonerConfiguration)
        Description copied from interface: IReasoner
        Creates a reasoner instance for repeated reasoning on the same model (no structural changes allowed during two subsequent reasoning runs).
        Specified by:
        createInstance in interface IReasoner
        Parameters:
        cfg - the configuration as a basis for the evaluation
        reasonerConfiguration - the reasoner configuration to be used for reasoning (e.g. taken from the UI, may be null)
        Returns:
        a reusable reasoner instance, return a DelegatingReasonerInstance on this reasoner to avoid null pointer checking.
      • setInterceptor

        public void setInterceptor​(IReasonerInterceptor interceptor)
        Description copied from interface: IReasoner
        Defines the optional interceptor instance.
        Specified by:
        setInterceptor in interface IReasoner
        Parameters:
        interceptor - the interceptor
      • createValue

        public ValueCreationResult createValue​(Configuration cfg,
                                               AbstractVariable var,
                                               IDatatype type,
                                               ReasonerConfiguration reasonerConfiguration,
                                               ProgressObserver observer)
        Description copied from interface: IReasoner
        Creates the value for a certain IVML type/variable.
        Specified by:
        createValue in interface IReasoner
        Parameters:
        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)
        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 unused
        Returns:
        the value creation result