Package org.drools.core.rule
Class PredicateConstraint
- java.lang.Object
-
- org.drools.core.rule.MutableTypeConstraint
-
- org.drools.core.rule.PredicateConstraint
-
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,AlphaNodeFieldConstraint,BetaNodeFieldConstraint,Constraint,Restriction,RuleComponent,Wireable
public class PredicateConstraint extends MutableTypeConstraint implements Restriction, Wireable, 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.spi.Constraint
Constraint.ConstraintType
-
Nested classes/interfaces inherited from interface org.drools.core.spi.Wireable
Wireable.Immutable
-
-
Constructor Summary
Constructors Constructor Description PredicateConstraint()PredicateConstraint(Declaration[] previousDeclarations, Declaration[] localDeclarations)PredicateConstraint(PredicateExpression evaluator)PredicateConstraint(PredicateExpression expression, Declaration[] previousDeclarations, Declaration[] localDeclarations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PredicateConstraintclone()Clones the constraintContextEntrycreateContextEntry()booleanequals(Object object)EvaluatorgetEvaluator()PredicateExpressiongetPredicateExpression()Declaration[]getRequiredDeclarations()Returns all the declarations required by the given constraint implementation.inthashCode()booleanisAllowed(InternalFactHandle handle, InternalWorkingMemory workingMemory)booleanisAllowed(InternalReadAccessor extractor, InternalFactHandle handle, InternalWorkingMemory workingMemory, ContextEntry context)booleanisAllowedCachedLeft(ContextEntry context, InternalFactHandle handle)booleanisAllowedCachedRight(Tuple tuple, ContextEntry context)booleanisTemporal()Returns true if this is a temporal restrictionvoidreadExternal(ObjectInput in)voidreplaceDeclaration(Declaration oldDecl, Declaration newDecl)A restriction may be required to replace an old declaration object by a new updated onevoidsetPredicateExpression(PredicateExpression expression)StringtoString()voidwire(Object object)voidwriteExternal(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.spi.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(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Overrides:
readExternalin classMutableTypeConstraint- Throws:
IOExceptionClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Overrides:
writeExternalin classMutableTypeConstraint- Throws:
IOException
-
getRequiredDeclarations
public Declaration[] getRequiredDeclarations()
Description copied from interface:ConstraintReturns all the declarations required by the given constraint implementation.- Specified by:
getRequiredDeclarationsin interfaceConstraint- Specified by:
getRequiredDeclarationsin interfaceRestriction- Returns:
-
replaceDeclaration
public void replaceDeclaration(Declaration oldDecl, Declaration newDecl)
Description copied from interface:RestrictionA restriction may be required to replace an old declaration object by a new updated one- Specified by:
replaceDeclarationin interfaceConstraint- Specified by:
replaceDeclarationin interfaceRestriction
-
setPredicateExpression
public void setPredicateExpression(PredicateExpression expression)
-
getPredicateExpression
public PredicateExpression getPredicateExpression()
-
isTemporal
public boolean isTemporal()
Description copied from interface:RestrictionReturns true if this is a temporal restriction- Specified by:
isTemporalin interfaceConstraint- Specified by:
isTemporalin interfaceRestriction- Returns:
-
createContextEntry
public ContextEntry createContextEntry()
- Specified by:
createContextEntryin interfaceBetaNodeFieldConstraint- Specified by:
createContextEntryin interfaceRestriction
-
isAllowed
public boolean isAllowed(InternalFactHandle handle, InternalWorkingMemory workingMemory)
- Specified by:
isAllowedin interfaceAlphaNodeFieldConstraint
-
isAllowed
public boolean isAllowed(InternalReadAccessor extractor, InternalFactHandle handle, InternalWorkingMemory workingMemory, ContextEntry context)
- Specified by:
isAllowedin interfaceRestriction
-
isAllowedCachedLeft
public boolean isAllowedCachedLeft(ContextEntry context, InternalFactHandle handle)
- Specified by:
isAllowedCachedLeftin interfaceBetaNodeFieldConstraint- Specified by:
isAllowedCachedLeftin interfaceRestriction
-
isAllowedCachedRight
public boolean isAllowedCachedRight(Tuple tuple, ContextEntry context)
- Specified by:
isAllowedCachedRightin interfaceBetaNodeFieldConstraint- Specified by:
isAllowedCachedRightin interfaceRestriction
-
clone
public PredicateConstraint clone()
Description copied from interface:ConstraintClones the constraint- Specified by:
clonein interfaceConstraint- Specified by:
clonein interfaceRestriction- Specified by:
clonein classMutableTypeConstraint- Returns:
-
getEvaluator
public Evaluator getEvaluator()
- Specified by:
getEvaluatorin interfaceRestriction
-
-