org.kahina.core.behavior
Class KahinaBehavior<T extends KahinaObject>

java.lang.Object
  extended by org.kahina.core.behavior.KahinaBehavior<T>
Type Parameters:
T - a subclass of KahinaObject
All Implemented Interfaces:
KahinaListener
Direct Known Subclasses:
KahinaDAGBehavior, KahinaTreeBehavior

public class KahinaBehavior<T extends KahinaObject>
extends Object
implements KahinaListener

The generic ancestor class of all behavior classes.

Behaviors are Kahina's way of defining the application-specific behavior of complex components such as trees. They usually determine how a complex object is constructed and how it reacts to incoming KahinaEvents. A typical use case is LogicProgrammingTreeBehavior for control flow trees in logic programming.

This class is generic and can be specialized for any subclass of KahinaObject.

In an application, the user will usually want to inherit from a specialized variant such as KahinaTreeBehavior. By default, a KahinaBehavior implements the KahinaListener interface, but it does not register itself with the event system. For that purpose, implementations should use the KahinaRunner.getControl().registerListener mechanism.


Field Summary
protected  KahinaInstance kahina
          The KahinaInstance this behavior is connected to
protected  T object
          The KahinaObject that is being controlled by this behavior
 
Constructor Summary
KahinaBehavior(T object, KahinaInstance kahina)
          Class constructor specifying the controlled object and the KahinaInstance that it is connected to.
 
Method Summary
 void processEvent(KahinaEvent e)
          Does not react to any event by default; is overridden by implementations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

object

protected T extends KahinaObject object
The KahinaObject that is being controlled by this behavior


kahina

protected KahinaInstance kahina
The KahinaInstance this behavior is connected to

Constructor Detail

KahinaBehavior

public KahinaBehavior(T object,
                      KahinaInstance kahina)
Class constructor specifying the controlled object and the KahinaInstance that it is connected to.

Parameters:
object - the KahinaObject of type T that is going to be controlled by the new instance
kahina - the KahinaInstance that this behavior will belong to and communicate with
Method Detail

processEvent

public void processEvent(KahinaEvent e)
Does not react to any event by default; is overridden by implementations.

Specified by:
processEvent in interface KahinaListener