yass.state
Class EnergyAwareStateManager

java.lang.Object
  extended by yass.state.StateManager
      extended by yass.state.EnergyAwareStateManager

public class EnergyAwareStateManager
extends StateManager

Minimally-functional StateManager concrete implementation which does not alter the state of a node, or any of the nodes modules, until such time as the node runs out of energy. At this point, the node is transitioned into a DEAD state whence it shall never return. Most concrete implementations of StateManager will extend EnergyAwareStateManager and use the checkEnergyDepletion() method from the advanceTime() method, or will implement the same functionality by some other means.


Field Summary
 
Fields inherited from class yass.state.StateManager
dropped, managed, node, planned, processed
 
Constructor Summary
EnergyAwareStateManager()
          Constructs a new instance of EnergyAwareStateManager
 
Method Summary
protected  boolean checkEnergyDepletion()
          Checks whether the node's energy supply is fully depleted.
protected  void scheduleStateTransitions(double delta, double localTime)
          Determines if the node's energy supply is fully depleted.
 
Methods inherited from class yass.state.StateManager
advanceTime, deregisterManagedComponent, getAbandonedTransitions, getExecutedTransitions, getManagedComponents, getNode, getPendingTransitions, implementScheduledStateTransitions, registerManagedComponent, setNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnergyAwareStateManager

public EnergyAwareStateManager()
Constructs a new instance of EnergyAwareStateManager

Method Detail

scheduleStateTransitions

protected void scheduleStateTransitions(double delta,
                                        double localTime)
Determines if the node's energy supply is fully depleted. If it is fully depleted, the node transitions into a DEAD state. Otherwise, no action is taken.

Specified by:
scheduleStateTransitions in class StateManager
Parameters:
delta - the duration of the current simulation period
localTime - the node-local time provided by the node's clock module

checkEnergyDepletion

protected boolean checkEnergyDepletion()
Checks whether the node's energy supply is fully depleted. If it is fully depleted, the node transitions into a DEAD state and this state transition is recorded through the Node class' normal mechanism. Classes which extend EnergyAwareStateManager should call this method from their implementImmediateStateTransitions() implementation.

Returns:
true if the energy supply was fully depleted and the node is now DEAD, otherwise false