Package org.drools.core.rule
Class PredicateConstraint
- java.lang.Object
-
- org.drools.core.rule.MutableTypeConstraint
-
- org.drools.core.rule.PredicateConstraint
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,Wireable,AlphaNodeFieldConstraint,BetaNodeFieldConstraint,Constraint,RuleComponent
public class PredicateConstraint extends MutableTypeConstraint implements Wireable, java.io.Externalizable
A predicate can be written as a top level constraint or be nested inside inside a field constraint (and as so, must implement the Restriction interface).- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPredicateConstraint.PredicateContextEntry-
Nested classes/interfaces inherited from interface org.drools.core.rule.constraint.Constraint
Constraint.ConstraintType
-
Nested classes/interfaces inherited from interface org.drools.core.rule.accessor.Wireable
Wireable.Immutable
-
-
Constructor Summary
Constructors Constructor Description PredicateConstraint()PredicateConstraint(PredicateExpression evaluator)PredicateConstraint(PredicateExpression expression, Declaration[] previousDeclarations, Declaration[] localDeclarations)PredicateConstraint(Declaration[] previousDeclarations, Declaration[] localDeclarations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PredicateConstraintclone()Clones the constraintContextEntrycreateContextEntry()booleanequals(java.lang.Object object)EvaluatorgetEvaluator()PredicateExpressiongetPredicateExpression()Declaration[]getRequiredDeclarations()Returns all the declarations required by the given constraint implementation.inthashCode()booleanisAllowed(InternalFactHandle handle, ReteEvaluator reteEvaluator)booleanisAllowed(ReadAccessor extractor, InternalFactHandle handle, ReteEvaluator reteEvaluator, ContextEntry context)booleanisAllowedCachedLeft(ContextEntry context, InternalFactHandle handle)booleanisAllowedCachedRight(Tuple tuple, ContextEntry context)booleanisTemporal()Returns true in case this constraint is a temporal constraintvoidreadExternal(java.io.ObjectInput in)voidreplaceDeclaration(Declaration oldDecl, Declaration newDecl)When a rule contains multiple logical branches, i.e., makes use of 'OR' CE, it is required to clone patterns and declarations for each logical branch.voidsetPredicateExpression(PredicateExpression expression)java.lang.StringtoString()voidwire(java.lang.Object object)voidwriteExternal(java.io.ObjectOutput out)-
Methods inherited from class org.drools.core.rule.MutableTypeConstraint
cloneIfInUse, getType, setInUse, setType
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drools.core.rule.constraint.Constraint
addPackageNames, equals, getListenedPropertyMask, getPackageNames, mergeEvaluationContext, registerEvaluationContext
-
-
-
-
Constructor Detail
-
PredicateConstraint
public PredicateConstraint()
-
PredicateConstraint
public PredicateConstraint(PredicateExpression evaluator)
-
PredicateConstraint
public PredicateConstraint(Declaration[] previousDeclarations, Declaration[] localDeclarations)
-
PredicateConstraint
public PredicateConstraint(PredicateExpression expression, Declaration[] previousDeclarations, Declaration[] localDeclarations)
-
-
Method Detail
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Overrides:
readExternalin classMutableTypeConstraint- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Overrides:
writeExternalin classMutableTypeConstraint- Throws:
java.io.IOException
-
getRequiredDeclarations
public Declaration[] getRequiredDeclarations()
Description copied from interface:ConstraintReturns all the declarations required by the given constraint implementation.- Specified by:
getRequiredDeclarationsin interfaceConstraint- Returns:
-
replaceDeclaration
public void replaceDeclaration(Declaration oldDecl, Declaration newDecl)
Description copied from interface:ConstraintWhen a rule contains multiple logical branches, i.e., makes use of 'OR' CE, it is required to clone patterns and declarations for each logical branch. Since this is done at ReteOO build type, when constraints were already created, eventually some constraints need to update their references to the declarations.- Specified by:
replaceDeclarationin interfaceConstraint
-
setPredicateExpression
public void setPredicateExpression(PredicateExpression expression)
-
getPredicateExpression
public PredicateExpression getPredicateExpression()
-
isTemporal
public boolean isTemporal()
Description copied from interface:ConstraintReturns true in case this constraint is a temporal constraint- Specified by:
isTemporalin interfaceConstraint- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
createContextEntry
public ContextEntry createContextEntry()
- Specified by:
createContextEntryin interfaceBetaNodeFieldConstraint
-
isAllowed
public boolean isAllowed(InternalFactHandle handle, ReteEvaluator reteEvaluator)
- Specified by:
isAllowedin interfaceAlphaNodeFieldConstraint
-
isAllowed
public boolean isAllowed(ReadAccessor extractor, InternalFactHandle handle, ReteEvaluator reteEvaluator, ContextEntry context)
-
isAllowedCachedLeft
public boolean isAllowedCachedLeft(ContextEntry context, InternalFactHandle handle)
- Specified by:
isAllowedCachedLeftin interfaceBetaNodeFieldConstraint
-
isAllowedCachedRight
public boolean isAllowedCachedRight(Tuple tuple, ContextEntry context)
- Specified by:
isAllowedCachedRightin interfaceBetaNodeFieldConstraint
-
clone
public PredicateConstraint clone()
Description copied from interface:ConstraintClones the constraint- Specified by:
clonein interfaceConstraint- Specified by:
clonein classMutableTypeConstraint- Returns:
-
getEvaluator
public Evaluator getEvaluator()
-
-