org.drools.rule
Class Pattern

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

public class Pattern
extends Object
implements RuleConditionElement, AcceptsClassObjectType, Externalizable

See Also:
Serialized Form

Constructor Summary
Pattern()
           
Pattern(int index, int offset, ObjectType objectType, String identifier)
           
Pattern(int index, int offset, ObjectType objectType, String identifier, boolean isInternalFact)
           
Pattern(int index, ObjectType objectType)
           
Pattern(int index, ObjectType objectType, String identifier)
           
 
Method Summary
 void addBehavior(Behavior behavior)
           
 void addConstraint(Constraint constraint)
           
 void addDeclaration(Declaration decl)
           
 Declaration addDeclaration(String identifier)
           
 Object clone()
          Returns a clone from itself
 boolean equals(Object object)
           
 List<Behavior> getBehaviors()
           
 List getConstraints()
           
 Declaration getDeclaration()
           
 int getIndex()
           
 Map<String,Declaration> getInnerDeclarations()
          Returns a Map of declarations that are visible inside this conditional element
 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
 Map<String,Declaration> getOuterDeclarations()
          Returns a Map of declarations that are visible outside this conditional element.
 Declaration[] getRequiredDeclarations()
           
 PatternSource getSource()
           
 int hashCode()
           
 boolean isBound()
           
 boolean isPatternScopeDelimiter()
          Returns true in case this RuleConditionElement delimits a pattern visibility scope.
 void readExternal(ObjectInput in)
           
 Declaration resolveDeclaration(String identifier)
          Resolves the given identifier in the current scope and returns the Declaration object for the declaration.
 void setBehaviors(List<Behavior> behaviors)
           
 void setClassObjectType(ClassObjectType objectType)
           
 void setObjectType(ObjectType objectType)
           
 void setOffset(int offset)
           
 void setSource(PatternSource source)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pattern

public Pattern()

Pattern

public Pattern(int index,
               ObjectType objectType)

Pattern

public Pattern(int index,
               ObjectType objectType,
               String identifier)

Pattern

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

Pattern

public Pattern(int index,
               int offset,
               ObjectType objectType,
               String identifier,
               boolean isInternalFact)
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

setClassObjectType

public void setClassObjectType(ClassObjectType objectType)
Specified by:
setClassObjectType in interface AcceptsClassObjectType

getRequiredDeclarations

public Declaration[] getRequiredDeclarations()

clone

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

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

getObjectType

public ObjectType getObjectType()

setObjectType

public void setObjectType(ObjectType objectType)

getSource

public PatternSource getSource()

setSource

public void setSource(PatternSource source)

getConstraints

public List getConstraints()

addConstraint

public void addConstraint(Constraint constraint)

addDeclaration

public Declaration addDeclaration(String identifier)

addDeclaration

public void addDeclaration(Declaration decl)

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 Map<String,Declaration> 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 Map<String,Declaration> 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(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 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

getNestedElements

public 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:

isPatternScopeDelimiter

public boolean isPatternScopeDelimiter()
Description copied from interface: RuleConditionElement
Returns true in case this RuleConditionElement delimits a pattern visibility scope. For instance, AND CE is not a scope delimiter, while NOT CE is a scope delimiter

Specified by:
isPatternScopeDelimiter in interface RuleConditionElement
Returns:

getBehaviors

public List<Behavior> getBehaviors()
Returns:
the behaviors

setBehaviors

public void setBehaviors(List<Behavior> behaviors)
Parameters:
behaviors - the behaviors to set

addBehavior

public void addBehavior(Behavior behavior)


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