yass.state
Class EnergyAwareStateManager
java.lang.Object
yass.state.StateManager
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.
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EnergyAwareStateManager
public EnergyAwareStateManager()
- Constructs a new instance of
EnergyAwareStateManager
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 periodlocalTime - 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