Class RuleEvaluation

  • public class RuleEvaluation
    extends java.lang.Object
    A particular evalutation of a particular rule.
    • Constructor Detail

      • RuleEvaluation

        public RuleEvaluation​(Evaluation owner)
    • Method Detail

      • initialize

        public void initialize​(java.util.List<FlattenedItem> list,
                               int startPosition)
      • setMatchReferences

        public void setMatchReferences​(java.util.Set<java.lang.String> matchReferences)
      • currentItem

        public FlattenedItem currentItem()
        Returns the current term item to look at, or null if there are no more elements
      • currentPosition

        public int currentPosition()
        Returns the position of the current item
      • setPosition

        public void setPosition​(int position)
        Sets the current position
      • itemCount

        public int itemCount()
        Returns the total number of items to match in this evaluation
      • getValue

        public java.lang.Object getValue()
        Returns the last value returned by a condition in this evaluation, or null
      • setValue

        public void setValue​(java.lang.Object value)
        Sets the last value returned by a condition in this evaluatiino, or null
      • isInNegation

        public boolean isInNegation()
        Returns whether we are evaluating inside a condition which inverts the truth value
      • setInNegation

        public void setInNegation​(boolean inNegation)
        sets whether we are evaluating inside a condition which inverts the truth value
      • getPosition

        public int getPosition()
        Returns the current position into the terms this evaluates over
      • setCurrentLabel

        public java.lang.String setCurrentLabel​(java.lang.String currentLabel)
        Sets a new current label and returns the previous one
      • getCurrentLabel

        public java.lang.String getCurrentLabel()
      • next

        public FlattenedItem next()
        Advances currentItem to the next term item and returns thatItem. If the current item before this call is the last item, this will return (and set currentItem to) null.
      • entering

        public void entering​(java.lang.String context)
      • leaving

        public void leaving​(java.lang.String context)
      • addMatch

        public void addMatch​(FlattenedItem item,
                             java.lang.String replaceString)
        Adds a match
        item - the match to add
        replaceString - the string to replace this match by, usually the item.getIndexedValue()
      • getReferencedMatches

        public ReferencedMatches getReferencedMatches​(java.lang.String name)
        Returns the referenced matches for a context name, or null if none
      • getReferencedMatchCount

        public int getReferencedMatchCount()
      • getNonreferencedMatchCount

        public int getNonreferencedMatchCount()
      • getEvaluation

        public Evaluation getEvaluation()
        Returns the evaluation this belongs to
      • addItem

        public void addItem​(Item item,
                            TermType termType)
        Adds an item to the query being evaluated in a way consistent with the query type
      • removeItem

        public void removeItem​(Item item)
      • removeItemByIdentity

        public void removeItemByIdentity​(Item item)
      • removeItem

        public void removeItem​(int position,
                               Item item)
        Removes an item, prefers the one at/close to the given position if there are multiple ones
      • insertItem

        public void insertItem​(Item item,
                               CompositeItem parent,
                               int index,
                               TermType termType)
        Inserts an item to the query being evaluated in a way consistent with the query type
        item - the item to insert
        parent - the parent of this item, or null to set the root
        index - the index at which to insert this into the parent
        termType - the kind of item to index, this decides the resulting structure
      • items

        public java.util.List<FlattenedItem> items()
        Returns a read-only view of the items of this
      • getNonreferencedMatch

        public Match getNonreferencedMatch​(int index)
      • trace

        public void trace​(int level,
                          java.lang.String string)
      • getTraceLevel

        public int getTraceLevel()
      • indentTrace

        public void indentTrace()
      • unindentTrace

        public void unindentTrace()
      • getChoicepoint

        public Choicepoint getChoicepoint​(Condition condition,
                                          boolean create)
        Add a choice point to this evaluation
        condition - the creating condition
        create - true to create this choicepoint if it is missing
        the choicepoint, or null if not present, and create is false
      • removeMatches

        public void removeMatches​(ReferencedMatches matches)
        Remove all the terms recognized by this match