Class ReasoningResult

    • Field Detail

      • messages

        private java.util.List<Message> messages
      • hasConflict

        private boolean hasConflict
      • hasTimeout

        private boolean hasTimeout
      • wasStopped

        private boolean wasStopped
      • measures

        private java.util.Map<IMeasurementKey,​java.lang.Number> measures
    • Constructor Detail

      • ReasoningResult

        public ReasoningResult()
        General constructor for new ReasoningResults.
      • ReasoningResult

        public ReasoningResult​(java.lang.String reasonerName)
        Constructor for a result denoting the the chosen constructor is not able to handle the called operation.
        Parameters:
        reasonerName - The name of the reasoner, which was called.
    • Method Detail

      • addAffected

        public void addAffected​(IDecisionVariable var)
        Adds a variable affected by reasoning. A reasoner may use this method to communicate affected variables and, thus, support further language mechanisms, such as runtime instantiation.
        Parameters:
        var - the affected variable
      • addMessage

        public void addMessage​(Message message)
        Adds a new Message to the current result, e. g. an Error or Warning
        Parameters:
        message - The new message which should be added to this result.
      • setTimeout

        public void setTimeout​(boolean hasTimeout)
        Changes whether reasoning was stopped due to a timeout.
        Parameters:
        hasTimeout - true for timeout, false else
      • setStopped

        public void setStopped​(boolean wasStopped)
        Changes whether reasoning was stopped due to a user request.
        Parameters:
        wasStopped - true for stopped, false else
      • hasTimeout

        public boolean hasTimeout()
        Returns whether reasoning was stopped due to a timeout.
        Returns:
        true for timeout, false else
      • wasStopped

        public boolean wasStopped()
        Returns whether reasoning was stopped due to a user request.
        Returns:
        true for stopped, false else
      • hasConflict

        public boolean hasConflict()
        Denotes whether this reasoning result represents an error/conflict.
        Returns:
        true if the reasoning result represents an error, otherwise false.
        See Also:
        hasTimeout
      • hasInfo

        public boolean hasInfo()
        Checks whether this result contains any Status.INFO messages, indicating that the configuration was changed.
        Returns:
        true if this result contains at least one Status.INFO message, false otherwise.
      • reasoningUnsupported

        public boolean reasoningUnsupported()
        Returns whether the called reasoning step is supported by this reasoner.
        Returns:
        true if the reasoning was not supported, otherwise false.
      • getMessageCount

        public int getMessageCount()
        Returns the number of messages related to this reasoning result.
        Returns:
        the number of messages in this result
      • getMessage

        public Message getMessage​(int index)
        Returns the message specified by index.
        Parameters:
        index - a 0-based index specifying the message to be returned
        Returns:
        the message
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getMessageCount()
      • providesInformationOnAffectedVariables

        public boolean providesInformationOnAffectedVariables()
        Returns whether information on affected variables is provided.
        Returns:
        true if information of affected variables is provided, false else (then getAffectedVariablesCount() will always be 0).
      • getAffectedVariablesCount

        public int getAffectedVariablesCount()
        Return the number of affected variables.
        Returns:
        the number of affected variables
      • getAffectedVariable

        public IDecisionVariable getAffectedVariable​(int index)
        Returns the affected variable specified by index.
        Parameters:
        index - a 0-based index specifying the variable to be returned
        Returns:
        the affected variable
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getAffectedVariablesCount()
      • setMeasure

        public void setMeasure​(IMeasurementKey key,
                               java.lang.Number value)
        Sets a reasoner-specific measure.
        Parameters:
        key - the key (null is ignored)
        value - the measure (may be null)
      • getMeasure

        public java.lang.Number getMeasure​(IMeasurementKey key)
        Returns the measure for a specific key.
        Parameters:
        key - the key (null is ignored)
        Returns:
        the measure (may be null)
      • measurementKeys

        public java.util.Set<IMeasurementKey> measurementKeys()
        Returns all measurement keys.
        Returns:
        the keys, may be null if there are none
      • logInformation

        public void logInformation​(Project prj,
                                   ReasonerConfiguration rConfig)
        Logs reasoning summary based on prj, the measures and the messages. Reasoners shall not produce output except for debugging stuff. If explicit output is required, call this method after reasoning. Logs with reasoner messages by default.
        Parameters:
        prj - the project representing the model
        rConfig - the configuration containing the information logger
      • logInformation

        public void logInformation​(Project prj,
                                   ReasonerConfiguration rConfig,
                                   boolean withMessages)
        Logs reasoning summary based on prj, the measures and the messages. Reasoners shall not produce output except for debugging stuff. If explicit output is required, call this method after reasoning.
        Parameters:
        prj - the project representing the model
        rConfig - the configuration containing the information logger
        withMessages - include the reasoner messages (may be time consuming)
      • logInformation

        public void logInformation​(Project prj,
                                   ReasonerConfiguration.IAdditionalInformationLogger infoLogger,
                                   boolean withMessages)
        Logs reasoning summary based on prj, the measures and the messages. Reasoners shall not produce output except for debugging stuff. If explicit output is required, call this method after reasoning.
        Parameters:
        prj - the project representing the model
        infoLogger - the information logger
        withMessages - include the reasoner messages (may be time consuming)