Drools :: Core 6.2.0.CR4

org.drools.core.rule
Class Accumulate

java.lang.Object
  extended by org.drools.core.rule.ConditionalElement
      extended by org.drools.core.rule.Accumulate
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, PatternSource, RuleConditionElement, RuleComponent
Direct Known Subclasses:
MultiAccumulate, SingleAccumulate

public abstract class Accumulate
extends ConditionalElement
implements PatternSource

A class to represent the Accumulate CE

See Also:
Serialized Form

Field Summary
protected  List<Accumulate> cloned
           
protected  Declaration[] innerDeclarationCache
           
protected  Declaration[] requiredDeclarations
           
protected  RuleConditionElement source
           
 
Constructor Summary
Accumulate()
           
Accumulate(RuleConditionElement source, Declaration[] requiredDeclarations)
           
 
Method Summary
abstract  void accumulate(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, WorkingMemory workingMemory)
          Executes the accumulate (action) code for the given fact handle
abstract  Accumulate clone()
          Returns a clone from itself
abstract  Object createContext()
           
abstract  Object createWorkingMemoryContext()
           
abstract  Accumulator[] getAccumulators()
           
protected  Declaration[] getInnerDeclarationCache()
           
 Map<String,Declaration> getInnerDeclarations()
          Returns a Map of declarations that are visible inside this conditional element
 List<RuleConditionElement> getNestedElements()
          Returs a list of RuleConditionElement's that are nested inside the current element
 Map<String,Declaration> getOuterDeclarations()
          Returns a Map of declarations that are visible outside this conditional element.
abstract  Object getResult(Object workingMemoryContext, Object context, Tuple leftTuple, WorkingMemory workingMemory)
          Gets the result of the accumulation
 RuleConditionElement getSource()
           
 boolean hasRequiredDeclarations()
           
abstract  void init(Object workingMemoryContext, Object context, Tuple leftTuple, WorkingMemory workingMemory)
          Executes the initialization block of code
abstract  boolean isMultiFunction()
           
 boolean isPatternScopeDelimiter()
          Returns true in case this RuleConditionElement delimits a pattern visibility scope.
 void readExternal(ObjectInput in)
           
protected  void registerClone(Accumulate clone)
           
 void replaceDeclaration(Declaration declaration, Declaration resolved)
           
 void resetInnerDeclarationCache()
           
 Declaration resolveDeclaration(String identifier)
          Resolves the given identifier in the current scope and returns the Declaration object for the declaration.
abstract  void reverse(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, WorkingMemory workingMemory)
          Executes the reverse (action) code for the given fact handle
abstract  boolean supportsReverse()
          Returns true if this accumulate supports reverse
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected RuleConditionElement source

requiredDeclarations

protected Declaration[] requiredDeclarations

innerDeclarationCache

protected Declaration[] innerDeclarationCache

cloned

protected List<Accumulate> cloned
Constructor Detail

Accumulate

public Accumulate()

Accumulate

public Accumulate(RuleConditionElement source,
                  Declaration[] requiredDeclarations)
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

getAccumulators

public abstract Accumulator[] getAccumulators()

createContext

public abstract Object createContext()

init

public abstract void init(Object workingMemoryContext,
                          Object context,
                          Tuple leftTuple,
                          WorkingMemory workingMemory)
Executes the initialization block of code


accumulate

public abstract void accumulate(Object workingMemoryContext,
                                Object context,
                                Tuple leftTuple,
                                InternalFactHandle handle,
                                WorkingMemory workingMemory)
Executes the accumulate (action) code for the given fact handle


reverse

public abstract void reverse(Object workingMemoryContext,
                             Object context,
                             Tuple leftTuple,
                             InternalFactHandle handle,
                             WorkingMemory workingMemory)
Executes the reverse (action) code for the given fact handle


getResult

public abstract Object getResult(Object workingMemoryContext,
                                 Object context,
                                 Tuple leftTuple,
                                 WorkingMemory workingMemory)
Gets the result of the accumulation


supportsReverse

public abstract boolean supportsReverse()
Returns true if this accumulate supports reverse

Returns:

clone

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

Specified by:
clone in interface RuleConditionElement
Specified by:
clone in class ConditionalElement
Returns:

registerClone

protected void registerClone(Accumulate clone)

getSource

public RuleConditionElement getSource()

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:

createWorkingMemoryContext

public abstract Object createWorkingMemoryContext()

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:

isMultiFunction

public abstract boolean isMultiFunction()

replaceDeclaration

public void replaceDeclaration(Declaration declaration,
                               Declaration resolved)

resetInnerDeclarationCache

public void resetInnerDeclarationCache()

getInnerDeclarationCache

protected Declaration[] getInnerDeclarationCache()

hasRequiredDeclarations

public boolean hasRequiredDeclarations()

Drools :: Core 6.2.0.CR4

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