public class Evaluation extends Object
Modifier and Type | Field and Description |
---|---|
private int |
currentIndex
The current index into the flattened item list
|
private List<FlattenedItem> |
flattenedItems
Query items flattened to a list iterator
|
private Set<Integer> |
matchDigests
See RuleEngine
|
private ParameterNameSpace |
parameterNameSpace |
private int |
previousQuerySize
The previous size of this query (see RuleEngine), set on matches only
|
private Query |
query |
private RuleEvaluation |
ruleEvaluation
The rule evaluation context, can be reset once the rule is evaluated
|
private boolean |
stemming
Should we allow stemmed matches?
|
private String |
traceIndentation |
private int |
traceLevel
The amount of context information to collect about this evaluation.
|
Constructor and Description |
---|
Evaluation(Query query) |
Evaluation(Query query,
int traceLevel)
Creates a new evaluation
|
Modifier and Type | Method and Description |
---|---|
private void |
addItem(CompositeItem parent,
int index,
Item item,
TermType desiredParentType) |
void |
addItem(Item item,
TermType termType)
Adds an item to the query being evaluated in a way consistent with the query type
|
(package private) void |
addMatchDigest(int digest) |
private Item |
combineItems(Item first,
Item second,
TermType termType) |
private CompositeItem |
convertSegmentItem(CompositeItem item)
Convert segment items into their mutable counterpart, do not update query tree.
|
private CompositeItem |
createType(TermType termType) |
FlattenedItem |
currentItem()
Returns the current item, or null if there is no more elements
|
private boolean |
equalIndexNameIfParentIsPhrase(Item item,
CompositeItem parent)
A special purpose check used to simplify the above
|
private int |
findIndexByIdentity(Item item) |
private void |
flatten(Item item,
int position,
List<FlattenedItem> toList) |
RuleEvaluation |
freshRuleEvaluation()
Returns a fresh rule evaluation starting at the current position of this
|
NameSpace |
getNameSpace(String nameSpaceName) |
(package private) int |
getPreviousQuerySize() |
Query |
getQuery() |
int |
getQuerySize() |
boolean |
getStemming()
Returns whether stemmed matches are allowed.
|
int |
getTraceLevel()
The amount of context information to collect about this evaluation.
|
(package private) boolean |
hasMatchDigest(int matchDigest) |
void |
indentTrace() |
private void |
insertIncompatibleItem(Item item,
CompositeItem parent,
Query query,
TermType desiredParentType) |
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
|
private void |
insertMutableInTree(CompositeItem mutable,
CompositeItem original,
CompositeItem parent) |
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,
String message) |
void |
unindentTrace() |
private ParameterNameSpace parameterNameSpace
private Query query
private int currentIndex
private List<FlattenedItem> flattenedItems
private RuleEvaluation ruleEvaluation
private int traceLevel
private String traceIndentation
private int previousQuerySize
private boolean stemming
public Evaluation(Query query)
public Evaluation(Query query, int traceLevel)
query
- the query this evaluation is fortraceLevel
- the amount of tracing to dopublic void reset()
public void setToLast()
public void resetToLast()
public Query getQuery()
public void setStemming(boolean stemming)
public boolean getStemming()
void addMatchDigest(int digest)
boolean hasMatchDigest(int matchDigest)
int getPreviousQuerySize()
public int getQuerySize()
public void next()
public void previous()
public FlattenedItem currentItem()
public RuleEvaluation freshRuleEvaluation()
public void addItem(Item item, TermType termType)
public void removeItem(Item item)
public void removeItemByIdentity(Item item)
private int findIndexByIdentity(Item item)
public void removeItem(int position, Item item)
private CompositeItem convertSegmentItem(CompositeItem item)
private void insertMutableInTree(CompositeItem mutable, CompositeItem original, CompositeItem parent)
public void makeParentMutable(TermItem item)
item
- The item for which the parent shall be made mutablepublic void insertItem(Item item, CompositeItem parent, int index, TermType desiredParentType)
item
- the item to insertparent
- the parent of this item, or null to set the rootindex
- the index at which to insert this into the parentdesiredParentType
- the desired type of the composite which contains item when this returnsprivate void addItem(CompositeItem parent, int index, Item item, TermType desiredParentType)
private boolean equalIndexNameIfParentIsPhrase(Item item, CompositeItem parent)
private void insertIncompatibleItem(Item item, CompositeItem parent, Query query, TermType desiredParentType)
private CompositeItem createType(TermType termType)
private void flatten(Item item, int position, List<FlattenedItem> toList)
public void trace(int level, String message)
public int getTraceLevel()
public void indentTrace()
public void unindentTrace()
Copyright © 2018. All rights reserved.