public abstract class Condition extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Condition.Anchor |
Modifier and Type | Field and Description |
---|---|
private Condition.Anchor |
anchor
Position constraints of the terms matched by this condition
|
private String |
contextName
The name of the context created by this, or null if none
Specified by context/condition in rules
|
private String |
label
The label of this condition, or null if none.
|
private String |
nameSpace
The name space refered by this match, or null if the default (query)
Specified by namespace.condition in rules.
|
private CompositeCondition |
parent
The parent of this condition, or null if this is not nested
|
Constructor and Description |
---|
Condition() |
Condition(String label) |
Condition(String label,
String context) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
doesMatch(RuleEvaluation e)
Returns whether this condition matches the given evaluation
at the current location of the evaluation.
|
Condition.Anchor |
getAnchor()
Returns the positional constraint on this anchor.
|
String |
getContextName()
Returns the name whatever is matched by this condition can be refered as, or null
if it is unreferable
|
String |
getLabel()
Sets the label of this.
|
protected String |
getLabelString() |
protected String |
getMatchInfo(RuleEvaluation e)
Override this to return a string describing what this condition has matched in this evaluation.
|
protected String |
getMatchInfoString(RuleEvaluation e) |
String |
getNameSpace()
Returns the name of the namespace of this, or null if default (query)
|
CompositeCondition |
getParent()
Returns the condition this is nested within, or null if it is not nested
|
protected boolean |
hasOpenChoicepoint(RuleEvaluation e)
Returns whether there is an open choice in this or any of its subconditions.
|
protected boolean |
isDefaultContextName() |
protected boolean |
isReferable()
Returns whether this is referable, returns context!=null by default
|
protected boolean |
labelMatches(RuleEvaluation e)
Whether the label matches the current item, true if there is no current item
|
protected boolean |
labelMatches(TermItem evaluationTerm,
RuleEvaluation e) |
void |
makeReferences(RuleBase rules)
Override if references needs to be set in this condition of its children
|
boolean |
matches(RuleEvaluation e)
Returns whether this condition matches the given evaluation
at the current location of the evaluation.
|
protected boolean |
matchesEndAnchor(RuleEvaluation e)
Check start anchor.
|
protected boolean |
matchesStartAnchor(RuleEvaluation e)
Check start anchor.
|
protected void |
postMatchHook(RuleEvaluation e)
Called just before match returns, on any return condition including exceptions.
|
protected void |
preMatchHook(RuleEvaluation e)
Called when match is called, before anything else.
|
void |
setAnchor(Condition.Anchor anchor)
Sets a positional constraint on this condition
|
void |
setContextName(String contextName)
Sets the name whatever is matched by this condition can be refered as, or null
to make it unreferable
|
void |
setLabel(String label)
Returns the label of this, or null if none (the default)
|
void |
setNameSpace(String nameSpace)
Sets the name of the namespace of this
|
(package private) void |
setParent(CompositeCondition parent)
Called by CompositeCondition.addCondition()
|
protected abstract String |
toInnerString()
All instances of this produces a parseable string output
|
String |
toString() |
protected void |
traceResult(boolean matches,
RuleEvaluation e) |
private CompositeCondition parent
private String label
private String nameSpace
private String contextName
private Condition.Anchor anchor
public Condition()
public Condition(String label)
public void setContextName(String contextName)
public String getContextName()
protected boolean isReferable()
public String getLabel()
public void setLabel(String label)
public String getNameSpace()
public void setNameSpace(String nameSpace)
public CompositeCondition getParent()
void setParent(CompositeCondition parent)
public void setAnchor(Condition.Anchor anchor)
public Condition.Anchor getAnchor()
public final boolean matches(RuleEvaluation e)
Returns whether this condition matches the given evaluation at the current location of the evaluation. Calls the doesMatch method of each condition subtype.
protected boolean matchesStartAnchor(RuleEvaluation e)
protected boolean matchesEndAnchor(RuleEvaluation e)
protected void traceResult(boolean matches, RuleEvaluation e)
protected String getMatchInfoString(RuleEvaluation e)
protected void preMatchHook(RuleEvaluation e)
protected void postMatchHook(RuleEvaluation e)
protected String getMatchInfo(RuleEvaluation e)
protected abstract boolean doesMatch(RuleEvaluation e)
protected boolean hasOpenChoicepoint(RuleEvaluation e)
public void makeReferences(RuleBase rules)
protected String getLabelString()
protected boolean labelMatches(RuleEvaluation e)
protected boolean labelMatches(TermItem evaluationTerm, RuleEvaluation e)
protected abstract String toInnerString()
protected boolean isDefaultContextName()
Copyright © 2018. All rights reserved.