Class RuleEvaluation
java.lang.Object
com.yahoo.prelude.semantics.engine.RuleEvaluation
A particular evaluation of a particular rule.
- Author:
- bratseth
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an item to the query being evaluated in a way consistent with the query typevoidaddMatch(FlattenedItem item, String replaceString) Adds a matchReturns the current term item to look at, or null if there are no more elementsintReturns the position of the current itemvoidgetChoicepoint(Condition condition, boolean create) Add a choice point to this evaluationReturns the evaluation this belongs togetNonreferencedMatch(int index) intintReturns the current position into the terms this evaluates overintgetReferencedMatches(String name) Returns the referenced matches for a context name, or null if noneintgetValue()Returns the last value returned by a condition in this evaluation, or nullvoidvoidinitialize(List<FlattenedItem> list, int startPosition) voidinsertItems(List<Item> items, CompositeItem parent, int index, TermType termType, boolean replacing) Inserts an item to the query being evaluated in a way consistent with the query typebooleanReturns whether we are evaluating inside a condition which inverts the truth valueintReturns the total number of items to match in this evaluationitems()Returns a read-only view of the items of thisvoidnext()Advances currentItem to the next term item and returns thatItem.voidremoveItem(int position, Item item) Removes an item, prefers the one at/close to the given position if there are multiple onesvoidremoveItem(Item item) voidremoveItemByIdentity(Item item) voidremoveMatches(ReferencedMatches matches) Remove all the terms recognized by this matchvoidsetCurrentLabel(String currentLabel) Sets a new current label and returns the previous onevoidsetInNegation(boolean inNegation) sets whether we are evaluating inside a condition which inverts the truth valuevoidsetMatchReferences(Set<String> matchReferences) voidsetPosition(int position) Sets the current positionvoidSets the last value returned by a condition in this evaluatiino, or nullvoidvoid
-
Constructor Details
-
RuleEvaluation
-
-
Method Details
-
initialize
-
setMatchReferences
-
currentItem
Returns the current term item to look at, or null if there are no more elements -
previousItem
-
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
Returns the last value returned by a condition in this evaluation, or null -
setValue
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
Sets a new current label and returns the previous one -
getCurrentLabel
-
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
-
leaving
-
addMatch
Adds a match- Parameters:
item- the match to addreplaceString- the string to replace this match by, usually the item.getIndexedValue()
-
getReferencedMatches
Returns the referenced matches for a context name, or null if none -
getReferencedMatchCount
public int getReferencedMatchCount() -
getNonreferencedMatchCount
public int getNonreferencedMatchCount() -
getEvaluation
Returns the evaluation this belongs to -
addItems
Adds an item to the query being evaluated in a way consistent with the query type -
removeItem
-
removeItemByIdentity
-
removeItem
Removes an item, prefers the one at/close to the given position if there are multiple ones -
insertItems
public void insertItems(List<Item> items, CompositeItem parent, int index, TermType termType, boolean replacing) Inserts an item to the query being evaluated in a way consistent with the query type- Parameters:
items- the items to insertparent- the parent of this item, or null to set the rootindex- the index at which to insert this into the parenttermType- the kind of item to index, this decides the resulting structure
-
items
Returns a read-only view of the items of this -
getNonreferencedMatch
-
trace
-
getTraceLevel
public int getTraceLevel() -
indentTrace
public void indentTrace() -
unindentTrace
public void unindentTrace() -
getChoicepoint
Add a choice point to this evaluation- Parameters:
condition- the creating conditioncreate- true to create this choicepoint if it is missing- Returns:
- the choicepoint, or null if not present, and create is false
-
removeMatches
Remove all the terms recognized by this match
-