planet.behaviour
Class BehaviourInvoker

java.lang.Object
  extended byplanet.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.
 
Constructor Summary
BehaviourInvoker(Behaviour beh, double prob)
           
 
Method Summary
 java.lang.String getName()
           
 BehaviourInvokerStatus invoke(RouteMessage msg, Node node)
          This method invokes a behaviour.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

beh

protected Behaviour beh
Behaviour object: this properties is a placeholder for a behaviour.


prob

protected double prob
Behaviour property: probability to be checked.

Constructor Detail

BehaviourInvoker

public BehaviourInvoker(Behaviour beh,
                        double prob)
Method Detail

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()
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.