public class PeasantState extends java.lang.Object implements IBlaubotState, IBlaubotSubordinatedState
| Modifier and Type | Class and Description |
|---|---|
static class |
PeasantState.ConnectionAccomplishmentType |
| Constructor and Description |
|---|
PeasantState(IBlaubotConnection kingConnection,
PeasantState.ConnectionAccomplishmentType connectionAccomplishmentType) |
public PeasantState(IBlaubotConnection kingConnection, PeasantState.ConnectionAccomplishmentType connectionAccomplishmentType)
kingConnection - the connection to our kingconnectionAccomplishmentType - information about how the connection was accomplishedpublic PeasantState.ConnectionAccomplishmentType getConnectionAccomplishmentType()
BowDownToNewKingAdminMessagepublic IBlaubotState onConnectionEstablished(IBlaubotConnection connection)
IBlaubotStateIBlaubotDevice was established.onConnectionEstablished in interface IBlaubotStateconnection - the established connectionpublic IBlaubotState onConnectionClosed(IBlaubotConnection connection)
IBlaubotStateIBlaubotDevice
was closed due to an exception or intentionally.onConnectionClosed in interface IBlaubotStateconnection - the closed connectionpublic IBlaubotState onDeviceDiscoveryEvent(AbstractBlaubotDeviceDiscoveryEvent discoveryEvent)
IBlaubotStateIBlaubotBeacon discovered a IBlaubotDevice.
Note:
For each discoverable IBlaubotState a corresponding AbstractBlaubotDeviceDiscoveryEvent
subclass can be found in the de.hsrm.blaubot.statemachine.events package.onDeviceDiscoveryEvent in interface IBlaubotStatediscoveryEvent - the discovery event.public void handleState(StateMachineSession session)
IBlaubotStateConnectionStateMachine.handleState in interface IBlaubotStatesession - a session object with access to the relevant Blaubot components.public IBlaubotState onAdminMessage(AbstractAdminMessage adminMessage)
IBlaubotStateAbstractAdminMessage was received.onAdminMessage in interface IBlaubotStateadminMessage - the received admin messagepublic java.lang.String getKingUniqueId()
getKingUniqueId in interface IBlaubotSubordinatedStatepublic java.lang.String toString()
toString in class java.lang.Objectpublic IBlaubotState onTimeoutEvent(AbstractTimeoutStateMachineEvent timeoutEvent)
IBlaubotStateIBlaubotStates.
A IBlaubotState can subclass the AbstractTimeoutStateMachineEvent
and push it to the ConnectionStateMachine.
A timeout event contains the state that issued the timeout so a IBlaubotState
can check if the timeout event belongs to himself or ignore it when this is not the
case.onTimeoutEvent in interface IBlaubotStatetimeoutEvent - the occured eventpublic IBlaubotConnection getKingConnection()
getKingConnection in interface IBlaubotSubordinatedState