All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class mesquite.lib.Snapshot

mesquite.lib.Snapshot

public class Snapshot
extends java.lang.Object
Used by modules (and sometimes other Commandables) to return commands that would restore the module to its current state on file read-in or in other contexts (e.g., cloning a window). On saving a file, a module (currently Manage Mesquite Blocks) recurses through the employee tree, collecting their Snapshots, and using them to compose a Mesquite block for a NEXUS file that will return the active modules and windows to their current state.


Constructor Index

 o Snapshot()

Method Index

 o addLine(String)
Add the given command to the list of commands.
 o addLine(String, MesquiteModule)
Add the given command to the list of commands.
 o addLineIfAnythingToTell(String, MesquiteModule)
Add command if there is any snapshot from module
 o dump()
Dumps the snapshot to the system console
 o getCommand(int)
Returns the given command from the list of commands.
 o getConditional(int)
Returns whether the line is conditional on anything to tell
 o getLine(int)
Returns the given command from the list of commands.
 o getModule(int)
Returns the associated module from the list of commands.
 o getNumLines()
Returns the number of lines in the snapshot.
 o getSnapshotCommands(MesquiteModule, MesquiteFile, String)
accumulate snapshot (e.g., as for MESQUITE block of NEXUS file) beginning at the passed module, as if writing for the file indicated.
 o incorporate(Snapshot, boolean)
Incorporates given Snapshot into current ones, pulling in lines and modules
 o modulePresent(MesquiteModule)
Returns whether the module is associated with some command.
 o suppressCommandsToEmployee(MesquiteModule)
suppress commands to module; used by module that doesn't want to rehire employee

Constructors

 o Snapshot
 public Snapshot()

Methods

 o addLine
 public void addLine(java.lang.String command,
                     mesquite.lib.MesquiteModule module)
Add the given command to the list of commands. This command should be one that hires an employee, and the current module that would represent that hiring should be passed. The command passed is only the first token (command name), not the entire command. Thus addHiringLine("setTreeDrawer", drawTreeTask) would compose a command of the sort "setTreeDrawer 'Arc Tree';".

This allows the module saving the Nexus block to insert immediately afterward the tell It... endTell block of commands that refer to that employee. (this is important to avoid ambiguity of a getEmployee command that can result if more than one employee has the same name. By placing the tell block immediately afterward, that hired employee will get the commands appropriate to just it.

 o addLineIfAnythingToTell
 public void addLineIfAnythingToTell(java.lang.String command,
                                     mesquite.lib.MesquiteModule module)
Add command if there is any snapshot from module

 o suppressCommandsToEmployee
 public void suppressCommandsToEmployee(mesquite.lib.MesquiteModule module)
suppress commands to module; used by module that doesn't want to rehire employee

 o addLine
 public void addLine(java.lang.String commandLine)
Add the given command to the list of commands. The command should be the entire command line EXCEPT the semicolon.

 o incorporate
 public void incorporate(mesquite.lib.Snapshot snap,
                         boolean addTab)
Incorporates given Snapshot into current ones, pulling in lines and modules

 o getLine
 public java.lang.String getLine(int index)
Returns the given command from the list of commands. The line returned is the fully formatted command

 o getCommand
 public java.lang.String getCommand(int index)
Returns the given command from the list of commands.

 o getModule
 public mesquite.lib.MesquiteModule getModule(int index)
Returns the associated module from the list of commands.

 o modulePresent
 public boolean modulePresent(mesquite.lib.MesquiteModule module)
Returns whether the module is associated with some command.

 o getConditional
 public boolean getConditional(int index)
Returns whether the line is conditional on anything to tell

 o getNumLines
 public int getNumLines()
Returns the number of lines in the snapshot.

 o dump
 public void dump()
Dumps the snapshot to the system console

 o getSnapshotCommands
 public static java.lang.String getSnapshotCommands(mesquite.lib.MesquiteModule module,
                                                    mesquite.lib.MesquiteFile file,
                                                    java.lang.String spacer)
accumulate snapshot (e.g., as for MESQUITE block of NEXUS file) beginning at the passed module, as if writing for the file indicated. The spacer string is passed to prefix lines with tabs to give an indented organization. A problem to be solved are dependencies among modules (especially TreeContexts). If a snapshot creating a module A needed by module B is written after the snapshot creating module B, then module B on starting up will not find the needed module A.


All Packages  Class Hierarchy  This Package  Previous  Next  Index