Package org.drools.base.rule
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 Summary
ConstructorsConstructorDescriptionPattern()Pattern(int patternId, int tupleIndex, int objectIndex, ObjectType objectType, String identifier) Pattern(int patternId, int tupleIndex, int objectIndex, ObjectType objectType, String identifier, boolean isInternalFact) Pattern(int patternId, ObjectType objectType) Pattern(int patternId, ObjectType objectType, String identifier) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBehavior(Behavior behavior) voidaddBoundProperty(String boundProperty) voidaddConstraint(int index, Constraint constraint) voidaddConstraint(Constraint constraint) voidaddConstraints(Collection<Constraint> constraints) addDeclaration(String identifier) voidaddDeclaration(Declaration decl) voidaddWatchedProperties(Collection<String> watchedProperties) voidaddWatchedProperty(String watchedProperty) clone()Returns a clone from itselfbooleangetAccessibleProperties(RuleBase ruleBase) Returns a Map of declarations that are visible inside this conditional elementgetNegativeWatchMask(List<String> accessibleProperties) Returs a list of RuleConditionElement's that are nested inside the current elementintReturns a Map of declarations that are visible outside this conditional element.intThe index of the Pattern, in the list of patterns.getPositiveWatchMask(List<String> accessibleProperties) intThe index of pattern in the tuple chain.inthashCode()booleanbooleanhasXPath()booleanisBound()booleanisCompatibleWithAccumulateReturnType(Class<?> returnType) static booleanisCompatibleWithAccumulateReturnType(Class<?> patternType, Class<?> returnType) booleanisCompatibleWithFromReturnType(Class<?> returnType) static booleanisCompatibleWithFromReturnType(Class<?> patternType, Class<?> returnType) booleanbooleanReturns true in case this RuleConditionElement delimits a pattern visibility scope.voidvoidresolveDeclaration(String identifier) Resolves the given identifier in the current scope and returns the Declaration object for the declaration.voidsetBackRefDeclarations(XpathBackReference backRefDeclarations) voidsetBehaviors(List<Behavior> behaviors) voidsetClassObjectType(ClassObjectType objectType) voidsetHasNegativeConstraint(boolean negative) voidsetNegativeWatchMask(BitMask negativeWatchMask) voidsetObjectIndex(int objectIndex) voidsetObjectType(ObjectType objectType) voidsetPassive(boolean passive) voidsetPositiveWatchMask(BitMask positiveWatchMask) voidsetSource(PatternSource source) voidsetTupleIndex(int tupleIndex) toString()void
-
Constructor Details
-
Pattern
public Pattern() -
Pattern
-
Pattern
-
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
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
setClassObjectType
- Specified by:
setClassObjectTypein interfaceAcceptsClassObjectType
-
getRequiredDeclarations
-
clone
Description copied from interface:RuleConditionElementReturns a clone from itself- Specified by:
clonein interfaceRuleConditionElement- Overrides:
clonein classObject- Returns:
-
getObjectType
-
setObjectType
-
getSource
-
setSource
-
isPassive
public boolean isPassive() -
setPassive
public void setPassive(boolean passive) -
getConstraints
-
addConstraint
-
addConstraints
-
addConstraint
-
hasXPath
public boolean hasXPath() -
getXpathConstraint
-
getXPathDeclaration
-
addDeclaration
-
addDeclaration
-
resetDeclarations
public void resetDeclarations() -
isBound
public boolean isBound() -
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
-
getInnerDeclarations
Description copied from interface:RuleConditionElementReturns a Map of declarations that are visible inside this conditional element- Specified by:
getInnerDeclarationsin interfaceRuleConditionElement- Returns:
-
getOuterDeclarations
Description copied from interface:RuleConditionElementReturns a Map of declarations that are visible outside this conditional element.- Specified by:
getOuterDeclarationsin interfaceRuleConditionElement- Returns:
-
resolveDeclaration
Description copied from interface:RuleConditionElementResolves 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:
resolveDeclarationin interfaceRuleConditionElement- Returns:
-
toString
-
hashCode
public int hashCode() -
equals
-
getNestedElements
Description copied from interface:RuleConditionElementReturs a list of RuleConditionElement's that are nested inside the current element- Specified by:
getNestedElementsin interfaceRuleConditionElement- Returns:
-
isPatternScopeDelimiter
public boolean isPatternScopeDelimiter()Description copied from interface:RuleConditionElementReturns 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:
isPatternScopeDelimiterin interfaceRuleConditionElement- Returns:
-
getBehaviors
- Returns:
- the behaviors
-
setBehaviors
- Parameters:
behaviors- the behaviors to set
-
addBehavior
-
getListenedProperties
-
addBoundProperty
-
addWatchedProperty
-
addWatchedProperties
-
getAccessibleProperties
-
getPositiveWatchMask
-
setPositiveWatchMask
-
getNegativeWatchMask
-
setNegativeWatchMask
-
getAnnotations
-
getBackRefDeclarations
-
setBackRefDeclarations
-
getXpathBackReferenceClasses
-
isCompatibleWithAccumulateReturnType
-
isCompatibleWithFromReturnType
-
isCompatibleWithAccumulateReturnType
-
isCompatibleWithFromReturnType
-