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()
BowDownToNewKingAdminMessage
public IBlaubotState onConnectionEstablished(IBlaubotConnection connection)
IBlaubotState
IBlaubotDevice
was established.onConnectionEstablished
in interface IBlaubotState
connection
- the established connectionpublic IBlaubotState onConnectionClosed(IBlaubotConnection connection)
IBlaubotState
IBlaubotDevice
was closed due to an exception or intentionally.onConnectionClosed
in interface IBlaubotState
connection
- the closed connectionpublic IBlaubotState onDeviceDiscoveryEvent(AbstractBlaubotDeviceDiscoveryEvent discoveryEvent)
IBlaubotState
IBlaubotBeacon
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 IBlaubotState
discoveryEvent
- the discovery event.public void handleState(StateMachineSession session)
IBlaubotState
ConnectionStateMachine
.handleState
in interface IBlaubotState
session
- a session object with access to the relevant Blaubot
components.public IBlaubotState onAdminMessage(AbstractAdminMessage adminMessage)
IBlaubotState
AbstractAdminMessage
was received.onAdminMessage
in interface IBlaubotState
adminMessage
- the received admin messagepublic java.lang.String getKingUniqueId()
getKingUniqueId
in interface IBlaubotSubordinatedState
public java.lang.String toString()
toString
in class java.lang.Object
public IBlaubotState onTimeoutEvent(AbstractTimeoutStateMachineEvent timeoutEvent)
IBlaubotState
IBlaubotState
s.
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 IBlaubotState
timeoutEvent
- the occured eventpublic IBlaubotConnection getKingConnection()
getKingConnection
in interface IBlaubotSubordinatedState