org.drools.rule
Class LiteralConstraint

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

public class LiteralConstraint
extends java.lang.Object
implements AlphaNodeFieldConstraint

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.drools.spi.Constraint
Constraint.ConstraintType
 
Constructor Summary
LiteralConstraint(FieldExtractor extractor, Evaluator evaluator, FieldValue field)
           
LiteralConstraint(FieldExtractor extractor, LiteralRestriction restriction)
           
 
Method Summary
 java.lang.Object clone()
          Clones the constraint
 ContextEntry createContextEntry()
           
 boolean equals(java.lang.Object object)
           
 Evaluator getEvaluator()
           
 FieldValue getField()
           
 FieldExtractor 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(java.lang.Object object, InternalWorkingMemory workingMemory, ContextEntry ctx)
           
 void replaceDeclaration(Declaration oldDecl, Declaration newDecl)
          A constraint may be required to replace an old declaration object by a new updated one
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LiteralConstraint

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

LiteralConstraint

public LiteralConstraint(FieldExtractor extractor,
                         LiteralRestriction restriction)
Method Detail

getEvaluator

public Evaluator getEvaluator()

getField

public FieldValue getField()

getFieldExtractor

public FieldExtractor 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
A constraint may be required to replace an old declaration object by a new updated one

Specified by:
replaceDeclaration in interface Constraint

isAllowed

public boolean isAllowed(java.lang.Object object,
                         InternalWorkingMemory workingMemory,
                         ContextEntry ctx)
Specified by:
isAllowed in interface AlphaNodeFieldConstraint

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

clone

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

Specified by:
clone in interface Constraint
Overrides:
clone in class java.lang.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: