Drools :: Core 6.1.0.Beta1

org.drools.core.reteoo.compiled
Class DeclarationsHandler

java.lang.Object
  extended by org.drools.core.reteoo.compiled.NetworkHandlerAdaptor
      extended by org.drools.core.reteoo.compiled.DeclarationsHandler
All Implemented Interfaces:
NetworkHandler

public class DeclarationsHandler
extends NetworkHandlerAdaptor

This handler is used to create the member declarations section of a generated subclass of a CompiledNetwork. Currently we only create member variables for the following types of nodes:

  • Non-hashed AlphaNodes
  • LeftInputAdapterNodes
  • BetaNodes
  • A Map for each set of hashed AlphaNodes. The keys are the hashed values, and the values are the IDs of the alphas

  • Field Summary
    protected static String NEWLINE
               
     
    Constructor Summary
    DeclarationsHandler(StringBuilder builder)
               
     
    Method Summary
    protected  String getContextVariableName(AlphaNode alphaNode)
               
     Collection<HashedAlphasDeclaration> getHashedAlphaDeclarations()
               
    protected  String getVariableName(AlphaNode alphaNode)
               
    protected  String getVariableName(ClassFieldReader fieldReader)
               
    protected  String getVariableName(Sink sink)
               
    protected  Class<?> getVariableType(AlphaNode alphaNode)
               
    protected  Class<?> getVariableType(Sink sink)
               
     void startBetaNode(BetaNode betaNode)
               
     void startHashedAlphaNode(AlphaNode hashedAlpha, Object hashedValue)
               
     void startHashedAlphaNodes(ClassFieldReader hashedFieldReader)
              Receive notification of the a group of hashed org.kie.reteoo.AlphaNodes.
     void startLeftInputAdapterNode(LeftInputAdapterNode leftInputAdapterNode)
               
     void startNonHashedAlphaNode(AlphaNode alphaNode)
              Receive notification of the a non-hashed org.kie.reteoo.AlphaNode.
     
    Methods inherited from class org.drools.core.reteoo.compiled.NetworkHandlerAdaptor
    endBetaNode, endHashedAlphaNode, endHashedAlphaNodes, endLeftInputAdapterNode, endNonHashedAlphaNode, endObjectTypeNode, startObjectTypeNode
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    NEWLINE

    protected static final String NEWLINE
    See Also:
    Constant Field Values
    Constructor Detail

    DeclarationsHandler

    public DeclarationsHandler(StringBuilder builder)
    Method Detail

    getHashedAlphaDeclarations

    public Collection<HashedAlphasDeclaration> getHashedAlphaDeclarations()

    startNonHashedAlphaNode

    public void startNonHashedAlphaNode(AlphaNode alphaNode)
    Description copied from interface: NetworkHandler
    Receive notification of the a non-hashed org.kie.reteoo.AlphaNode.

    The Parser will invoke this method at the beginning of every non-hashed Alpha in the Network; there will be a corresponding endNonHashedAlphaNode() event for every startNonHashedAlphaNode() event. All of the node's decendants will be reported, in order, before the corresponding endNonHashedAlphaNode() event.

    Specified by:
    startNonHashedAlphaNode in interface NetworkHandler
    Overrides:
    startNonHashedAlphaNode in class NetworkHandlerAdaptor
    Parameters:
    alphaNode - non-hashed AlphaNode
    See Also:
    NetworkHandler.endNonHashedAlphaNode(org.drools.core.reteoo.AlphaNode)

    startBetaNode

    public void startBetaNode(BetaNode betaNode)
    Specified by:
    startBetaNode in interface NetworkHandler
    Overrides:
    startBetaNode in class NetworkHandlerAdaptor

    startLeftInputAdapterNode

    public void startLeftInputAdapterNode(LeftInputAdapterNode leftInputAdapterNode)
    Specified by:
    startLeftInputAdapterNode in interface NetworkHandler
    Overrides:
    startLeftInputAdapterNode in class NetworkHandlerAdaptor

    startHashedAlphaNodes

    public void startHashedAlphaNodes(ClassFieldReader hashedFieldReader)
    Description copied from interface: NetworkHandler
    Receive notification of the a group of hashed org.kie.reteoo.AlphaNodes.

    The Parser will invoke this method at the beginning of every groups of hashed Alphas in the Network; there will be a corresponding NetworkHandler.endHashedAlphaNodes(org.drools.core.base.ClassFieldReader) event for every startHashedAlphaNodes() event. The actual alpha nodes will be reported via the NetworkHandler.startHashedAlphaNode(org.drools.core.reteoo.AlphaNode, java.lang.Object) method, along with all of the node's decendants, in order, before the corresponding NetworkHandler.endHashedAlphaNode(org.drools.core.reteoo.AlphaNode, java.lang.Object) event.

    Specified by:
    startHashedAlphaNodes in interface NetworkHandler
    Overrides:
    startHashedAlphaNodes in class NetworkHandlerAdaptor
    Parameters:
    hashedFieldReader - field reader that is used to access the hashed attribute
    See Also:
    NetworkHandler.endHashedAlphaNodes(org.drools.core.base.ClassFieldReader), NetworkHandler.startHashedAlphaNode(org.drools.core.reteoo.AlphaNode, java.lang.Object)

    startHashedAlphaNode

    public void startHashedAlphaNode(AlphaNode hashedAlpha,
                                     Object hashedValue)
    Specified by:
    startHashedAlphaNode in interface NetworkHandler
    Overrides:
    startHashedAlphaNode in class NetworkHandlerAdaptor

    getVariableType

    protected Class<?> getVariableType(AlphaNode alphaNode)

    getVariableType

    protected Class<?> getVariableType(Sink sink)

    getVariableName

    protected String getVariableName(AlphaNode alphaNode)

    getContextVariableName

    protected String getContextVariableName(AlphaNode alphaNode)

    getVariableName

    protected String getVariableName(Sink sink)

    getVariableName

    protected String getVariableName(ClassFieldReader fieldReader)

    Drools :: Core 6.1.0.Beta1

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