org.drools.rule
Class Declaration

java.lang.Object
  extended by org.drools.rule.Declaration
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Declaration
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Author:
Mark Proctor, Bob McWhirter, Simon Harris
See Also:
Serialized Form

Constructor Summary
Declaration(java.lang.String identifier, Extractor extractor, Pattern pattern)
          Construct.
Declaration(java.lang.String identifier, Extractor extractor, Pattern pattern, boolean internalFact)
          Construct.
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object object)
           
 boolean getBooleanValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 byte getByteValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 char getCharValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 double getDoubleValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 Extractor getExtractor()
          Returns the Extractor expression
 float getFloatValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 int getHashCode(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 java.lang.String getIdentifier()
          Retrieve the variable's identifier.
 int getIntValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 long getLongValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 java.lang.reflect.Method getNativeReadMethod()
           
 java.lang.Object getNonShadowedValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 Pattern getPattern()
          Returns the index of the pattern
 short getShortValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 java.lang.Object getValue(InternalWorkingMemory workingMemory, java.lang.Object object)
           
 ValueType getValueType()
          Retrieve the ValueType.
 int hashCode()
           
 boolean isGlobal()
           
protected  boolean isInternalFact()
           
 boolean isPatternDeclaration()
          Returns true if this declaration is a pattern declaration
 void setPattern(Pattern pattern)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Declaration

public Declaration(java.lang.String identifier,
                   Extractor extractor,
                   Pattern pattern)
Construct.

Parameters:
identifier - The name of the variable.
objectType - The type of this variable declaration.
order - The index within a rule.

Declaration

public Declaration(java.lang.String identifier,
                   Extractor extractor,
                   Pattern pattern,
                   boolean internalFact)
Construct.

Parameters:
identifier - The name of the variable.
objectType - The type of this variable declaration.
order - The index within a rule.
internalFact - True if this is an internal fact created by the engine, like a collection result of a collect CE
Method Detail

getIdentifier

public java.lang.String getIdentifier()
Retrieve the variable's identifier.

Returns:
The variable's identifier.

getValueType

public ValueType getValueType()
Retrieve the ValueType.

Returns:
The ValueType.

getPattern

public Pattern getPattern()
Returns the index of the pattern

Returns:
the pattern

setPattern

public void setPattern(Pattern pattern)

isPatternDeclaration

public boolean isPatternDeclaration()
Returns true if this declaration is a pattern declaration

Returns:

getExtractor

public Extractor getExtractor()
Returns the Extractor expression

Returns:

getValue

public java.lang.Object getValue(InternalWorkingMemory workingMemory,
                                 java.lang.Object object)

getNonShadowedValue

public java.lang.Object getNonShadowedValue(InternalWorkingMemory workingMemory,
                                            java.lang.Object object)

getCharValue

public char getCharValue(InternalWorkingMemory workingMemory,
                         java.lang.Object object)

getIntValue

public int getIntValue(InternalWorkingMemory workingMemory,
                       java.lang.Object object)

getByteValue

public byte getByteValue(InternalWorkingMemory workingMemory,
                         java.lang.Object object)

getShortValue

public short getShortValue(InternalWorkingMemory workingMemory,
                           java.lang.Object object)

getLongValue

public long getLongValue(InternalWorkingMemory workingMemory,
                         java.lang.Object object)

getFloatValue

public float getFloatValue(InternalWorkingMemory workingMemory,
                           java.lang.Object object)

getDoubleValue

public double getDoubleValue(InternalWorkingMemory workingMemory,
                             java.lang.Object object)

getBooleanValue

public boolean getBooleanValue(InternalWorkingMemory workingMemory,
                               java.lang.Object object)

getHashCode

public int getHashCode(InternalWorkingMemory workingMemory,
                       java.lang.Object object)

isGlobal

public boolean isGlobal()

getNativeReadMethod

public java.lang.reflect.Method getNativeReadMethod()

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

isInternalFact

protected boolean isInternalFact()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object