Package org.drools.core.common
Class TupleStartEqualsConstraint
- java.lang.Object
-
- org.drools.core.common.TupleStartEqualsConstraint
-
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,BetaNodeFieldConstraint,Constraint,RuleComponent
public class TupleStartEqualsConstraint extends Object implements BetaNodeFieldConstraint
Checks if one tuple is the start subtuple of other tuple. For instance, if we have two tuples: T1 = [ a, b, c ] T2 = [ a, b, c, d, e] This constraint will evaluate to true as T1 is the starting subtuple of T2. On the other hand, if we have: T1 = [ a, c, b ] T2 = [ a, b, c, d, e ] This constraint will evaluate to false, as T1 is not the starting subtuple of T2. Besides having the same elements, the order is different. This constraint is used when joining subnetworks back into the main network.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTupleStartEqualsConstraint.TupleStartEqualsConstraintContextEntry-
Nested classes/interfaces inherited from interface org.drools.core.spi.Constraint
Constraint.ConstraintType
-
-
Constructor Summary
Constructors Constructor Description TupleStartEqualsConstraint()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TupleStartEqualsConstraintclone()Clones the constraintBetaNodeFieldConstraintcloneIfInUse()Clone this constraints only if it is already used by a different node, otherwise returns thisContextEntrycreateContextEntry()booleanequals(Object object)static TupleStartEqualsConstraintgetInstance()Declaration[]getRequiredDeclarations()Returns all the declarations required by the given constraint implementation.Constraint.ConstraintTypegetType()Returns the type of the constraint, either ALPHA, BETA or UNKNOWNinthashCode()booleanisAllowedCachedLeft(ContextEntry context, InternalFactHandle handle)booleanisAllowedCachedRight(Tuple tuple, ContextEntry context)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.StringtoString()voidwriteExternal(ObjectOutput out)-
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
-
-
-
-
Method Detail
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
getInstance
public static TupleStartEqualsConstraint getInstance()
-
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
-
isTemporal
public boolean isTemporal()
Description copied from interface:ConstraintReturns true in case this constraint is a temporal constraint- Specified by:
isTemporalin interfaceConstraint- Returns:
-
createContextEntry
public ContextEntry createContextEntry()
- Specified by:
createContextEntryin interfaceBetaNodeFieldConstraint
-
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 TupleStartEqualsConstraint clone()
Description copied from interface:ConstraintClones the constraint- Specified by:
clonein interfaceConstraint- Overrides:
clonein classObject- Returns:
-
getType
public Constraint.ConstraintType getType()
Description copied from interface:ConstraintReturns the type of the constraint, either ALPHA, BETA or UNKNOWN- Specified by:
getTypein interfaceConstraint- Returns:
-
cloneIfInUse
public BetaNodeFieldConstraint cloneIfInUse()
Description copied from interface:BetaNodeFieldConstraintClone this constraints only if it is already used by a different node, otherwise returns this- Specified by:
cloneIfInUsein interfaceBetaNodeFieldConstraint
-
-