Package org.drasyl.behaviour
Class Behavior
- java.lang.Object
-
- org.drasyl.behaviour.Behavior
-
- Direct Known Subclasses:
DeferredBehavior
public class Behavior extends Object
The behavior of an node defines how it reacts to the events that it receives.Behaviors can be formulated in a number of different ways, either by using the DSLs in
Behaviors
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Behavior.BehaviorBuilder
Immutable builder for creatingBehavior
by chaining event handlers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Behavior
receive(Event event)
Process an incoming event and return the next behavior.
-
-
-
Method Detail
-
receive
public Behavior receive(Event event)
Process an incoming event and return the next behavior.The returned behavior can in addition to normal behaviors be one of the canned special objects:
- returning
UNHANDLED
keeps the same behavior and signals that the event was not handled (event will be logged with DEBUG level). - returning
IGNORE
will ignore all future events. - returning
SAME
designates to reuse the current behavior. - returning
SHUTDOWN
will shutdown theDrasylNode
.
- returning
-
-