Class CompiledNetwork

  • All Implemented Interfaces:
    Externalizable, Serializable, org.drools.core.reteoo.ObjectSinkPropagator

    public abstract class CompiledNetwork
    extends Object
    implements org.drools.core.reteoo.ObjectSinkPropagator
    This is the base type for all generated classes that that represent a "compiled" portion of the RETE network. By compiled we mean IF statements, switch statements, etc. as opposed to nodes, propagators, etc.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.drools.core.reteoo.ObjectTypeNode objectTypeNode  
      protected org.drools.core.reteoo.ObjectSinkPropagator originalSinkPropagator  
    • Constructor Summary

      Constructors 
      Constructor Description
      CompiledNetwork()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      org.drools.core.reteoo.ObjectSinkPropagator addObjectSink​(org.drools.core.reteoo.ObjectSink sink, int alphaNodeHashingThreshold, int alphaNodeRangeIndexThreshold)  
      void changeSinkPartition​(org.drools.core.reteoo.ObjectSink sink, org.drools.core.common.RuleBasePartitionId oldPartition, org.drools.core.common.RuleBasePartitionId newPartition, int alphaNodeHashingThreshold, int alphaNodeRangeIndexThreshold)  
      NetworkHandlerAdaptor createNodeReferenceSetter()  
      void doLinkRiaNode​(org.drools.core.common.InternalWorkingMemory wm)  
      void doUnlinkRiaNode​(org.drools.core.common.InternalWorkingMemory wm)  
      int getId()
      Returns the unique id that represents the node in the Rete network
      org.drools.core.common.BaseNode getMatchingNode​(org.drools.core.common.BaseNode candidate)  
      org.drools.core.reteoo.ObjectSinkPropagator getOriginalSinkPropagator()  
      org.drools.core.common.RuleBasePartitionId getPartitionId()
      Returns the partition ID to which this node belongs to
      org.drools.core.reteoo.ObjectSink[] getSinks()  
      abstract void init​(Object... args)  
      void initConstraintsResults()
      Use to initialize the inlined expression so that the ANC can instantiate without depending on the Rete.
      boolean isEmpty()  
      protected abstract boolean isInlined()  
      void readExternal​(ObjectInput in)
      The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
      org.drools.core.reteoo.ObjectSinkPropagator removeObjectSink​(org.drools.core.reteoo.ObjectSink sink)  
      protected abstract void setNetworkNodeReference​(org.drools.core.common.NetworkNode networkNode)
      Generated subclasses need to implement this method to set member variables based on the specified NetworkNode.
      void setObjectTypeNode​(org.drools.core.reteoo.ObjectTypeNode objectTypeNode)
      Sets the OTN for this network.
      void setOriginalSinkPropagator​(org.drools.core.reteoo.ObjectSinkPropagator originalSinkPropagator)  
      void setStartingObjectTypeNode​(org.drools.core.reteoo.ObjectTypeNode objectTypeNode)  
      int size()  
      void writeExternal​(ObjectOutput out)
      The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
      • Methods inherited from interface org.drools.core.reteoo.ObjectSinkPropagator

        byPassModifyToBetaNode, propagateAssertObject, propagateModifyObject
    • Field Detail

      • objectTypeNode

        protected org.drools.core.reteoo.ObjectTypeNode objectTypeNode
      • originalSinkPropagator

        protected org.drools.core.reteoo.ObjectSinkPropagator originalSinkPropagator
    • Constructor Detail

      • CompiledNetwork

        public CompiledNetwork()
    • Method Detail

      • getId

        public int getId()
        Returns the unique id that represents the node in the Rete network
        Returns:
        unique int value
      • getPartitionId

        public org.drools.core.common.RuleBasePartitionId getPartitionId()
        Returns the partition ID to which this node belongs to
        Returns:
        partition id
      • writeExternal

        public void writeExternal​(ObjectOutput out)
                           throws IOException
        The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
        Specified by:
        writeExternal in interface Externalizable
        Parameters:
        out - the stream to write the object to
        Throws:
        IOException - Includes any I/O exceptions that may occur
      • readExternal

        public void readExternal​(ObjectInput in)
                          throws IOException,
                                 ClassNotFoundException
        The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
        Specified by:
        readExternal in interface Externalizable
        Parameters:
        in - the stream to read data from in order to restore the object
        Throws:
        IOException - if I/O errors occur
        ClassNotFoundException - If the class for an object being restored cannot be found.
      • setObjectTypeNode

        public final void setObjectTypeNode​(org.drools.core.reteoo.ObjectTypeNode objectTypeNode)
        Sets the OTN for this network. Calling this method will set all variables in the generated subclasses by walking the org.kie.reteoo.ObjectTypeNode using a ObjectTypeNodeParser.
        Parameters:
        objectTypeNode - node for whom this network was created
      • setStartingObjectTypeNode

        public void setStartingObjectTypeNode​(org.drools.core.reteoo.ObjectTypeNode objectTypeNode)
      • setOriginalSinkPropagator

        public void setOriginalSinkPropagator​(org.drools.core.reteoo.ObjectSinkPropagator originalSinkPropagator)
      • getOriginalSinkPropagator

        public org.drools.core.reteoo.ObjectSinkPropagator getOriginalSinkPropagator()
      • setNetworkNodeReference

        protected abstract void setNetworkNodeReference​(org.drools.core.common.NetworkNode networkNode)
        Generated subclasses need to implement this method to set member variables based on the specified NetworkNode.
        Parameters:
        networkNode - node to set to set
      • initConstraintsResults

        public void initConstraintsResults()
        Use to initialize the inlined expression so that the ANC can instantiate without depending on the Rete. Should be used instead of #setNetworkNodeReference See #isInlined
      • isInlined

        protected abstract boolean isInlined()
      • addObjectSink

        public org.drools.core.reteoo.ObjectSinkPropagator addObjectSink​(org.drools.core.reteoo.ObjectSink sink,
                                                                         int alphaNodeHashingThreshold,
                                                                         int alphaNodeRangeIndexThreshold)
        Specified by:
        addObjectSink in interface org.drools.core.reteoo.ObjectSinkPropagator
      • removeObjectSink

        public org.drools.core.reteoo.ObjectSinkPropagator removeObjectSink​(org.drools.core.reteoo.ObjectSink sink)
        Specified by:
        removeObjectSink in interface org.drools.core.reteoo.ObjectSinkPropagator
      • changeSinkPartition

        public void changeSinkPartition​(org.drools.core.reteoo.ObjectSink sink,
                                        org.drools.core.common.RuleBasePartitionId oldPartition,
                                        org.drools.core.common.RuleBasePartitionId newPartition,
                                        int alphaNodeHashingThreshold,
                                        int alphaNodeRangeIndexThreshold)
        Specified by:
        changeSinkPartition in interface org.drools.core.reteoo.ObjectSinkPropagator
      • getMatchingNode

        public org.drools.core.common.BaseNode getMatchingNode​(org.drools.core.common.BaseNode candidate)
        Specified by:
        getMatchingNode in interface org.drools.core.reteoo.ObjectSinkPropagator
      • getSinks

        public org.drools.core.reteoo.ObjectSink[] getSinks()
        Specified by:
        getSinks in interface org.drools.core.reteoo.ObjectSinkPropagator
      • size

        public int size()
        Specified by:
        size in interface org.drools.core.reteoo.ObjectSinkPropagator
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface org.drools.core.reteoo.ObjectSinkPropagator
      • doLinkRiaNode

        public void doLinkRiaNode​(org.drools.core.common.InternalWorkingMemory wm)
        Specified by:
        doLinkRiaNode in interface org.drools.core.reteoo.ObjectSinkPropagator
      • doUnlinkRiaNode

        public void doUnlinkRiaNode​(org.drools.core.common.InternalWorkingMemory wm)
        Specified by:
        doUnlinkRiaNode in interface org.drools.core.reteoo.ObjectSinkPropagator
      • init

        public abstract void init​(Object... args)