org.drools.rule
Class AbstractCompositeConstraint

java.lang.Object
  extended by org.drools.rule.MutableTypeConstraint
      extended by org.drools.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
protected static class AbstractCompositeConstraint.MultiFieldConstraintContextEntry
          A context entry for composite restrictions
 
Nested classes/interfaces inherited from interface org.drools.spi.Constraint
Constraint.ConstraintType
 
Field Summary
protected  AlphaNodeFieldConstraint[] alphaConstraints
           
protected  BetaNodeFieldConstraint[] betaConstraints
           
protected  Declaration[] requiredDeclarations
           
 
Constructor Summary
AbstractCompositeConstraint()
           
 
Method Summary
 void addAlphaConstraint(AlphaNodeFieldConstraint constraint)
          Adds an alpha constraint to the multi field OR constraint
 void addBetaConstraint(BetaNodeFieldConstraint constraint)
          Adds a beta constraint to this multi field OR constraint
 void addConstraint(Constraint constraint)
          Adds a constraint too all lists it belongs to by checking for its type
abstract  Object clone()
          Clones the constraint
 ContextEntry createContextEntry()
          
 boolean equals(Object object)
           
 AlphaNodeFieldConstraint[] getAlphaConstraints()
           
 BetaNodeFieldConstraint[] getBetaConstraints()
           
 Declaration[] getRequiredDeclarations()
          Returns all the declarations required by the given constraint implementation.
 int hashCode()
           
 boolean isTemporal()
          Returns true in case this constraint is a temporal constraint
 void readExternal(ObjectInput in)
           
 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.
protected  void updateRequiredDeclarations(Constraint constraint)
          Updades the cached required declaration array
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.rule.MutableTypeConstraint
getType, setType
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.drools.spi.AlphaNodeFieldConstraint
isAllowed
 
Methods inherited from interface org.drools.spi.BetaNodeFieldConstraint
isAllowedCachedLeft, isAllowedCachedRight
 

Field Detail

alphaConstraints

protected AlphaNodeFieldConstraint[] alphaConstraints

betaConstraints

protected BetaNodeFieldConstraint[] betaConstraints

requiredDeclarations

protected Declaration[] requiredDeclarations
Constructor Detail

AbstractCompositeConstraint

public AbstractCompositeConstraint()
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class MutableTypeConstraint
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class MutableTypeConstraint
Throws:
IOException

getAlphaConstraints

public AlphaNodeFieldConstraint[] getAlphaConstraints()

getBetaConstraints

public BetaNodeFieldConstraint[] getBetaConstraints()

isTemporal

public boolean isTemporal()
Description copied from interface: Constraint
Returns 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()


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object

clone

public abstract Object clone()
Description copied from interface: Constraint
Clones the constraint

Specified by:
clone in interface Constraint
Specified by:
clone in class MutableTypeConstraint
Returns:


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.