Class RuleEvaluation
java.lang.Object
com.yahoo.prelude.semantics.engine.RuleEvaluation
A particular evaluation of a particular rule.
- Author:
- bratseth
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an item to the query being evaluated in a way consistent with the query typevoid
addMatch
(FlattenedItem item, String replaceString) Adds a matchReturns the current term item to look at, or null if there are no more elementsint
Returns the position of the current itemvoid
getChoicepoint
(Condition condition, boolean create) Add a choice point to this evaluationReturns the evaluation this belongs togetNonreferencedMatch
(int index) int
int
Returns the current position into the terms this evaluates overint
getReferencedMatches
(String name) Returns the referenced matches for a context name, or null if noneint
getValue()
Returns the last value returned by a condition in this evaluation, or nullvoid
void
initialize
(List<FlattenedItem> list, int startPosition) 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 typeboolean
Returns whether we are evaluating inside a condition which inverts the truth valueint
Returns the total number of items to match in this evaluationitems()
Returns a read-only view of the items of thisvoid
next()
Advances currentItem to the next term item and returns thatItem.void
removeItem
(int position, Item item) Removes an item, prefers the one at/close to the given position if there are multiple onesvoid
removeItem
(Item item) void
removeItemByIdentity
(Item item) void
removeMatches
(ReferencedMatches matches) Remove all the terms recognized by this matchvoid
setCurrentLabel
(String currentLabel) Sets a new current label and returns the previous onevoid
setInNegation
(boolean inNegation) sets whether we are evaluating inside a condition which inverts the truth valuevoid
setMatchReferences
(Set<String> matchReferences) void
setPosition
(int position) Sets the current positionvoid
Sets the last value returned by a condition in this evaluatiino, or nullvoid
void
-
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
-