org.drools.runtime.rule.WorkingMemory Maven / Gradle / Ivy
package org.drools.runtime.rule;
import java.util.Collection;
import org.drools.event.rule.WorkingMemoryEventManager;
import org.drools.runtime.ObjectFilter;
import org.drools.time.SessionClock;
/**
* The WorkingMemory
is a super-interface for all StatefulKnowledgeSession
s.
* Although, users are encouraged to use StatefulKnowledgeSession
or KnowledgeRuntime
* interface instead of WorkingMemory
interface, specially because of the dispose()
method
* that is only available in the StatefulKnowledgeSession
interface.
*
* @see org.drools.runtime.StatefulKnowledgeSession
*/
public interface WorkingMemory
extends
WorkingMemoryEntryPoint {
/**
* Request the engine to stop firing rules. If the engine is currently firing a rule, it will
* finish executing this rule's consequence before stopping.
* This method will not remove active activations from the Agenda.
* In case the application later wants to continue firing rules from the point where it stopped,
* it should just call org.drools.runtime.StatefulKnowledgeSession.fireAllRules()
or
* org.drools.runtime.StatefulKnowledgeSession.fireUntilHalt()
again.
*/
void halt();
/**
* Returns the session clock instance assigned to this session
* @return
*/
public SessionClock getSessionClock();
/**
* Returns the fact handle associated with the given object. It is important to note that this
* method behaves in accordance with the configured assert behaviour for this knowledge base
* (either IDENTITY or EQUALITY).
*
* @param object
* the fact for which the fact handle will be returned.
*
* @return the fact handle for the given object, or null in case no fact handle was found for the
* given object.
*
* @see KnowledgeBaseConfiguration
*/
FactHandle getFactHandle(Object object);
/**
* Returns all facts from the current session.
*
* @return
*/
Collection< ? > getObjects();
/**
* Returns all facts from the current session that are accepted by the given ObjectFilter
.
*
* @param filter the filter to be applied to the returned collection of facts.
*
* @return
*/
Collection< ? > getObjects(ObjectFilter filter);
/**
* Returns all FactHandle
s from the current session.
*
* @return
*/
Collection< ? extends FactHandle> getFactHandles();
/**
* Returns all FactHandle
s from the current session for which the facts are accepted by
* the given filter.
*
* @param filter the filter to be applied to the returned collection of FactHandle
s.
*
* @return
*/
Collection< ? extends FactHandle> getFactHandles(ObjectFilter filter);
/**
* Returns a reference to this session's Agenda
.
*
* @return
*/
Agenda getAgenda();
/**
* Returns the WorkingMemoryEntryPoint instance associated with the given name.
*
* @param name
* @return
*/
WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String name);
}