Package org.drools.core.rule
Class AbstractCompositeConstraint
- java.lang.Object
-
- org.drools.core.rule.MutableTypeConstraint
-
- org.drools.core.rule.AbstractCompositeConstraint
-
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,AlphaNodeFieldConstraint,BetaNodeFieldConstraint,Constraint,RuleComponent
public abstract class AbstractCompositeConstraint extends MutableTypeConstraint
A superclass for all composite constraints, like "OR" and "AND"- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractCompositeConstraint.MultiFieldConstraintContextEntryA context entry for composite restrictions-
Nested classes/interfaces inherited from interface org.drools.core.spi.Constraint
Constraint.ConstraintType
-
-
Field Summary
Fields Modifier and Type Field Description protected AlphaNodeFieldConstraint[]alphaConstraintsprotected BetaNodeFieldConstraint[]betaConstraintsprotected Declaration[]requiredDeclarations
-
Constructor Summary
Constructors Constructor Description AbstractCompositeConstraint()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddAlphaConstraint(AlphaNodeFieldConstraint constraint)Adds an alpha constraint to the multi field OR constraintvoidaddBetaConstraint(BetaNodeFieldConstraint constraint)Adds a beta constraint to this multi field OR constraintvoidaddConstraint(Constraint constraint)Adds a constraint too all lists it belongs to by checking for its typeabstract AbstractCompositeConstraintclone()Clones the constraintContextEntrycreateContextEntry()booleanequals(Object object)AlphaNodeFieldConstraint[]getAlphaConstraints()BetaNodeFieldConstraint[]getBetaConstraints()Declaration[]getRequiredDeclarations()Returns all the declarations required by the given constraint implementation.inthashCode()booleanisTemporal()Returns true in case this constraint is a temporal constraintvoidreadExternal(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.protected voidupdateRequiredDeclarations(Constraint constraint)Updades the cached required declaration arrayvoidwriteExternal(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, toString, wait, wait, wait
-
Methods inherited from interface org.drools.core.spi.AlphaNodeFieldConstraint
isAllowed
-
Methods inherited from interface org.drools.core.spi.BetaNodeFieldConstraint
isAllowedCachedLeft, isAllowedCachedRight
-
Methods inherited from interface org.drools.core.spi.Constraint
addPackageNames, equals, getListenedPropertyMask, getPackageNames, mergeEvaluationContext, registerEvaluationContext
-
-
-
-
Field Detail
-
alphaConstraints
protected AlphaNodeFieldConstraint[] alphaConstraints
-
betaConstraints
protected BetaNodeFieldConstraint[] betaConstraints
-
requiredDeclarations
protected Declaration[] requiredDeclarations
-
-
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
-
getAlphaConstraints
public AlphaNodeFieldConstraint[] getAlphaConstraints()
-
getBetaConstraints
public BetaNodeFieldConstraint[] getBetaConstraints()
-
isTemporal
public boolean isTemporal()
Description copied from interface:ConstraintReturns true in case this constraint is a temporal constraint- Returns:
-
addAlphaConstraint
public void addAlphaConstraint(AlphaNodeFieldConstraint constraint)
Adds an alpha constraint to the multi field OR constraint- Parameters:
constraint-
-
addBetaConstraint
public void addBetaConstraint(BetaNodeFieldConstraint constraint)
Adds a beta constraint to this multi field OR constraint- Parameters:
constraint-
-
addConstraint
public void addConstraint(Constraint constraint)
Adds a constraint too all lists it belongs to by checking for its type- Parameters:
constraint-
-
updateRequiredDeclarations
protected void updateRequiredDeclarations(Constraint constraint)
Updades the cached required declaration array- Parameters:
constraint-
-
getRequiredDeclarations
public Declaration[] getRequiredDeclarations()
Returns all the declarations required by the given constraint implementation.- Returns:
-
replaceDeclaration
public void replaceDeclaration(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. Since this is done at ReteOO build type, when constraints were already created, eventually some constraints need to update their references to the declarations.
-
createContextEntry
public ContextEntry createContextEntry()
-
clone
public abstract AbstractCompositeConstraint clone()
Description copied from interface:ConstraintClones the constraint- Specified by:
clonein interfaceConstraint- Specified by:
clonein classMutableTypeConstraint- Returns:
-
-