planet.behaviour
Class BehaviourInvoker
java.lang.Object
planet.behaviour.BehaviourInvoker
public class BehaviourInvoker
- extends java.lang.Object
This class is used to invoke a behaviour. It acts
like a facade calling a behaviour only when several preconditions are met.
Pre-conditions on this default implementation are probability-based.
- Author:
- Marc Sanchez
Field Summary |
protected Behaviour |
beh
Behaviour object: this properties is a placeholder for a behaviour. |
protected double |
prob
Behaviour property: probability to be checked. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
beh
protected Behaviour beh
- Behaviour object: this properties is a placeholder for a behaviour.
prob
protected double prob
- Behaviour property: probability to be checked.
BehaviourInvoker
public BehaviourInvoker(Behaviour beh,
double prob)
invoke
public BehaviourInvokerStatus invoke(RouteMessage msg,
Node node)
- This method invokes a behaviour.
- Parameters:
msg
- The RouteMessage recently arrived.node
- The Node which holds the behaviour.
- Returns:
- Returns a BehaviourInvokerStatus with replies from the
behaviour's invocation and a boolean signaling if the invocation
was finally made.
getName
public java.lang.String getName()
- Returns:
- Returns the name of a behaviour.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
- Returns:
- Returns a string representation of the behaviour. In general, the toString
method returns a string that "textually represents" this behaviour. The result should
be a concise but informative representation that is easy for a person to read.