Class Evaluation


  • public class Evaluation
    extends java.lang.Object
    An evaluation of a query over a rule base. There is one evaluation for each evaluation of one query over one rule base.
    Author:
    bratseth
    • Constructor Summary

      Constructors 
      Constructor Description
      Evaluation​(Query query)  
      Evaluation​(Query query, int traceLevel)
      Creates a new evaluation
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addItem​(Item item, TermType termType)
      Adds an item to the query being evaluated in a way consistent with the query type
      FlattenedItem currentItem()
      Returns the current item, or null if there is no more elements
      RuleEvaluation freshRuleEvaluation()
      Returns a fresh rule evaluation starting at the current position of this
      NameSpace getNameSpace​(java.lang.String nameSpaceName)  
      Query getQuery()  
      int getQuerySize()  
      boolean getStemming()
      Returns whether stemmed matches are allowed.
      int getTraceLevel()
      The amount of context information to collect about this evaluation.
      void indentTrace()  
      void insertItem​(Item item, CompositeItem parent, int index, TermType desiredParentType)
      Inserts an item to the query being evaluated in a way consistent with the query type
      void makeParentMutable​(TermItem item)
      Convert The parent of this item into a mutable item.
      void next()
      Advances to the next item as current item
      void previous()  
      void removeItem​(int position, Item item)
      Removes an item, prefers the one at/close to the given position if there are multiple ones
      void removeItem​(Item item)
      Removes this item
      void removeItemByIdentity​(Item item)
      Removes this item by identity to ensure we remove the right one if there are multiple equal items
      void reset()
      Resets the item iterator to point to the first item
      void resetToLast()
      Resets the item iterator to point to the last item:
      void setStemming​(boolean stemming)
      Set to true to enable stemmed matches.
      void setToLast()
      Sets the item iterator to point to the last item:
      void trace​(int level, java.lang.String message)  
      void unindentTrace()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Evaluation

        public Evaluation​(Query query)
      • Evaluation

        public Evaluation​(Query query,
                          int traceLevel)
        Creates a new evaluation
        Parameters:
        query - the query this evaluation is for
        traceLevel - the amount of tracing to do
    • Method Detail

      • reset

        public void reset()
        Resets the item iterator to point to the first item
      • setToLast

        public void setToLast()
        Sets the item iterator to point to the last item:
      • resetToLast

        public void resetToLast()
        Resets the item iterator to point to the last item:
      • getQuery

        public Query getQuery()
      • setStemming

        public void setStemming​(boolean stemming)
        Set to true to enable stemmed matches. True by default
      • getStemming

        public boolean getStemming()
        Returns whether stemmed matches are allowed. True by default
      • getQuerySize

        public int getQuerySize()
      • next

        public void next()
        Advances to the next item as current item
      • previous

        public void previous()
      • currentItem

        public FlattenedItem currentItem()
        Returns the current item, or null if there is no more elements
      • freshRuleEvaluation

        public RuleEvaluation freshRuleEvaluation()
        Returns a fresh rule evaluation starting at the current position of this
      • 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)
        Removes this item
      • removeItemByIdentity

        public void removeItemByIdentity​(Item item)
        Removes this item by identity to ensure we remove the right one if there are multiple equal items
      • 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
      • makeParentMutable

        public void makeParentMutable​(TermItem item)
        Convert The parent of this item into a mutable item. Note, this may change the shape of the query tree. (E.g. if the original parent is a segment phrase, and the original parent's parent is a phrase, the terms from the parent will be moved to the parent's parent.)
        Parameters:
        item - the item for which the parent shall be made mutable
      • insertItem

        public void insertItem​(Item item,
                               CompositeItem parent,
                               int index,
                               TermType desiredParentType)
        Inserts an item to the query being evaluated in a way consistent with the query type
        Parameters:
        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
        desiredParentType - the desired type of the composite which contains item when this returns
      • trace

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

        public int getTraceLevel()
        The amount of context information to collect about this evaluation. 0 (the default) means no context information, higher numbers means more context information.
      • indentTrace

        public void indentTrace()
      • unindentTrace

        public void unindentTrace()
      • getNameSpace

        public NameSpace getNameSpace​(java.lang.String nameSpaceName)