T
- a subclass of KahinaObject
public class KahinaBehavior<T extends KahinaObject> extends java.lang.Object implements KahinaListener
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 KahinaEvent
s.
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.
Modifier and Type | Field and Description |
---|---|
protected KahinaInstance |
kahina
The KahinaInstance this behavior is connected to
|
protected T |
object
The KahinaObject that is being controlled by this behavior
|
Constructor and Description |
---|
KahinaBehavior(T object,
KahinaInstance kahina)
Class constructor specifying the controlled object and the KahinaInstance that it is connected to.
|
Modifier and Type | Method and Description |
---|---|
void |
processEvent(KahinaEvent e)
Does not react to any event by default; is overridden by implementations.
|
protected T extends KahinaObject object
protected KahinaInstance kahina
public KahinaBehavior(T object, KahinaInstance kahina)
object
- the KahinaObject of type T that is going to be controlled by the new instancekahina
- the KahinaInstance that this behavior will belong to and communicate withpublic void processEvent(KahinaEvent e)
processEvent
in interface KahinaListener