Package com.yahoo.prelude.semantics.rule
Class Condition
java.lang.Object
com.yahoo.prelude.semantics.rule.Condition
- Direct Known Subclasses:
CompositeCondition
,ConditionReference
,EllipsisCondition
,LiteralCondition
,NotCondition
,SuperCondition
,TermCondition
Superclass of all kinds of conditions of production rules
- Author:
- bratseth
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
Returns whether this condition matches the given evaluation at the current location of the evaluation.Returns the positional constraint on this anchor.Returns the name whatever is matched by this condition can be referred as, or null if it is unreferablegetLabel()
Sets the label of this.protected String
protected String
Override this to return a string describing what this condition has matched in this evaluation.protected String
Returns the name of the namespace of this, or null if default (query)Returns the condition this is nested within, or null if it is not nestedprotected boolean
Returns whether there is an open choice in this or any of its subconditions.protected boolean
protected boolean
Returns whether this is referable, returns context!=null by defaultprotected boolean
labelMatches
(TermItem evaluationTerm, RuleEvaluation e) protected boolean
Whether the label matches the current item, true if there is no current itemvoid
makeReferences
(RuleBase rules) Override if references needs to be set in this condition of its childrenfinal boolean
Returns whether this condition matches the given evaluation at the current location of the evaluation.protected boolean
Check start anchor.protected boolean
Check start anchor.protected void
Called just before match returns, on any return condition including exceptions.protected void
Called when match is called, before anything else.void
setAnchor
(Condition.Anchor anchor) Sets a positional constraint on this conditionvoid
setContextName
(String contextName) Sets the name whatever is matched by this condition can be refered as, or null to make it nonreferablevoid
Returns the label of this, or null if none (the default)void
setNameSpace
(String nameSpace) Sets the name of the namespace of thisprotected abstract String
All instances of this produces a parseable string outputtoString()
protected void
traceResult
(boolean matches, RuleEvaluation e)
-
Constructor Details
-
Condition
public Condition() -
Condition
-
Condition
-
-
Method Details
-
setContextName
Sets the name whatever is matched by this condition can be refered as, or null to make it nonreferable -
getContextName
Returns the name whatever is matched by this condition can be referred as, or null if it is unreferable -
isReferable
protected boolean isReferable()Returns whether this is referable, returns context!=null by default -
getLabel
Sets the label of this. Set to null to use the default -
setLabel
Returns the label of this, or null if none (the default) -
getNameSpace
Returns the name of the namespace of this, or null if default (query) -
setNameSpace
Sets the name of the namespace of this -
getParent
Returns the condition this is nested within, or null if it is not nested -
setAnchor
Sets a positional constraint on this condition -
getAnchor
Returns the positional constraint on this anchor. This is never null -
matches
Returns whether this condition matches the given evaluation at the current location of the evaluation. Calls the doesMatch method of each condition subtype. -
matchesStartAnchor
Check start anchor. Trace level 4 if no match -
matchesEndAnchor
Check start anchor. Trace level 4 if no match -
traceResult
-
getMatchInfoString
-
preMatchHook
Called when match is called, before anything else. Always call super.preMatchHook when overriding. -
postMatchHook
Called just before match returns, on any return condition including exceptions. Always call super.postMatchHook when overriding -
getMatchInfo
Override this to return a string describing what this condition has matched in this evaluation. Will only be called when this condition is actually matched in this condition- Returns:
- info about what is matched, or null if there is no info to return (default)
-
doesMatch
Returns whether this condition matches the given evaluation at the current location of the evaluation. If there is a match, the evaluation must be advanced to the location beyond the matching item(s) before this method returns. -
hasOpenChoicepoint
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. -
makeReferences
Override if references needs to be set in this condition of its children -
getLabelString
-
labelMatches
Whether the label matches the current item, true if there is no current item -
labelMatches
-
toInnerString
All instances of this produces a parseable string output -
isDefaultContextName
protected boolean isDefaultContextName() -
toString
-