Class Pattern

java.lang.Object
org.drools.base.rule.Pattern
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, AcceptsClassObjectType, RuleComponent, RuleConditionElement
Direct Known Subclasses:
XpathBackReference.RelativePattern

public class Pattern extends Object implements RuleConditionElement, AcceptsClassObjectType, Externalizable
See Also:
  • Constructor Details

    • Pattern

      public Pattern()
    • Pattern

      public Pattern(int patternId, ObjectType objectType)
    • Pattern

      public Pattern(int patternId, ObjectType objectType, String identifier)
    • Pattern

      public Pattern(int patternId, int tupleIndex, int objectIndex, ObjectType objectType, String identifier)
    • Pattern

      public Pattern(int patternId, int tupleIndex, int objectIndex, ObjectType objectType, String identifier, boolean isInternalFact)
  • Method Details

    • hasNegativeConstraint

      public boolean hasNegativeConstraint()
    • setHasNegativeConstraint

      public void setHasNegativeConstraint(boolean negative)
    • 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 Pattern 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)
    • isPassive

      public boolean isPassive()
    • setPassive

      public void setPassive(boolean passive)
    • getConstraints

      public List<Constraint> getConstraints()
    • addConstraint

      public void addConstraint(int index, Constraint constraint)
    • addConstraints

      public void addConstraints(Collection<Constraint> constraints)
    • addConstraint

      public void addConstraint(Constraint constraint)
    • hasXPath

      public boolean hasXPath()
    • getXpathConstraint

      public XpathConstraint getXpathConstraint()
    • getXPathDeclaration

      public Declaration getXPathDeclaration()
    • addDeclaration

      public Declaration addDeclaration(String identifier)
    • addDeclaration

      public void addDeclaration(Declaration decl)
    • resetDeclarations

      public void resetDeclarations()
    • isBound

      public boolean isBound()
    • getDeclaration

      public Declaration getDeclaration()
    • getPatternId

      public int getPatternId()
      The index of the Pattern, in the list of patterns.
      Returns:
      the patternIndex
    • getObjectIndex

      public int getObjectIndex()
    • setObjectIndex

      public void setObjectIndex(int objectIndex)
    • getTupleIndex

      public int getTupleIndex()
      The index of pattern in the tuple chain.
      Returns:
      the tupleIndex
    • setTupleIndex

      public void setTupleIndex(int tupleIndex)
    • getDeclarations

      public Map<String,Declaration> getDeclarations()
    • 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<RuleConditionElement> 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)
    • getListenedProperties

      public Collection<String> getListenedProperties()
    • addBoundProperty

      public void addBoundProperty(String boundProperty)
    • addWatchedProperty

      public void addWatchedProperty(String watchedProperty)
    • addWatchedProperties

      public void addWatchedProperties(Collection<String> watchedProperties)
    • getAccessibleProperties

      public List<String> getAccessibleProperties(RuleBase ruleBase)
    • getPositiveWatchMask

      public BitMask getPositiveWatchMask(List<String> accessibleProperties)
    • setPositiveWatchMask

      public void setPositiveWatchMask(BitMask positiveWatchMask)
    • getNegativeWatchMask

      public BitMask getNegativeWatchMask(List<String> accessibleProperties)
    • setNegativeWatchMask

      public void setNegativeWatchMask(BitMask negativeWatchMask)
    • getAnnotations

      public Map<String,AnnotationDefinition> getAnnotations()
    • getBackRefDeclarations

      public XpathBackReference getBackRefDeclarations()
    • setBackRefDeclarations

      public void setBackRefDeclarations(XpathBackReference backRefDeclarations)
    • getXpathBackReferenceClasses

      public List<Class<?>> getXpathBackReferenceClasses()
    • isCompatibleWithAccumulateReturnType

      public boolean isCompatibleWithAccumulateReturnType(Class<?> returnType)
    • isCompatibleWithFromReturnType

      public boolean isCompatibleWithFromReturnType(Class<?> returnType)
    • isCompatibleWithAccumulateReturnType

      public static boolean isCompatibleWithAccumulateReturnType(Class<?> patternType, Class<?> returnType)
    • isCompatibleWithFromReturnType

      public static boolean isCompatibleWithFromReturnType(Class<?> patternType, Class<?> returnType)