Core Architecture: API Managers, File Managers, Story Visitors - UA-ScriptEase/scriptease GitHub Wiki

API Managers

  • Each Translator has its own API Manager.
  • The purpose of the API Managers is to provide access points to the various information found in the API Dictionary:
    • TypeManager: manages the Types referenced by a String keyword
    • SlotManager: manages the Slots referenced by a String keyword
    • DoItManager: manages the DoIts referenced by a String keyword
  • Each manager provides various functions to access data without the need to store the objects in memory. It does this via the retrieve method, which gets the desired Type, Slot or DoIt from apidictionary.xml

File Manager

FileManager is a singleton class that handles all file operations related to module, story, and library files.

  • Save, load, delete, etc. over multiple files.
  • Keeps mappings of Files to their FileChannel, and Files to their StoryModel, and uses these to route user commands to the appropriate target, even with many files open at once.

Story Visitor

  • Implementers of the StoryVisitor interface can perform arbitrary operations on all, or part of the story tree.
  • Implements all process<X> methods where is some model object class By passing in the StoryVisitor to a model object's process method, a traverse and process will begin at the corresponding node in the story tree.

There are many uses for the StoryVisitor, in ScriptEase II. Currently, these include:

  • Obtaining relevant information for code generation from the entire tree.
  • Finding StoryComponents and their children to display in the GUI tree.
  • Finding StoryComponents of a particular type, within a tree or sub-tree.
  • ... and much more! Call now! Buy, buy, buy!

As StoryVisitor is an interface, an abstract class has been provided to handle types you don't care about.

  1. Extend the AbstractNoOpStoryVisitor
  2. Implement only the methods that you require for you process
  3. All un-implemented methods will execute as no-ops