org.drools.leaps
Class LeapsRuleBase

java.lang.Object
  extended byorg.drools.common.AbstractRuleBase
      extended byorg.drools.leaps.LeapsRuleBase
All Implemented Interfaces:
java.io.Externalizable, InternalRuleBase, RuleBase, java.io.Serializable

public class LeapsRuleBase
extends AbstractRuleBase

This base class for the engine and analogous to Drool's RuleBase class. It has a similar interface adapted to the Leaps algorithm

See Also:
Serialized Form
 

Field Summary
 
Fields inherited from class org.drools.common.AbstractRuleBase
config, factHandleFactory, globals, packageClassLoader, pkgs, PRESENT, workingMemories
 
Fields inherited from interface org.drools.RuleBase
LEAPS, RETEOO
 
Constructor Summary
LeapsRuleBase()
          Construct.
LeapsRuleBase(RuleBaseConfiguration config, FactHandleFactory factHandleFactory)
          Construct.
 
Method Summary
 void addRule(Rule rule)
          Creates leaps rule wrappers and propagate rule to the working memories
 void assertObject(FactHandle handle, java.lang.Object object, PropagationContext context, ReteooWorkingMemory workingMemory)
          Assert a fact object.
 void modifyObject(FactHandle handle, PropagationContext context, ReteooWorkingMemory workingMemory)
           
 WorkingMemory newWorkingMemory()
          Create a new WorkingMemory session for this RuleBase.
 WorkingMemory newWorkingMemory(boolean keepReference)
          Create a new WorkingMemory session for this RuleBase.
 void readExternal(java.io.ObjectInput stream)
          Handles the read serialization of the Package.
 void removeRule(Rule rule)
           
 void retractObject(FactHandle handle, PropagationContext context, ReteooWorkingMemory workingMemory)
          Retract a fact object.
 void writeExternal(java.io.ObjectOutput stream)
          Handles the write serialization of the Package.
 
Methods inherited from class org.drools.common.AbstractRuleBase
addPackage, addWorkingMemory, disposeWorkingMemory, doReadExternal, doWriteExternal, getConfiguration, getFactHandleFactory, getGlobals, getPackages, getWorkingMemories, newFactHandleFactory, newWorkingMemory, newWorkingMemory, removePackage, removeRule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeapsRuleBase

public LeapsRuleBase()
              throws PackageIntegrationException
Construct.

Throws:
PackageIntegrationException

LeapsRuleBase

public LeapsRuleBase(RuleBaseConfiguration config,
                     FactHandleFactory factHandleFactory)
Construct.

Throws:
PackageIntegrationException
java.lang.Exception
Parameters:
factHandleFactory - The fact handle factory.
Method Detail

newWorkingMemory

public WorkingMemory newWorkingMemory()
Description copied from interface: RuleBase
Create a new WorkingMemory session for this RuleBase. By default the RuleBase retains a weak reference to returned WorkingMemory.

The created WorkingMemory uses the default conflict resolution strategy.

Specified by:
newWorkingMemory in interface RuleBase
Overrides:
newWorkingMemory in class AbstractRuleBase
See Also:
RuleBase

newWorkingMemory

public WorkingMemory newWorkingMemory(boolean keepReference)
Description copied from interface: RuleBase
Create a new WorkingMemory session for this RuleBase. Optionally the RuleBase retains a weak reference to returned WorkingMemory.

The created WorkingMemory uses the default conflict resolution strategy.

Specified by:
newWorkingMemory in interface RuleBase
Specified by:
newWorkingMemory in class AbstractRuleBase
See Also:
RuleBase

addRule

public void addRule(Rule rule)
             throws FactException,
                    InvalidPatternException
Creates leaps rule wrappers and propagate rule to the working memories

Overrides:
addRule in class AbstractRuleBase
Throws:
FactException
InvalidPatternException
Parameters:
rule -

removeRule

public void removeRule(Rule rule)
Specified by:
removeRule in class AbstractRuleBase

writeExternal

public void writeExternal(java.io.ObjectOutput stream)
                   throws java.io.IOException
Handles the write serialization of the Package. Patterns in Rules may reference generated data which cannot be serialized by default methods. The Package uses PackageCompilationData to hold a reference to the generated bytecode. The generated bytecode must be restored before any Rules.

Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput stream)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Handles the read serialization of the Package. Patterns in Rules may reference generated data which cannot be serialized by default methods. The Package uses PackageCompilationData to hold a reference to the generated bytecode; which must be restored before any Rules. A custom ObjectInputStream, able to resolve classes against the bytecode in the PackageCompilationData, is used to restore the Rules.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

assertObject

public void assertObject(FactHandle handle,
                         java.lang.Object object,
                         PropagationContext context,
                         ReteooWorkingMemory workingMemory)
                  throws FactException
Description copied from interface: InternalRuleBase
Assert a fact object.

Throws:
FactException
Parameters:
handle - The handle.
object - The fact.
workingMemory - The working-memory.

modifyObject

public void modifyObject(FactHandle handle,
                         PropagationContext context,
                         ReteooWorkingMemory workingMemory)
                  throws FactException
Throws:
FactException

retractObject

public void retractObject(FactHandle handle,
                          PropagationContext context,
                          ReteooWorkingMemory workingMemory)
                   throws FactException
Description copied from interface: InternalRuleBase
Retract a fact object.

Throws:
FactException
Parameters:
handle - The handle.
workingMemory - The working-memory.