Class Stop

All Implemented Interfaces:
Timestamped

public class Stop extends Message
The stop message can be sent from either the server or the agent to indicate that no more turns will happen in the session (though reports may still happen) and that the session should end soon.

An agent can send the stop message (1) if they want to stop a session early before the story has reached one of its defined endings, or (2) to indicate they are finished and have no more reports to send. After an agent sends the stop message, they may not send any more messages (including reports), though they may stay connected to wait for the end message.

The server will send the stop message to notify both agents that no more turns can be taken. This will happen when (1) the story reaches one of its defined endings, (2) one of the agents in the session stops it early, (3) one of the agents in the session disconnects, or (4) the server shuts down.

Once an agent receives the stop message, it cannot take any more turns, even if the story has not reached one of its defined endings. However, an agent may still send reports. When an agent is done sending reports, it should send a stop message to indicate this.

After both agents have either sent stop messages or disconnected, the end message will be sent to both agents.

Author:
Stephen G. Ware
  • Nested Class Summary

    Nested classes/interfaces inherited from interface Timestamped

    Timestamped.Adapter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final Ending
    One of the pre-defined endings from the story world, or null if this session did not reach one of those endings
    final String
    A message explaining how the session ended
    final Role
    The participant who ended the session, or null if the session reached a pre-defined ending or was ended by the server

    Fields inherited from interface Timestamped

    FORMAT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Stop(Role role)
    Constructs a stop message for the role who stopped the session before it reached a pre-defined ending.
    Stop(Role role, String message)
    Constructs a stop message for the role who stopped the session before it reached a pre-defined ending and the reason they stopped it.
    Stop(Ending ending)
    Constructs a stop message from a pre-defined story ending.
    Stop(String message)
    Constructs a stop message with a string explaining how the session ended before it reached a pre-defined ending.
  • Method Summary

    Modifier and Type
    Method
    Description
     

    Methods inherited from class Message

    configure, getAgent, getTimestamp, setAgent, verify

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • ending

      public final Ending ending
      One of the pre-defined endings from the story world, or null if this session did not reach one of those endings
    • role

      public final Role role
      The participant who ended the session, or null if the session reached a pre-defined ending or was ended by the server
    • message

      public final String message
      A message explaining how the session ended
  • Constructor Details

    • Stop

      public Stop(Ending ending)
      Constructs a stop message from a pre-defined story ending.
      Parameters:
      ending - the pre-defined ending that occurred in the story
    • Stop

      public Stop(Role role, String message)
      Constructs a stop message for the role who stopped the session before it reached a pre-defined ending and the reason they stopped it.
      Parameters:
      role - the role who stopped the story
      message - a string explaining why the role stopped the session
    • Stop

      public Stop(Role role)
      Constructs a stop message for the role who stopped the session before it reached a pre-defined ending.
      Parameters:
      role - the role who stopped the story
    • Stop

      public Stop(String message)
      Constructs a stop message with a string explaining how the session ended before it reached a pre-defined ending.
      Parameters:
      message - a string explaining why the session ended
  • Method Details