Package org.drools.core.rule
Class Pattern
- java.lang.Object
-
- org.drools.core.rule.Pattern
-
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,RuleConditionElement,Acceptor,AcceptsClassObjectType,RuleComponent
- Direct Known Subclasses:
XpathBackReference.RelativePattern
public class Pattern extends Object implements RuleConditionElement, AcceptsClassObjectType, Externalizable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Pattern()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
-
-
-
Constructor Detail
-
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 Detail
-
hasNegativeConstraint
public boolean hasNegativeConstraint()
-
setHasNegativeConstraint
public void setHasNegativeConstraint(boolean negative)
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
getReadAcessor
public static InternalReadAccessor getReadAcessor(ObjectType objectType)
-
setClassObjectType
public void setClassObjectType(ClassObjectType objectType)
- Specified by:
setClassObjectTypein interfaceAcceptsClassObjectType
-
getRequiredDeclarations
public Declaration[] getRequiredDeclarations()
-
clone
public Pattern clone()
Description copied from interface:RuleConditionElementReturns a clone from itself- Specified by:
clonein interfaceRuleConditionElement- Overrides:
clonein classObject- 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)
-
removeConstraint
public void removeConstraint(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:RuleConditionElementReturns a Map of declarations that are visible inside this conditional element- Specified by:
getInnerDeclarationsin interfaceRuleConditionElement- Returns:
-
getOuterDeclarations
public Map<String,Declaration> getOuterDeclarations()
Description copied from interface:RuleConditionElementReturns a Map of declarations that are visible outside this conditional element.- Specified by:
getOuterDeclarationsin interfaceRuleConditionElement- Returns:
-
resolveDeclaration
public Declaration resolveDeclaration(String identifier)
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:
-
getNestedElements
public List<RuleConditionElement> 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:
-
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(InternalKnowledgeBase kBase)
-
setPositiveWatchMask
public void setPositiveWatchMask(BitMask positiveWatchMask)
-
setNegativeWatchMask
public void setNegativeWatchMask(BitMask negativeWatchMask)
-
getAnnotations
public Map<String,AnnotationDefinition> getAnnotations()
-
getBackRefDeclarations
public XpathBackReference getBackRefDeclarations()
-
setBackRefDeclarations
public void setBackRefDeclarations(XpathBackReference backRefDeclarations)
-
isCompatibleWithAccumulateReturnType
public boolean isCompatibleWithAccumulateReturnType(Class<?> returnType)
-
isCompatibleWithFromReturnType
public boolean isCompatibleWithFromReturnType(Class<?> returnType)
-
isCompatibleWithAccumulateReturnType
public static boolean isCompatibleWithAccumulateReturnType(Class<?> patternType, Class<?> returnType)
-
-