Interface Scene
- All Superinterfaces:
Function
- All Known Implementing Classes:
ContainerScene
,GenericScene
,NumberedListInputScene
,NumberedListScene
,NumberedSceneSelectorScene
,TextApplication
,TextInputScene
,TextScene
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 TypeMethodDescriptionvoid
Add a new child to the list of childrenvoid
Executes each function of the scene without displaying To execute a specific function call getFunctions and get an elementgetChild
(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>
TAttempts to find a child scene that matches the ID and type of SceneFinds 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>
TAttempts to find a child scene that matches the name and type of SceneGetter for childrengetter for functions These functions are Consumers that can take anything that extends Scene In general, implementation will pass in "this" as the Scenelong
getID()
Getter for idgetName()
Getter for nameboolean
returns whether or not a scene is currently terminatedvoid
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 elsevoid
setChildren
(List<Scene> children) Setter for childrenvoid
Setter for namevoid
Quits a scene earlytoString
(int indent, boolean displayChildren) Allows for recursive tabbing of children for toString In general, the overrided toString() method should return toString(0)
-
Method Details
-
getName
String getName()Getter for name- Returns:
- the current name of the scene
-
setName
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
Getter for children- Returns:
- the list of child scenes attatched to the scene
-
setChildren
Setter for children- Parameters:
children
- the new list of child scenes
-
addChild
Add a new child to the list of children- Parameters:
child
- the new child to be added
-
runChildren
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
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
Executes each function of the scene without displaying To execute a specific function call getFunctions and get an element- Throws:
Exception
-
getChild
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
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
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 findintendedClass
- the indended class of the child to find- Returns:
- the found child, or null if no child is found
-
getChild
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 findintendedClass
- the indended class of the child to find- Returns:
- the found child, or null if no child is found
-
toString
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
-