org.drools.rule.constraint
Class EvaluatorConstraint

java.lang.Object
  extended by org.drools.rule.MutableTypeConstraint
      extended by org.drools.rule.constraint.EvaluatorConstraint
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, IntervalProviderConstraint, AlphaNodeFieldConstraint, BetaNodeFieldConstraint, Constraint, RuleComponent

public class EvaluatorConstraint
extends MutableTypeConstraint
implements IntervalProviderConstraint

See Also:
Serialized Form

Nested Class Summary
protected static class EvaluatorConstraint.LiteralContextEntry
           
 
Nested classes/interfaces inherited from interface org.drools.spi.Constraint
Constraint.ConstraintType
 
Field Summary
protected  Declaration[] declarations
           
protected  Evaluator evaluator
           
protected  FieldValue field
           
protected  InternalReadAccessor rightReadAccessor
           
 
Constructor Summary
EvaluatorConstraint()
           
EvaluatorConstraint(Declaration[] declarations, Evaluator evaluator, InternalReadAccessor extractor)
           
EvaluatorConstraint(FieldValue field, Evaluator evaluator, InternalReadAccessor extractor)
           
 
Method Summary
 EvaluatorConstraint clone()
          Clones the constraint
 ContextEntry createContextEntry()
           
 Evaluator getEvaluator()
           
 FieldValue getField()
           
 Interval getInterval()
           
 Declaration[] getRequiredDeclarations()
          Returns all the declarations required by the given constraint implementation.
protected  InternalReadAccessor getRightReadAccessor()
           
 boolean isAllowed(InternalFactHandle handle, InternalWorkingMemory workingMemory, ContextEntry context)
           
 boolean isAllowedCachedLeft(ContextEntry context, InternalFactHandle handle)
           
 boolean isAllowedCachedRight(LeftTuple tuple, ContextEntry context)
           
protected  boolean isLiteral()
           
 boolean isSelf()
           
 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 writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.rule.MutableTypeConstraint
getType, setType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.drools.spi.Constraint
getType
 

Field Detail

declarations

protected Declaration[] declarations

evaluator

protected Evaluator evaluator

rightReadAccessor

protected InternalReadAccessor rightReadAccessor

field

protected FieldValue field
Constructor Detail

EvaluatorConstraint

public EvaluatorConstraint()

EvaluatorConstraint

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

EvaluatorConstraint

public EvaluatorConstraint(Declaration[] declarations,
                           Evaluator evaluator,
                           InternalReadAccessor extractor)
Method Detail

isLiteral

protected boolean isLiteral()

isAllowed

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

isAllowedCachedLeft

public boolean isAllowedCachedLeft(ContextEntry context,
                                   InternalFactHandle handle)
Specified by:
isAllowedCachedLeft in interface BetaNodeFieldConstraint

isAllowedCachedRight

public boolean isAllowedCachedRight(LeftTuple tuple,
                                    ContextEntry context)
Specified by:
isAllowedCachedRight in interface BetaNodeFieldConstraint

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

getRequiredDeclarations

public Declaration[] getRequiredDeclarations()
Description copied from interface: Constraint
Returns all the declarations required by the given constraint implementation.

Specified by:
getRequiredDeclarations 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:

getInterval

public Interval getInterval()
Specified by:
getInterval in interface IntervalProviderConstraint

getEvaluator

public Evaluator getEvaluator()

isSelf

public boolean isSelf()

getField

public FieldValue getField()

getRightReadAccessor

protected InternalReadAccessor getRightReadAccessor()

clone

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

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

createContextEntry

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

writeExternal

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

readExternal

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


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