Class Session

java.lang.Object
edu.uky.cs.nil.tt.Session

public class Session extends Object
A session records the events of a story, any reports of the story's quality, and the final result at the end of a storytelling exercise between a player and game master.

When a session is completed, it may be written to file by the server log.

Author:
Stephen G. Ware
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    An event represents a single turn during a storytelling session as well as the actual state of the story world after the turn and the state of the world as perceived by the player.
    static class 
    A report occurs when one participant in a session sends their response to a question about the narrative.
    static class 
    A result explains how the session ended.
    static class 
    A timestamped object records the moment at which it was created.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
    The system name of the agent in the game master role
    final String
    The system name of the agent in the player role
    final World
    The world in which the session took place
  • Constructor Summary

    Constructors
    Constructor
    Description
    Session(World world, String gm, String player)
    Constructs a new session from a story world and the names of the game master and player agents.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    append(Role role, Report report)
    Adds a new report to this session, which records a response by one of the participants to a rating or survey question about the story.
    protected void
    append(Turn turn, State actual, State perceived)
    Adds a new event to this session, which records a turn in the story, the actual and player perceived states after that turn, and the time it occurred.
    static void
    configure(com.google.gson.GsonBuilder builder)
    Configures a GsonBuilder to encode and decode session objects.
    Returns an unmodifiable list of all events appended to this session so far.
    Returns an unmodifiable list of all reports appended to this session so far.
    Returns the result of this session, or null if this session does not yet have a result.
    protected void
    Sets the result of this session based on the message which caused the session to end.
     

    Methods inherited from class Object

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

    • world

      public final World world
      The world in which the session took place
    • gm

      public final String gm
      The system name of the agent in the game master role
    • player

      public final String player
      The system name of the agent in the player role
  • Constructor Details

    • Session

      public Session(World world, String gm, String player)
      Constructs a new session from a story world and the names of the game master and player agents.
      Parameters:
      world - the story world in which the session will take place
      gm - the name of the agent in the game mast role
      player - the name of the agent in the player role
  • Method Details

    • configure

      public static void configure(com.google.gson.GsonBuilder builder)
      Configures a GsonBuilder to encode and decode session objects.
      Parameters:
      builder - the GSON builder to configure
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getEvents

      public List<Session.Event> getEvents()
      Returns an unmodifiable list of all events appended to this session so far.
      Returns:
      a list of this session's events
    • getReports

      public List<Session.Report> getReports()
      Returns an unmodifiable list of all reports appended to this session so far.
      Returns:
      a list of this session's reports
    • getResult

      public Session.Result getResult()
      Returns the result of this session, or null if this session does not yet have a result.
      Returns:
      this session's result
    • append

      protected void append(Turn turn, State actual, State perceived)
      Adds a new event to this session, which records a turn in the story, the actual and player perceived states after that turn, and the time it occurred.
      Parameters:
      turn - a turn in the story
      actual - the actual state of the story world after the turn
      perceived - the state of the story world as perceived by the player after the turn
    • append

      protected void append(Role role, Report report)
      Adds a new report to this session, which records a response by one of the participants to a rating or survey question about the story.
      Parameters:
      role - the role who sent the report
      report - the message that contains the item, value, and comment of the report
    • setResult

      protected void setResult(Stop stop)
      Sets the result of this session based on the message which caused the session to end.
      Parameters:
      stop - the message which caused the session to end and which contains the pre-definded ending (if any) and a message explaining why the session ended