Class Explanation


  • public class Explanation
    extends Object
    An explanation is simply a set of causes and decisions explaining a situation, for instance a conflict. It is related to the explanation engine (replacement of Explanation) Created by cprudhom on 09/12/14. Project: choco.
    Author:
    Charles Prud'homme, Narendra Jussien
    • Method Detail

      • addCause

        public boolean addCause​(ICause cause)
        Add a cause, which explains, partially, the situation
        Parameters:
        cause - a cause
        Returns:
        true if this was an unknown cause
      • addDecision

        public void addDecision​(Decision decision)
        Add a decision, which explains, partially, the situation
        Parameters:
        decision - a decision
      • nbCauses

        public int nbCauses()
        Return the number of causes explaining the situation
        Returns:
        an int
      • nbDecisions

        public int nbDecisions()
        Return the number of decisions explaining the situation
        Returns:
        an int
      • addCausesAndDecisions

        public void addCausesAndDecisions​(Explanation explanation)
        Merge all causes and decisions from explanation in this.
        Parameters:
        explanation - a given explanation
      • addRules

        public void addRules​(Rules someRules)
        Merge 'someRules' into this rules
        Parameters:
        someRules - the rules to add
      • remove

        public boolean remove​(ICause cause)
        Remove one cause from the set of causes explaining the situation
        Parameters:
        cause - a cause to remove
        Returns:
        true if the explanation changed
      • remove

        public void remove​(Decision decision)
        Remove one decision from the set of decisions explaining the situation
        Parameters:
        decision - a decision to remove
      • getDecisions

        public BitSet getDecisions()
        Returns:
        a unmodifiable copy of the set of decisions
      • getCauses

        public Set<ICause> getCauses()
        Returns:
        a unmodifiable copy of the set of causes
      • isComplete

        public boolean isComplete()
        Returns:
        true if the explanation is complete
      • getEvtstrIdx

        public int getEvtstrIdx()
        Get the event store idx at which the last analysis ends
        Returns:
        an event store index
      • setEvtstrIdx

        public void setEvtstrIdx​(int evtstrIdx)
        Set the event store idx, where the last analysis ends
        Parameters:
        evtstrIdx - an event store index
      • getRules

        public Rules getRules()
        Return the rules, may be null
        Returns:
        the rules or null
      • recycle

        public void recycle()
        Recycle this explanation when it is not used anymore.