Shared Classes Specification

Author: Travis Emmitt
Date: 14-DEC-1998
Version: 3.4

Contents:

Shared Class Overview

Shared Class Architecture

Shared Class Descriptions


Return to main Software Specification page

Shared Class Overview

We have a number of shared classes that the different systems use. These deal primarily with the management of common data structures used in depicting the different parts of the simulation (FRs, DPs, Modules, etc.). There are also a number of Exceptions classes, and some graphical display primitives.



Shared Class Architecture

Here's a sketch of how some of the shared classes relate to each other:

                                                                       
          BASE CLASSES                        GRAPHICAL VERSIONS       
               Map   . . . . . . . . . . . . . . . DrawableMap
              /   \                                   /
             /     \                                 /
            /    Modules . . . . . . . . . . DrawableModules
           /         \                             /
       Depends        \                           /
                     Nodes . . . . . . . . DrawableNodes

The base classes are used by many different system modules. On the Client side, the base classes are accessed by ClientEngine, ClientRMI, and ClientGUI. Since ClientGUI's job is to represent the simulated system structure graphically (and interactively), it uses both the base classes and the Drawable versions of those classes.

Some other shared classes are Exceptions and Stats, which don't fit in with the organization depicted above.


Shared Class Descriptions

This section describes the different shared classes in detail. It focuses on their duties and interfaces.

The beginning of this section talks about the simulated system structure describing primitives: Node, Module, Depend, and Map, the "base classes".

It then describes the graphical versions of these data structures. The different GUI modules use these to translate the base classes into graphical representations.



Base Classes

There are four base classes: Node, Module, Depend, and Map.

FRs and DPs are Nodes. The FRs are in a "boss" module (e.g., module[0]).

The purpose of the Map data structure (which contains the entire set of the Nodes, Modules, and Depends) is to allow the Server to tell the Clients the current structure and state of the system.

The structure describes the "permanent" characteristics:

The state describes the "temporary" characteristics:

Both the structure and state are contained in the Map data structure.

The Server needs to pass the Map data structure to each client whenever it starts the interactive phase, and also during each "tick" of the clock during the stabilization phase.

Note that by sending the entire Map we are keeping the system very simple and flexible:



A Node represents a functional requirement (FR) or a design parameter (DP). We currently treat FRs and DPs the same. Each Node has a stability, a recovery probability, a destabilization probability (destab), and a name associated with it.

Node Interfaces
Method Throws Purpose
Node ()   This is the default constructor; don't use it.
Node (Node node) BoundsException
NullException
This creates a new Node which is a copy of the specified Node.
Node (boolean stable, double recovery)
DEPRECATED
BoundsException
NullException
This creates a new Node with the specified stability and recovery probability.
Use the construtor with the name instead.
Node (boolean stable, double recovery, double destab, String name) BoundsException
NullException
This creates a new Node with the specified stability, recovery probability, and name.
Node (String source) BoundsException
EqualityException
NullException
ParsingException
This creates a new Node from the specified string.
version 1 format:
t 0.123

version 3 format:
node_name stable recovery destab

node_name - String
stable - "t" or "f"
recovery - double
destab - double

deliminator is " " (space)
void Copy (Node node) BoundsException
NullException
Copies the specified Node's data into the current Node.
double GetDestab ()   Returns the current destabilization probability for the Node.
void GetName (String name)   Returns the name of the Node.
double GetRecovery ()   Returns the current recovery probability for the Node.
boolean IsStable ()   Returns whether or not the Node is currently stable.
void SetDestab (double destab) BoundsException This sets the destabilization probability for the Node. It makes sure the probability is between 0 and 1.
void SetName (String name) NullException This sets the Node's name to the specified string.
void SetRecovery (double recovery) BoundsException This sets the recovery probability for the Node. It makes sure the probability is between 0 and 1.
void SetStable (boolean stable)   This sets the stability value for the Node.
String ToSerial()   Returns a string-encoded representation of the current state of the Node (see Node(String) constructor).
boolean Valid ()   Returns true if Node is valid, false otherwise.
void Validate () BoundsException
NullException
Throws an exception if Node is invalid. Use this prior to accessing the Node's data, so that you don't have to keep checking for errors.
String Verbose ()   Returns a human-readable String representation of this Node.


A Module consists of a number of Nodes, which represent design parameters (DPs) or functional requirements (FRs). The "boss" Module (e.g., modules[0]) contains the FRs, while the other, "developer" Modules contain DPs. Modules also have names.

Module Interfaces
Method Throws Purpose
Module ()
  Default constructor; don't use it.
Module (Module module) BoundsException
IndexException
NewException
NullException
This creates a new Module which is a copy of the specified Module.
Module (int num_nodes, Node nodes[])
DEPRECATED
BoundsException
IndexException
NewException
NullException
This creates a new Module containing the specified Nodes. Note that the Nodes must have been created prior to creation of this Module.
Use the construtor with the name instead.
Module (int num_nodes, Node nodes[], String name)
BoundsException
IndexException
NewException
NullException
This creates a new Module with the specified name containing the specified Nodes. Note that the Nodes must have been created prior to creation of this Module.
Module (String source) BoundsException
EqualityException
IndexException
NullException
ParsingException
This creates a new Module from the specified string.
version 1 format:
(Count) N (Node1) N (Node2) N ... (NodeCount) N

where (Count) is the string representation of the number of nodes, and (NodeX) is the string representation of the Node. "N"is the Node delimiter. (no spaces)

version 2 format:
module_name | num_nodes | node1 | node2 | ... | nodenum_nodes |

module_name - String
num_nodes - int
nodei - see Node constructor

deliminator is "|"
Module (String name, int max_size)
BoundsException
IndexException
NewException
NullException
This creates a random module with the specified name and max size.
void AddNode (Node node) BoundsException
IndexException
NullException
This adds a Node to the Module.
void Copy (Module module) BoundsException
IndexException
NewException
NullException
Copies the specified Module's data into this Module.
void GetName (String name)   Returns the name of the Module.
Node GetNode (int node_id) BoundsException
IndexException
NullException
This returns a reference to the Node specified by the index.
int GetNumNodes ()   This returns the current number of Nodes in the Module.
boolean IsStable () BoundsException
IndexException
NullException
This returns true if all the Nodes in the Module are stable, false otherwise.
boolean NodeExists (int node_id) BoundsException
IndexException
NullException
This returns true if the specified Node exists in the Module, false otherwise.
void SetName (String name) NullException This sets the Module's name to the specified string.
void SetStable (boolean stable) BoundsException
IndexException
NullException
Sets the stability of all the Nodes in the Module to the specified value.
String ToSerial() BoundsException
IndexException
NullException
Returns a string-encoded representation of the current state of the Module (See Module(String) for format details). This includes the state of the individual Nodes contained in the Module. (i.e., this is an aggregate method)
boolean Valid ()   Returns true if Module is valid, false otherwise.
void Validate () BoundsException
IndexException
NullException
Throws an exception if Module is invalid. Use this prior to accessing the Module's data, so that you don't have to keep checking for errors.
String Verbose ()   Returns a human-readable String representation of this Module.


A Depend (dependency) is directional, from a source Node (FR or DP) within one Module to a destination Node within the same or different Module.

Each Depend has a probability associated with it; if the source Node is unstable, this is the probability that it forces the destination Node to destabilize as well.

Depend Interfaces v
Method Throws Purpose
Depend ()   This is the default constructor; don't use it.
Depend (Depend depend) BoundsException This creates a new Depend, which is a copy of the specified Depend.
Depend (int source_module_id, int source_node_id, int dest_module_id, int dest_node_id, double probability) BoundsException This creates a new Depend(ency) between the two specified Nodes, with the specified probability. The Nodes are specified by their module id and node id within that module.
Depend (String source) BoundsException
EqualityException
NullException
ParsingException
This creates a new Depend from the specified string.
version 1 format:
(SourceModuleIndex) D (SourceNodeIndex) D (DestModuleIndex) D (DestNodeIndex) D (Probability) D

where "D" is the Dependency delimiter. (no spaces)

version 2 format:
source_module_id source_node_id dest_module_id dest_node_id probability

source_module_id - int
source_node_id - int
dest_module_id - int
dest_node_id - int
probability - double

deliminator is " " (space)
void Copy (Depend depend) BoundsException
NullException
Copies the specified Depend's data into this Depend.
int GetDestModule ()
DEPRECATED
  This returns the index of the destination Module.
Use GetDestModuleID instead.
int GetDestModuleID ()   This returns the index of the destination Module.
int GetDestNode ()
DEPRECATED
  This returns the index of the destination Node.
Use GetDestNodeID instead.
int GetDestNodeID ()   This returns the index of the destination Node.
double GetProbability ()   This returns the probability for the dependency.
int GetSourceModule ()
DEPRECATED
  This returns the index of the source Module.
Use GetSourceModuleID instead.
int GetSourceModuleID ()   This returns the index of the source Module.
int GetSourceNode ()
DEPRECATED
  This returns the index of the source Node.
Use GetSourceNodeID instead.
int GetSourceNodeID ()   This returns the index of the source Node.
void SetDest (int module_id, int node_id) BoundsException This sets the destination to the specified Node.
void SetProbability (double prob) BoundsException This sets the probability to the specified value. The probability must be between 0 and 1.
void SetSource (int module_id, int node_id) BoundsException This sets the source to the specified Node.
String ToSerial()   Returns a string-encoded representation of the Depend. See Depend (String) for format. Note that this does not included encodings of the actual source and destination Nodes, since Depend only deals with references to these Nodes.
boolean Valid ()   Returns true if Depend is valid, false otherwise.
void Validate () BoundsException Throws an exception if the Depend is invalid. Use this prior to accessing the Depend's data, so that you don't have to keep checking for errors.
String Verbose ()   Returns a human-readable String representation of this Depend.


A Map represents the entire set of Modules and Dependencies in the system. It also contains "finalized" and "editable" bits, which the server uses to indicate whether the current state is final or editable.

Map Interfaces
Method Throws Purpose
Map ()   This is the default constructor; don't use it.
Map (Map map) BoundsException
IndexException
NewException
NullException
This is the copy constructor; it copies the specified Map's data into the newly created map.
Map (int num_modules, Module modules[], int num_depends, Depend depends[]) BoundsException
IndexException
NewException
NullException
This creates a new Map containing the specified Modules and Depends. Note that the Modules and Depends must have been created prior to creation of this Map.
Map (String source)
throws Exception
BoundsException
EqualityException
IndexException
NewException
NullException
ParsingException
This creates a new Map from the specified string.
version 1 format:
(ModCount) M (Module0) M (Module1) M ... (Module(ModCount)) M (DependCount) R (Depend0) R (Depend1) R ... (Depend(DependCount)) R (Finalized)

where (ModCount) is the number of Modules in the map, (Module#) is the String representation of the Module, (DependCount) is the number of Depend(encies) in the Map, (Depend#) is the String representation of the Dependency, (finalized is either "t" or "f"), "M" is the Module delimiter, and "R" is the Dependency delimiter.

version 2 format:
num_modules ^ module1 ^ module2 ^ ... ^ modulenum_modules ^ num_depends ^ depend1 ^ depend2 ^ ... ^ dependnum_depends ^ finalized ^ editable

num_modules - int
modulei - see Module constructor
num_depends - int
dependi - see Depend constructor
finalized - "t" or "f"
editable - "t" or "f"

deliminator is "^"
Map (int max_size)
BoundsException
IndexException
NewException
NullException
This creates a random map of the specified size.
void AddDepend (Depend depend) BoundsException
IndexException
NullException
This adds a Depend to the Map.
void AddModule (Module module) BoundsException
IndexException
NullException
This adds a Module to the Map.
void Copy (Map map) BoundsException
IndexException
NewException
NullException
Copies the specified Map's data into this Map.
boolean DependExists (int depend_id) BoundsException
IndexException
NullException
This returns true if the Depend specified by the index exists, false otherwise.
Depend GetDepend (int depend_id) BoundsException
IndexException
NullException
This returns a reference to the Depend specified by the index.
int[] GetDependeeModuleIDs (int our_module_id, int his_module_id)
DEPRECATED
BoundsException
IndexException
NewException
NullException
This returns a list of IDs of Modules upon which our Node depends.
int[] GetDependeeModuleIDs (int our_module_id)
DEPRECATED
BoundsException
IndexException
NewException
NullException
This returns a list of IDs of Modules upon which any Nodes in our Module depend.
int[] GetDependeeNodeIDs (int our_module_id, int our_node_id, int his_module_id)
DEPRECATED
BoundsException
IndexException
NewException
NullException
This returns a list of IDs of Nodes in the specified Module upon which our Node depends.
int[] GetDependeeNodeIDs (int our_module_id, int his_module_id)
DEPRECATED
BoundsException
IndexException
NewException
NullException
This returns a list of IDs of Nodes in the specified Module upon which any Nodes in our Module depend.
int[] GetDependerModuleIDs (int our_module_id, int his_module_id)
DEPRECATED
BoundsException
IndexException
NewException
NullException
This returns a list of IDs of Modules which depend upon our Nodes.
int[] GetDependerModuleIDs (int our_module_id)
DEPRECATED
BoundsException
IndexException
NewException
NullException
This returns a list of IDs of Modules which depend upon any Nodes in our Module.
int[] GetDependerNodeIDs (int our_module_id, int our_node_id, int his_module_id)
DEPRECATED
BoundsException
IndexException
NewException
NullException
This returns a list of IDs of Nodes in the specified Module which depend upon our Node.
int[] GetDependerNodeIDs (int our_module_id, int his_module_id)
DEPRECATED
BoundsException
IndexException
NewException
NullException
This returns a list of IDs of Nodes in the specified Module which depend upon any Nodes in our Module.
int[] GetDependIDs (int our_module_id, int our_node_id, int his_node_id, boolean we_depend) DEPRECATED BoundsException
IndexException
NewException
NullException
This returns a list of IDs of Modules (or Nodes in the specified Module) which our Module/Node has dependencies to/from.
Use GetDepends instead.
Depend [] GetDepends (int module_id, int node_id, boolean to) BoundsException
IndexException
NewException
NullException
This returns a array of Depends to or from the specified Node or Module.
Use this instead of the GetDependIDs methods.
Module GetModule (int module_id) BoundsException
IndexException
NullException
This returns a reference to the Module specified by the index.
Node GetNode (int module_id, int node_id) BoundsException
IndexException
NullException
This returns a reference to the Node specified by the indexes.
int GetNumDepends ()   This returns the current number of Depends in the Map.
int GetNumModules ()   This returns the current number of Modules in the Map.
boolean IsEditable ()   This returns the current value of the editable bit.
boolean IsFinal ()   This returns the current value of the finalized bit.
boolean IsStable () BoundsException
IndexException
NullException
This returns true if all the Modules in the Map are stable, false otherwise.
boolean ModuleExists (int module_id) BoundsException
IndexException
NullException
This returns true if the Module specified by the index exists, false otherwise.
boolean NodeExists (int module_id, int node_id) BoundsException
IndexException
NullException
This returns true if the Node specified by the indexes exists, false otherwise.
void SetEditable (boolean editable)   This sets the editable bit to the specified value.
void SetFinal (boolean finalized)   This sets the finalized bit to the specified value.
void SetStable (boolean stable) BoundsException
IndexException
NullException
Sets the stability of all the Nodes in all the Modules to the specified value.
void ToggleNode (int module_id, int node_id) BoundsException
IndexException
NullException
This toggles the stability value of the specified Node.
String ToSerial () BoundsException
IndexException
NullException
Returns a string-encoded representation of the current state of the entire Map. See Map(String) constructor for format details.
boolean Valid ()   Returns true if Map is valid, false otherwise.
void Validate () BoundsException
IndexException
NullException
Throws an exception if the Map is invalid. Use this prior to accessing the Map's data, so that you don't have to keep checking for errors.
String Verbose ()   Returns a human-readable String representation of this Map.
String Verbose (int module_id, int node_id)   Returns human-readable details about the specified Module and its dependencies.
String Verbose (int module_id, int node_id)   Returns human-readable details about the specified Node and its dependencies.




Drawable Classes

These are used for handling the graphical representation of the base classes. These classes are not interactive in themselves; they need a GUI module to handle events and control the Drawables' positioning and appearance.


A DrawableNode is a graphical representation of a Node. Properties:

DrawableNode Interfaces
Method Throws Purpose
DrawableNode (Node node, int bounds[]) BoundsException
IndexException
NullException
This creates a new DrawableNode representing the specified Node, with the specified bounds.
void Draw (Graphics graphics, int mode) GraphicsException
NullException
This displays the DrawableNode on the screen. The mode is used for providing viewing options:
  • NORMAL_MODE = 0 // normal viewing mode
  • SHOW_ALL_NODES = 1 // show all nodes, zoomed or not
  • DEPENDEE_MODE = 2 // flag the node as a dependee
  • DEPENDER_MODE = 3 // flag the node as a depender
int GetCenterX ()   This returns the X coordinate of the center of the DrawableNode.
int GetCenterY ()   This returns the Y coordinate of the center of the DrawableNode.
boolean Inside (int x, int y)   This returns true if the specified coordinate is within the DrawableNode, false otherwise.


A DrawableModule is a graphical representation of a Module. It can be zoomed or unzoomed. Properties:

DrawableModule Interfaces
Method Throws Purpose
DrawableModule (Module module, int bounds[], boolean editable, boolean zoomed) BoundsException
IndexException
NewException
NullException
This creates a new DrawableModule representing the specified Module, with the specified bounds, editability, and zoom level.
void Draw (Graphics graphics, int mode) BoundsException
GraphicsException
IndexException
NullException
This displays the DrawableModule on the screen. The mode is used for providing viewing options:
  • NORMAL_MODE = 0 // normal viewing mode
  • SHOW_ALL_NODES = 1 // show all nodes, zoomed or not
  • DEPENDEE_MODE = 2 // flag the node as a dependee
  • DEPENDER_MODE = 3 // flag the node as a depender
int GetCenterX ()   This returns the X coordinate of the center of the DrawableModule.
int GetCenterX (int node_id) BoundsException
IndexException
NullException
This returns the X coordinate of the center of the specified DrawableNode.
int GetCenterY ()   This returns the Y coordinate of the center of the DrawableModule.
int GetCenterY (int node_id) BoundsException
IndexException
NullException
This returns the Y coordinate of the center of the specified DrawableNode.
DrawableNode GetDrawableNode (int node_id) BoundsException
IndexException
NullException
This returns a reference to the specified DrawableNode.
boolean Inside (int x, int y)   This returns true if the specified coordinate is within the DrawableModule, false otherwise.
boolean InsideNode (int node_id, int x, int y) BoundsException
IndexException
NullException
This returns true if the specified coordinate is within the specified DrawableNode, false otherwise.


A DrawableMap is a graphical representation of a Map. Properties:

It also can have a zoomed module in the middle, whose nodes are always visible.

DrawableMap Interfaces
Method Throws Purpose
DrawableMap (Map map, int bounds[], int edit_id) BoundsException
IndexException
NewException
NullException
This creates a new DrawableMap representing the specified Map at the specified coordinates, with an indication of which Module this Client owns. This creates a new DrawableModule for each Module and a new DrawableDepend for each Depend.
void Draw (Graphics graphics, boolean show_all_nodes) BoundsException
GraphicsException
IndexException
NewException
NullException
This displays the Map on the screen. If show_all_nodes is true, we show all nodes in all modules, regardless of whether or not they are in the zoomed module.
void DrawDepend (Graphics graphics) BoundsException
GraphicsException
IndexException
NullException
Draws a dependency arc from specified source to specified destination. This can handle all combinations of modular and nodal dependencies. It also highlights the source and destination nodes by setting their colors to special values via the DEPENDEE_MODE and DEPENDER_MODE viewing options.
void DrawDepends (Graphics graphics) BoundsException
GraphicsException
IndexException
NewException
NullException
This displays dependencies from our Module/Node to other Modules (or nodes in the specified Module) and vice-versa.
void DrawMatrix (Graphics graphics) BoundsException
GraphicsException
IndexException
NewException
NullException
Draws a matrix representation of the Map's current dependencies and stabilities.
int GetCenterX ()   This returns the X coordinate of the center of the DrawableMap.
int GetCenterX (int module_id) BoundsException
IndexException
NullException
This returns the X coordinate of the center of the specified DrawableModule.
int GetCenterY ()   This returns the Y coordinate of the center of the DrawableMap.
int GetCenterY (int module_id) BoundsException
IndexException
NullException
This returns the Y coordinate of the center of the specified DrawableModule.
DrawableModule GetDrawableModule (int module_id) BoundsException
IndexException
NullException
Returns a reference to the DrawableModule specified by the index.
DrawableNode GetDrawableNode (int module_id, int node_id) BoundsException
IndexException
NullException
Returns a reference to the DrawableNode specified by the indexes.
int GetPointedModuleID (int x, int y) BoundsException
IndexException
NullException
This returns the ID of the Module currently pointed at, or -1 if none.
int GetPointedNodeID (int x, int y) BoundsException
IndexException
NullException
This returns the ID of the Node currently pointed at, or -1 if none.
int GetZoomID ()   This returns the ID of the currently zoomed module, or -1 if none zoomed.
boolean Inside (int x, int y)   This returns true if the specified coordinate is within the DrawableMap, false otherwise.
boolean InsideModule (int module_id, int x, int y) BoundsException
IndexException
NullException
This returns true if the specified coordinate is within the specified DrawableModule, false otherwise.
boolean InsideNode (int module_id, int node_id, int x, int y) BoundsException
IndexException
NullException
This returns true if the specified coordinate is within the specified DrawableNode, false otherwise.
void SelectModule (int module_id) BoundsException
IndexException
NullException
Allows map to keep track of which DrawableModule is selected (for displaying dependencies).
void SelectNode (int node_id) BoundsException
IndexException
NullException
Allows map to keep track of which DrawableNode is selected (for displaying dependencies).
boolean Zoom (int module_id) BoundsException
IndexException
NullException
If specified module is zoomed in, this zooms out; otherwise, it zooms in on the specified module.




Exceptions

We have created a set of Exception classes. Each Exception class consists of a set of constructors with varying numbers of arguments. Many of these constructors are designed as shortcuts for building the descriptive Exception string.

In the interests of simplicity and brevity, we won't list the individual constructors available here. This is acceptible because developers who wish to throw these exceptions can use the default constructors (either no arguments or a single string argument). Likewise, developers who catch these Exceptions can use the standard Exception method. You can use the shortcut

Exceptions
Exception Meaning
BoundsException An integer or floating point is not within a pre-defined set of bounds. (e.g. probabilities need to be between 0 and 1)
EqualityException A value does not equal its expected value. This is used primarily for sanity checking.
GraphicsException The Graphics object has thrown an exception.
GUIException The GUI data structure and/or implementation are invalid. This is a high-level exception, and is best used by passing it the low-level exception that triggered it.
IndexException Invalid index in an array (e.g., outside array bounds).
MapException The Map (base-class) data structure and/or implementation are invalid. This is a high-level exception, and is best used by passing it the low-level exception that triggered it.
MapReadException There was an error reading the Map from either File or over RMI.
NewException There was an error creating an object or array via "new".
NullException An object is unexpectedly null.
ParsingException A string could not be properly parsed. This happens when a predefined input format is violated.
StatsException The Stats data structure and/or implementation are invalid. This is a high-level exception, and is best used by passing it the low-level exception that triggered it.




Other Shared Classes

Here we describe some of the other, miscellaneous shared classes that we use.



A Stats object represents summary stabilization statistics.

Stats Interfaces
Method Throws Purpose
Stats (int num_modules) BoundsException
IndexException
NewException
This creates a Statistics object for handling the specified number of modules.
int GetTotalDestabilizations () BoundsException
IndexException
Returns the total number of destabilizations in all modules.
int GetTotalDestabilizations (int module_id) BoundsException
IndexException
Returns the total number of destabilizations in specified module.
int GetTotalRecoveries () BoundsException
IndexException
Returns the total number of recoveries in all modules.
int GetTotalRecoveries (int module_id) BoundsException
IndexException
Returns the total number of recoveries in specified module.
int GetTotalUnstableNodes () BoundsException
IndexException
Returns the total number of unstable nodes in all modules.
int GetTotalUnstableNodes (int module_id) BoundsException
IndexException
Returns the total number of unstable nodes in specified module.
int GetTurn ()   Returns the current turn number.
int GetTurnDestabilizations () BoundsException
IndexException
Returns the number of destabilizations in all modules for this turn.
int GetTurnDestabilizations (int module_id) BoundsException
IndexException
Returns the number of destabilizations in specified module for this turn.
int GetTurnRecoveries () BoundsException
IndexException
Returns the number of recoveries in all modules for this turn.
int GetTurnRecoveries (int module_id) BoundsException
IndexException
Returns the number of recoveries in specified module for this turn.
int GetTurnUnstableNodes () BoundsException
IndexException
Returns the number of unstable nodes in all modules for this turn.
int GetTurnUnstableNodes (int module_id) BoundsException
IndexException
Returns the number of unstable nodes in specified module for this turn.
void LogTick (int module_id, int recoveries, int destabilizations, int unstable_nodes) BoundsException
IndexException
This characterizes the current "clock tick" for the specified module; it stores the current conditions for that module and updates the associated counts.
void Reset() IndexException This resets all counts to 0.
String Verbose ()   Returns the human-readable representation of the current statistics for all the Modules, plus the Map.
String Verbose (int module_id)   Returns the human-readable representation of the current statistics for the specified Module, plus the Map.


A ClientConnectStatus object contains the number of users of the system, and the connection and submission status of each user.

ClientConnectStatus Interfaces
Method Throws Purpose
ClientConnectStatus () BoundsException This is the default constructor. Sets the number of users to zero and sets each user's connection and submit status to false (unconnected, no submissions).
ClientConnectStatus (ClientConnectStatus source) BoundsException This is the copy constructor.
ClientConnectStatus (int num_users) BoundsException This is another constructor. Sets the number of users to the value of the argument and sets each user's connection and submission status to false (unconnected).
void SetNumClients (int num) BoundsException Sets the number of users of the system.
void SetClientConnStatus (int index, boolean connect) BoundsException Sets the connection status of the user indicated by index to connect. A status of false means unconnected. A status of true means connected.
void SetClientSubStatus (int index, boolean submit) BoundsException Sets the submission status of the user indicated by index to submit. A status of false means waiting for submission. A status of true means submitted.
int GetNumClients ()   Returns the number of users of the system.
boolean GetClientConnStatus (int index) BoundsException Returns the connection status of the user indicated by the index argument.
boolean GetClientSubStatus (int index) BoundsException Returns the submission status of the user indicated by the index argument.


A Connections object is used to track all connections in ServerRMI. It is passed to DemonRMI, then to the DemonEngine.

Connections Interfaces
Method Throws Purpose
Connections (int exp_clients, int exp_demons) Exception This creates a new Connections object, initializes all relevant data.
int AddClient (int index, ClientRMIIface obj) BoundsException If the client's id is OK, then add all data, return its random number, otherwise return false.
boolean RemoveClient (int index, int password) Exception If the client is there, then remove it, and its binding and iface information.
int AddDemon (int index, DemonRMIIface obj) Exception If the demon's iface is OK, then add its info. Can only be invoked once.
boolean RemoveDemon (int index, int password) Exception The Demon has been shut down.
void SetAllSubmitFalse () Exception At either the beginning of a new run, or the end of the old run, set all submittedstats to false.
ClientRMIIface GetClientIface (int index) BoundsException If the client has registered, this returns its interface. If not, a null is returned instead.
DemonRMIIface GetDemonIface (int index) BoundsException If the demon has registered, this returns its interface. If not, a null is returned instead.
boolean GetDemonConnStatus (int index)   If the demon has registered, this returns a true. Otherwise, false.
void SetDemonConnStatus (int index, boolean status)   Sets the status of demon connection to either true or false.
void SetNumDemons (int number)   Sets the number of expected demons.
int GetNumDemons ()   Returns the number of expected demons.
int UniqueRandom (int[] list, int listsize)   Gets passed a list of ints and a size of the list. The routine will pick a unique random integer not already in the list.



Return to the main Software Specification page
Revision history:

Version 3.4 - 14-DEC-1998 txe
Fixed format, dates, added new exceptions, added Connections

Version 3.3 - 07-DEC-1998 jpg
Updated ClientConnectStatus

Version 3.2 - 02-DEC-1998 txe
Added Map.editable bit and related methods.

Version 3.1 - 01-DEC-1998 rgb
Updated status in ClientConnectStatus from boolean to int

Version 3.0 - 30-NOV-1998 txe
Added Node destabilization variable and related methods

Version 2.3 - 20-NOV-1998 txe
Added GetDepends()

Version 2.2 - 19-NOV-1998 txe
Added random Map/Module constructors

Version 2.1 - 17-NOV-1998 txe
Added Map.Verbose (module_id) and Map.Verbose (module_id, node_id)
Added DrawableMap.DrawMatrix ()

Version 2.0 - 16-NOV-1998 txe
Initial creation, split from spec.html
Finished base classes, drawable classes, and exceptions