JTP API Documentation

jtp
Interface Dispatcher

All Superinterfaces:
Reasoner
All Known Implementing Classes:
RelationBasedDispatcher, SequentialDispatcher

public interface Dispatcher
extends Reasoner

A Dispatcher is a Reasoner that typically does not perform any reasoning itself, but rather redirects queries/assertions to its child reasoners. A dispatcher can have multiple child reasoners, some of those can be dispatchers themselves. Dispathcers and reasoners, therefore, form a hierarchy; dispatchers are inner nodes of a tree, non-dispatcher reasoners are leaf nodes.

If the query/assertion is routed to several children, it is the task of the Dispatcher to aggregate the results into a common ReasoningStepIterator.

See Also:
DispatcherUtils

Method Summary
 boolean addReasoner(Reasoner r)
          Add a reasoner directly to this dispatcher.
 Class getReasonerClass()
          Returns the class of reasoners this dispatcher works with.
 Collection getReasoners()
          Retrieves the collection of child reasoners directly beneath this dispatcher.
 boolean removeReasoner(Reasoner r)
          Removes a reasoner directly from this dispatcher.
 
Methods inherited from interface jtp.Reasoner
acceptable, process
 

Method Detail

addReasoner

public boolean addReasoner(Reasoner r)
Add a reasoner directly to this dispatcher. This function should not attempt to route the reasoner to any possible child dispatchers it may have, that is the job of the function DispatcherUtils.addToDispatcher(jtp.Reasoner, jtp.Dispatcher).

Parameters:
r - the reasoner to add
Returns:
true if the reasoner has been added (i.e., the state has changed).

removeReasoner

public boolean removeReasoner(Reasoner r)
Removes a reasoner directly from this dispatcher. This function should not attempt to find the reasoner at any possible child dispatchers it may have, that is the job of the function DispatcherUtils.removeFromDispatcher(jtp.Reasoner, jtp.Dispatcher).

Parameters:
r - the reasoner to remove
Returns:
true if the reasoner has been removed (i.e., the state has changed).

getReasonerClass

public Class getReasonerClass()
Returns the class of reasoners this dispatcher works with. Every reasoner you add to this dispatcher must be an instance of this class.

Returns:
the class of reasoners this dispatcher works with.

getReasoners

public Collection getReasoners()
Retrieves the collection of child reasoners directly beneath this dispatcher. This collection may be "live", i.e. in some cases modification to this collection will reflect on the state of the dispatcher. Therefore it might be a good idea to make a copy before trying to modify it.

Returns:
the collection of child reasoners directly beneath this dispatcher.

JTP API Documentation