org.drools.rule
Class Pattern

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

public class Pattern
extends java.lang.Object
implements RuleConditionElement

See Also:
Serialized Form

Constructor Summary
Pattern(int index, int offset, ObjectType objectType, java.lang.String identifier)
           
Pattern(int index, int offset, ObjectType objectType, java.lang.String identifier, boolean isInternalFact)
           
Pattern(int index, ObjectType objectType)
           
Pattern(int index, ObjectType objectType, java.lang.String identifier)
           
 
Method Summary
 void addConstraint(Constraint constraint)
           
 Declaration addDeclaration(java.lang.String identifier, Extractor extractor)
           
 java.lang.Object clone()
          Returns a clone from itself
 boolean equals(java.lang.Object object)
           
 java.util.List getConstraints()
           
 Declaration getDeclaration()
           
 int getIndex()
           
 java.util.Map getInnerDeclarations()
          Returns a Map of declarations that are visible inside this conditional element
 java.util.List getNestedElements()
          Returs a list of RuleConditionElement's that are nested inside the current element
 ObjectType getObjectType()
           
 int getOffset()
          The offset of the fact related to this pattern inside the tuple
 java.util.Map getOuterDeclarations()
          Returns a Map of declarations that are visible outside this conditional element.
 PatternSource getSource()
           
 int hashCode()
           
 boolean isBound()
           
 Declaration resolveDeclaration(java.lang.String identifier)
          Resolves the given identifier in the current scope and returns the Declaration object for the declaration.
 void setOffset(int offset)
           
 void setSource(PatternSource source)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pattern

public Pattern(int index,
               ObjectType objectType)

Pattern

public Pattern(int index,
               ObjectType objectType,
               java.lang.String identifier)

Pattern

public Pattern(int index,
               int offset,
               ObjectType objectType,
               java.lang.String identifier)

Pattern

public Pattern(int index,
               int offset,
               ObjectType objectType,
               java.lang.String identifier,
               boolean isInternalFact)
Method Detail

clone

public java.lang.Object clone()
Description copied from interface: RuleConditionElement
Returns a clone from itself

Specified by:
clone in interface RuleConditionElement
Overrides:
clone in class java.lang.Object
Returns:

getObjectType

public ObjectType getObjectType()

getSource

public PatternSource getSource()

setSource

public void setSource(PatternSource source)

getConstraints

public java.util.List getConstraints()

addConstraint

public void addConstraint(Constraint constraint)

addDeclaration

public Declaration addDeclaration(java.lang.String identifier,
                                  Extractor extractor)

isBound

public boolean isBound()

getDeclaration

public Declaration getDeclaration()

getIndex

public int getIndex()

getOffset

public int getOffset()
The offset of the fact related to this pattern inside the tuple

Returns:
the offset

setOffset

public void setOffset(int offset)

getInnerDeclarations

public java.util.Map getInnerDeclarations()
Description copied from interface: RuleConditionElement
Returns a Map of declarations that are visible inside this conditional element

Specified by:
getInnerDeclarations in interface RuleConditionElement
Returns:

getOuterDeclarations

public java.util.Map getOuterDeclarations()
Description copied from interface: RuleConditionElement
Returns a Map of declarations that are visible outside this conditional element.

Specified by:
getOuterDeclarations in interface RuleConditionElement
Returns:

resolveDeclaration

public Declaration resolveDeclaration(java.lang.String identifier)
Description copied from interface: RuleConditionElement
Resolves the given identifier in the current scope and returns the Declaration object for the declaration. Returns null if identifier can not be resolved.

Specified by:
resolveDeclaration in interface RuleConditionElement
Returns:

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

getNestedElements

public java.util.List getNestedElements()
Description copied from interface: RuleConditionElement
Returs a list of RuleConditionElement's that are nested inside the current element

Specified by:
getNestedElements in interface RuleConditionElement
Returns: