org.drools.rule
Class LiteralConstraint

java.lang.Object
  extended by org.drools.rule.LiteralConstraint
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Acceptor, AcceptsReadAccessor, AlphaNodeFieldConstraint, Constraint, RuleComponent

public class LiteralConstraint
extends Object
implements AlphaNodeFieldConstraint, AcceptsReadAccessor, Externalizable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.drools.spi.Constraint
Constraint.ConstraintType
 
Constructor Summary
LiteralConstraint()
           
LiteralConstraint(InternalReadAccessor extractor, Evaluator evaluator, FieldValue field)
           
LiteralConstraint(InternalReadAccessor extractor, LiteralRestriction restriction)
           
 
Method Summary
 Object clone()
          Clones the constraint
 ContextEntry createContextEntry()
           
 boolean equals(Object object)
           
 Evaluator getEvaluator()
           
 FieldValue getField()
           
 InternalReadAccessor getFieldExtractor()
           
 Declaration[] getRequiredDeclarations()
          Literal constraints cannot have required declarations, so always return an empty array.
 Constraint.ConstraintType getType()
          Returns the type of the constraint, either ALPHA, BETA or UNKNOWN
 int hashCode()
           
 boolean isAllowed(InternalFactHandle handle, InternalWorkingMemory workingMemory, ContextEntry ctx)
           
 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.
 void setReadAccessor(InternalReadAccessor readAccessor)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LiteralConstraint

public LiteralConstraint()

LiteralConstraint

public LiteralConstraint(InternalReadAccessor extractor,
                         Evaluator evaluator,
                         FieldValue field)

LiteralConstraint

public LiteralConstraint(InternalReadAccessor extractor,
                         LiteralRestriction restriction)
Method Detail

readExternal

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

writeExternal

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

setReadAccessor

public void setReadAccessor(InternalReadAccessor readAccessor)
Specified by:
setReadAccessor in interface AcceptsReadAccessor

getEvaluator

public Evaluator getEvaluator()

getField

public FieldValue getField()

getFieldExtractor

public InternalReadAccessor getFieldExtractor()

getRequiredDeclarations

public Declaration[] getRequiredDeclarations()
Literal constraints cannot have required declarations, so always return an empty array.

Specified by:
getRequiredDeclarations in interface Constraint
Returns:
Return an empty Declaration[]

replaceDeclaration

public void replaceDeclaration(Declaration oldDecl,
                               Declaration newDecl)
Description copied from interface: Constraint
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.

Specified by:
replaceDeclaration in interface Constraint

isAllowed

public boolean isAllowed(InternalFactHandle handle,
                         InternalWorkingMemory workingMemory,
                         ContextEntry ctx)
Specified by:
isAllowed in interface AlphaNodeFieldConstraint

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

clone

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

Specified by:
clone in interface Constraint
Overrides:
clone in class Object
Returns:

createContextEntry

public ContextEntry createContextEntry()
Specified by:
createContextEntry in interface AlphaNodeFieldConstraint

getType

public Constraint.ConstraintType getType()
Description copied from interface: Constraint
Returns the type of the constraint, either ALPHA, BETA or UNKNOWN

Specified by:
getType in interface Constraint
Returns:

isTemporal

public boolean isTemporal()
Description copied from interface: Constraint
Returns true in case this constraint is a temporal constraint

Specified by:
isTemporal in interface Constraint
Returns:


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