Interface Scene

All Superinterfaces:
Function
All Known Implementing Classes:
ContainerScene, GenericScene, NumberedListInputScene, NumberedListScene, NumberedSceneSelectorScene, TextApplication, TextInputScene, TextScene

public interface Scene extends Function

Scene Interface

A Scene is something that can be displayed to the terminal.

It has:

  • a name
  • a unique, immutable id
  • a list of functions it can execute
  • a list of child scenes
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addChild(Scene child)
    Add a new child to the list of children
    void
    Executes each function of the scene without displaying To execute a specific function call getFunctions and get an element
    getChild(long ID)
    Finds the child scene tha matches ID and returns it The method of search is up to implementation Regardless of development, there will only be one child with the same ID (if any)
    <T extends Scene>
    T
    getChild(long ID, Class<T> intendedClass)
    Attempts to find a child scene that matches the ID and type of Scene
    Finds a child scene that matches name and returns it The method of search is up to implementation Depending on development, there may be more than one child with the same name
    <T extends Scene>
    T
    getChild(String name, Class<T> intendedClass)
    Attempts to find a child scene that matches the name and type of Scene
    Getter for children
    getter for functions These functions are Consumers that can take anything that extends Scene In general, implementation will pass in "this" as the Scene
    long
    Getter for id
    Getter for name
    boolean
    returns whether or not a scene is currently terminated
    void
    Run child scenes in a way designed for the implementation This could just be a linear display, a unique selection of children to display, or anything else
    void
    setChildren(List<Scene> children)
    Setter for children
    void
    Setter for name
    void
    Quits a scene early
    toString(int indent, boolean displayChildren)
    Allows for recursive tabbing of children for toString In general, the overrided toString() method should return toString(0)

    Methods inherited from interface com.calebleavell.textinterface.scenes.Function

    run
  • Method Details

    • getName

      String getName()
      Getter for name
      Returns:
      the current name of the scene
    • setName

      void setName(String name)
      Setter for name
      Parameters:
      name - - the new name fore the scene
    • getID

      long getID()
      Getter for id
      Returns:
      the scene id - the id is a unique, immutable identifier
    • getChildren

      List<Scene> getChildren()
      Getter for children
      Returns:
      the list of child scenes attatched to the scene
    • setChildren

      void setChildren(List<Scene> children)
      Setter for children
      Parameters:
      children - the new list of child scenes
    • addChild

      void addChild(Scene child)
      Add a new child to the list of children
      Parameters:
      child - the new child to be added
    • runChildren

      void runChildren() throws Exception
      Run child scenes in a way designed for the implementation This could just be a linear display, a unique selection of children to display, or anything else
      Throws:
      Exception
    • getFunctions

      List<Function> getFunctions()
      getter for functions These functions are Consumers that can take anything that extends Scene In general, implementation will pass in "this" as the Scene
      Returns:
      the list of functions it can execute
    • executeFunctions

      void executeFunctions() throws Exception
      Executes each function of the scene without displaying To execute a specific function call getFunctions and get an element
      Throws:
      Exception
    • getChild

      Scene getChild(String name)
      Finds a child scene that matches name and returns it The method of search is up to implementation Depending on development, there may be more than one child with the same name
      Parameters:
      name - The name of the scene to be found
      Returns:
      the first scene that matches name
    • getChild

      Scene getChild(long ID)
      Finds the child scene tha matches ID and returns it The method of search is up to implementation Regardless of development, there will only be one child with the same ID (if any)
      Parameters:
      ID - the ID of the child
      Returns:
      the child with the given ID
    • getChild

      <T extends Scene> T getChild(String name, Class<T> intendedClass)
      Attempts to find a child scene that matches the name and type of Scene
      Type Parameters:
      T - the desired type to find
      Parameters:
      name - the name of the class to find
      intendedClass - the indended class of the child to find
      Returns:
      the found child, or null if no child is found
    • getChild

      <T extends Scene> T getChild(long ID, Class<T> intendedClass)
      Attempts to find a child scene that matches the ID and type of Scene
      Type Parameters:
      T - the desired type to find
      Parameters:
      ID - the id of the class to find
      intendedClass - the indended class of the child to find
      Returns:
      the found child, or null if no child is found
    • toString

      String toString(int indent, boolean displayChildren)
      Allows for recursive tabbing of children for toString In general, the overrided toString() method should return toString(0)
      Parameters:
      indent - the amount of tab (base case call is 0)
      Returns:
      the formatted string of the object and its children
    • terminate

      void terminate()
      Quits a scene early
    • isTerminated

      boolean isTerminated()
      returns whether or not a scene is currently terminated