Class Rete

  • All Implemented Interfaces:
    java.io.Serializable, org.drools.base.common.NetworkNode, ObjectSink, Sink

    public class Rete
    extends ObjectSource
    implements ObjectSink
    The Rete-OO network. The Rete class is the root Object. All objects are asserted into the Rete node where it propagates to all matching ObjectTypeNodes. The first time an instance of a Class type is asserted it does a full iteration of all ObjectTyppeNodes looking for matches, any matches are then cached in a HashMap which is used for future assertions. While Rete extends ObjectSource nad implements ObjectSink it nulls the methods attach(), remove() and updateNewNode() as this is the root node they are no applicable
    See Also:
    ObjectTypeNode, Serialized Form
    • Method Detail

      • getType

        public short getType()
        Specified by:
        getType in interface org.drools.base.common.NetworkNode
      • assertObject

        public void assertObject​(InternalFactHandle factHandle,
                                 PropagationContext context,
                                 ReteEvaluator reteEvaluator)
        This is the entry point into the network for all asserted Facts. Iterates a cache of matching ObjectTypdeNodes asserting the Fact. If the cache does not exist it first iteraes and builds the cache.
        Specified by:
        assertObject in interface ObjectSink
        Parameters:
        factHandle - The FactHandle of the fact to assert
        context - The PropagationContext of the WorkingMemory action
        reteEvaluator - The working memory session.
      • retractObject

        public void retractObject​(InternalFactHandle handle,
                                  PropagationContext context,
                                  ReteEvaluator reteEvaluator)
        Retract a fact object from this RuleBase and the specified WorkingMemory.
        Parameters:
        handle - The handle of the fact to retract.
        reteEvaluator - The working memory session.
      • addObjectSink

        public void addObjectSink​(ObjectSink objectSink)
        Adds the ObjectSink so that it may receive Objects propagated from this ObjectSource.
        Overrides:
        addObjectSink in class ObjectSource
        Parameters:
        objectSink - The ObjectSink to receive propagated Objects. Rete only accepts ObjectTypeNodes as parameters to this method, though.
      • networkUpdated

        public void networkUpdated​(UpdateContext updateContext)
        Description copied from class: BaseNode
        A method that is called for all nodes whose network below them changed, after the change is complete, providing them with an opportunity for state update
        Overrides:
        networkUpdated in class ObjectSource
      • getEntryPointNode

        public EntryPointNode getEntryPointNode​(org.drools.base.rule.EntryPointId entryPoint)
      • getObjectTypeNodes

        public java.util.List<ObjectTypeNode> getObjectTypeNodes()
      • getObjectTypeNodes

        public java.util.Map<org.drools.base.base.ObjectType,​ObjectTypeNode> getObjectTypeNodes​(org.drools.base.rule.EntryPointId entryPoint)
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • getEntryPointNodes

        public java.util.Map<org.drools.base.rule.EntryPointId,​EntryPointNode> getEntryPointNodes()
      • calculateDeclaredMask

        public org.drools.core.util.bitmask.BitMask calculateDeclaredMask​(org.drools.base.base.ObjectType modifiedType,
                                                                          java.util.List<java.lang.String> settableProperties)
        Specified by:
        calculateDeclaredMask in class ObjectSource