@PersistantProperty(property="operator") @PersistantProperty(property="conditions",alias="condition") public class MConditionSet extends AbstractCondition implements Iterable<ICondition>
ICondition
implementation allowing to combine sub-ICondition
s evaluation results
and do more complex testings.Modifier and Type | Field and Description |
---|---|
static String |
CONDSET_ID |
Constructor and Description |
---|
MConditionSet() |
MConditionSet(boolean not,
ILogicalOperator operator,
List<ICondition> conditions) |
MConditionSet(ILogicalOperator operator,
List<ICondition> conditions)
not defaults to false.
|
Modifier and Type | Method and Description |
---|---|
MConditionSet |
clone()
Clones the Addon.
|
ICondition |
combine(ILogicalOperator otherOperator,
ICondition otherCondition)
Combines the current condition set with the other condition using the other operator.
|
void |
compile(ICompilationContext ctxt)
Checks presence of operator and conditions.
|
List<ICondition> |
getConditions() |
CostInfo |
getEstimatedCost(ICompilationContext ctxt)
Estimates the condition complexity, to allow callers to optimize calls.
|
String |
getImplementationId()
Unique addon implementation ID.
|
ILogicalOperator |
getOperator() |
protected ConditionEquivalence |
internalIsEquivalent(ICondition o)
Called by
AbstractCondition.internalIsEquivalent(ICondition) if the other condition is not an instance of MConditionNot . |
boolean |
isCacheUsed()
Returns false by default.
|
boolean |
isConstantValue()
Tells if this condition returns a constant result for all executions.
|
Iterator<ICondition> |
iterator() |
void |
optimize(ICompilationContext ctxt)
Optimizes conditions order inside this set, depending on their estimated cost, except
if operator prevents it.
|
protected boolean |
pEquals(AbstractCondition o)
Tests equality on other parameters than "not".
|
protected boolean |
pEvaluate(IExecutionContext ctxt) |
protected int |
pHashCode()
Computes hashCode on other parameters than "not".
|
protected void |
pToString(OuterWithLevel outer)
Finishes toString output.
|
void |
setConditions(List<ICondition> conditions) |
void |
setOperator(ILogicalOperator operator) |
combineToNewSet, equals, evaluate, hashCode, isEquivalent, isNot, isShouldBeWrappedToConstantValue, setNot, toString
getInternalCacheIdentifier, isInternalCacheIdentifierNeeded, resetCachedData, setInternalCacheIdentifier, toString, wasRegistered
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
getInternalCacheIdentifier, isInternalCacheIdentifierNeeded, resetCachedData, setInternalCacheIdentifier, wasRegistered
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
public static final String CONDSET_ID
public MConditionSet()
public MConditionSet(ILogicalOperator operator, List<ICondition> conditions)
public MConditionSet(boolean not, ILogicalOperator operator, List<ICondition> conditions)
public void compile(ICompilationContext ctxt) throws MRuleValidationException
compile
in interface ICondition
MRuleValidationException
- if validation problem detected.ICondition.compile(ICompilationContext)
public void optimize(ICompilationContext ctxt) throws MRuleValidationException
optimize
in interface IAddon
optimize
in class AbstractAddon
MRuleValidationException
public CostInfo getEstimatedCost(ICompilationContext ctxt) throws MRuleValidationException
ICondition
getEstimatedCost
in interface ICondition
MRuleValidationException
- if validation problem detected.public boolean isConstantValue()
ICondition
isConstantValue
in interface ICondition
protected boolean pEvaluate(IExecutionContext ctxt) throws MConditionEvaluationException
pEvaluate
in class AbstractCondition
MConditionEvaluationException
ICondition.evaluate(IExecutionContext)
public String getImplementationId()
IAddon
getImplementationId
in interface IAddon
public boolean isCacheUsed()
AbstractAddon
isCacheUsed
in interface IAddon
isCacheUsed
in class AbstractAddon
protected ConditionEquivalence internalIsEquivalent(ICondition o)
AbstractCondition
AbstractCondition.internalIsEquivalent(ICondition)
if the other condition is not an instance of MConditionNot
.internalIsEquivalent
in class AbstractCondition
public ICondition combine(ILogicalOperator otherOperator, ICondition otherCondition)
combine
in interface ICondition
combine
in class AbstractCondition
otherCondition
- condition to combine withotherOperator
- operator to be usedprotected void pToString(OuterWithLevel outer) throws IOException
AbstractCondition
pToString
in class AbstractCondition
IOException
public MConditionSet clone()
IAddon
clone
in interface IAddon
clone
in interface IMRulesObject
clone
in interface ICondition
clone
in class AbstractCondition
protected boolean pEquals(AbstractCondition o)
AbstractCondition
pEquals
in class AbstractCondition
protected int pHashCode()
AbstractCondition
pHashCode
in class AbstractCondition
public Iterator<ICondition> iterator()
iterator
in interface Iterable<ICondition>
public ILogicalOperator getOperator()
public void setOperator(ILogicalOperator operator)
public List<ICondition> getConditions()
public void setConditions(List<ICondition> conditions)