Class Session

java.lang.Object
edu.uky.cs.nil.tt.Session
All Implemented Interfaces:
Duration

public class Session extends Object implements Duration
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.

    Nested classes/interfaces inherited from interface Duration

    Duration.Adapter, Duration.Ongoing
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final Titled
    The name, title, and description of the agent in the game master role
    final Titled
    The name, title, and description of the agent in the player role
    final String
    The version number of the server that created this session
    The world in which the session took place
  • Constructor Summary

    Constructors
    Constructor
    Description
    Session(TitledWorld world, Titled gm, Titled 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.
    long
    Returns the time this duration stopped as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).
    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.
    long
    Returns the time this duration began as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).
    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

    Methods inherited from interface Duration

    getDuration
  • Field Details

    • version

      public final String version
      The version number of the server that created this session
      See Also:
    • world

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

      public final Titled gm
      The name, title, and description of the agent in the game master role
    • player

      public final Titled player
      The name, title, and description of the agent in the player role
  • Constructor Details

    • Session

      public Session(TitledWorld world, Titled gm, Titled 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, title, and description of the agent in the game master role
      player - the name, title, and description 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-defined ending (if any) and a message explaining why the session ended
    • getStartTime

      public long getStartTime()
      Description copied from interface: Duration
      Returns the time this duration began as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).
      Specified by:
      getStartTime in interface Duration
      Returns:
      the time this duration began
    • getEndTime

      public long getEndTime()
      Description copied from interface: Duration
      Returns the time this duration stopped as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).
      Specified by:
      getEndTime in interface Duration
      Returns:
      the time this duration stopped