Package com.yahoo.prelude.semantics.rule
Class CompositeCondition
- java.lang.Object
-
- com.yahoo.prelude.semantics.rule.Condition
-
- com.yahoo.prelude.semantics.rule.CompositeCondition
-
- Direct Known Subclasses:
AndCondition
,ChoiceCondition
,ComparisonCondition
,CompositeItemCondition
,SequenceCondition
public abstract class CompositeCondition extends Condition
A condition which contains a list of conditions- Author:
- bratseth
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.yahoo.prelude.semantics.rule.Condition
Condition.Anchor
-
-
Constructor Summary
Constructors Constructor Description CompositeCondition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCondition(Condition condition)
protected boolean
allSubConditionsMatches(RuleEvaluation e)
Returns whether all the conditions of this matches the current evaluation statejava.util.Iterator<Condition>
conditionIterator()
Returns an iterator of the immediate children of this conditionint
conditionSize()
Returns the number of subconditionsprotected java.lang.String
conditionsToString(java.lang.String conditionSeparator)
Condition
getCondition(int i)
Returns the condition at the given indexprotected boolean
hasOpenChoicepoint(RuleEvaluation evaluation)
Returns whether there is an open choice in this or any of its subconditions.void
makeReferences(RuleBase rules)
Override if references needs to be set in this condition of its childrenvoid
postMatchHook(RuleEvaluation e)
Called just before match returns, on any return condition including exceptions.void
preMatchHook(RuleEvaluation e)
Called when match is called, before anything else.Condition
removeCondition(int i)
Returns the condition at the given indexvoid
setCondition(int index, Condition condition)
Sets the condition at the given indexprotected java.lang.String
toInnerString(java.lang.String conditionSeparator)
protected boolean
useParentheses()
Whether this should be output with parentheses, default is parent!=null-
Methods inherited from class com.yahoo.prelude.semantics.rule.Condition
doesMatch, getAnchor, getContextName, getLabel, getLabelString, getMatchInfo, getMatchInfoString, getNameSpace, getParent, isDefaultContextName, isReferable, labelMatches, labelMatches, matches, matchesEndAnchor, matchesStartAnchor, setAnchor, setContextName, setLabel, setNameSpace, toInnerString, toString, traceResult
-
-
-
-
Method Detail
-
preMatchHook
public void preMatchHook(RuleEvaluation e)
Description copied from class:Condition
Called when match is called, before anything else. Always call super.preMatchHook when overriding.- Overrides:
preMatchHook
in classCondition
-
postMatchHook
public void postMatchHook(RuleEvaluation e)
Description copied from class:Condition
Called just before match returns, on any return condition including exceptions. Always call super.postMatchHook when overriding- Overrides:
postMatchHook
in classCondition
-
hasOpenChoicepoint
protected boolean hasOpenChoicepoint(RuleEvaluation evaluation)
Description copied from class:Condition
Returns whether there is an open choice in this or any of its subconditions. Returns false by default, must be overriden by conditions which may generate choices open accross multiple calls to matches, or contain such conditions.- Overrides:
hasOpenChoicepoint
in classCondition
-
addCondition
public void addCondition(Condition condition)
-
setCondition
public void setCondition(int index, Condition condition)
Sets the condition at the given index
-
conditionSize
public int conditionSize()
Returns the number of subconditions
-
getCondition
public Condition getCondition(int i)
Returns the condition at the given index- Parameters:
i
- the 0-base index- Returns:
- the condition at this index
- Throws:
java.lang.IndexOutOfBoundsException
- if there is no condition at this index
-
removeCondition
public Condition removeCondition(int i)
Returns the condition at the given index- Parameters:
i
- the 0-base index- Returns:
- the removed condition
- Throws:
java.lang.IndexOutOfBoundsException
- if there is no condition at this index
-
conditionIterator
public java.util.Iterator<Condition> conditionIterator()
Returns an iterator of the immediate children of this condition
-
makeReferences
public void makeReferences(RuleBase rules)
Description copied from class:Condition
Override if references needs to be set in this condition of its children- Overrides:
makeReferences
in classCondition
-
useParentheses
protected boolean useParentheses()
Whether this should be output with parentheses, default is parent!=null
-
toInnerString
protected java.lang.String toInnerString(java.lang.String conditionSeparator)
-
conditionsToString
protected final java.lang.String conditionsToString(java.lang.String conditionSeparator)
-
allSubConditionsMatches
protected final boolean allSubConditionsMatches(RuleEvaluation e)
Returns whether all the conditions of this matches the current evaluation state
-
-