ix.ileed
Class ProcessModel

java.lang.Object
  |
  +--ix.ileed.ProcessModel
All Implemented Interfaces:
StatusValues, WatcherListener

public class ProcessModel
extends java.lang.Object
implements WatcherListener, StatusValues

A ProcessModel contains a model of a process and handles the propagation of state changes. There are a number of interior classes so that the whole thing can be contained in one file and can avoid name conflicts with other parts of the panel (e.g. for class names such as "Node").

A ProcessModel receives information from a Watcher and is therefore an implementation of WatcherListener. It sends information to an implementation of ProcessViewer.

Before you can do anything very interesting, you have to install a viewer and read in a process definition. For example:

    ProcessModel model = new ProcessModel();
    model.setViewer(someViewer);
    model.initFromFile("coax-process.lsp");
 

See Also:
WatcherListener, ProcessViewer

Inner Class Summary
(package private)  class ProcessModel.Node
          Nodes represent actions in the process.
(package private) static class ProcessModel.NodeTable
          Nodes are stored in a NodeTable, indexed by pattern.
(package private)  class ProcessModel.OverallCell
          Overall column cells, a member class of ProcessModel.
(package private)  class ProcessModel.OverallCollectionCell
          A subclass of OverallCell that reports the collective status of some earlier row.
 
Field Summary
(package private)  java.util.Vector allNodes
           
(package private)  HashedSet changedNodes
           
(package private)  Domain domain
           
(package private)  ProcessModel.NodeTable nodeTable
           
(package private)  int numberOfCoas
           
(package private)  java.util.Hashtable overallColumn
           
(package private)  java.util.Vector products
           
(package private)  java.util.Hashtable productTable
           
(package private)  java.util.Hashtable rowTable
           
(package private)  ProcessViewer viewer
           
 
Fields inherited from interface ix.icore.process.StatusValues
PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_MEDIUM, PRIORITY_NONE, PRODUCT_BLANK, PRODUCT_COMPLETE, PRODUCT_DRAFT, STATUS_BLANK, STATUS_COMPLETE, STATUS_EXECUTING, STATUS_IMPOSSIBLE, STATUS_NA, STATUS_POSSIBLE
 
Constructor Summary
ProcessModel()
          Create an empty ProcessModel.
 
Method Summary
 void addCoa(int coaNumber)
          Add the actions for a new COA to the model.
(package private)  void addProduct(Product p)
           
(package private)  void addRowElement(ProcessModel.Node node)
           
 void checkConnectivity()
          Checks that we can reach all of the nodes in various ways.
 LList depthFirstFinishOrder(LList roots, Function1 successors)
           
(package private)  ProcessModel.OverallCell ensureOverallCell(java.lang.String action)
           
 LList finalNodes()
           
 LList finalNodes(java.util.Enumeration ne, int level)
           
 ProcessModel.Node findActionNode(java.lang.String action)
           
 ProcessModel.Node findActionNode(java.lang.String action, int coa)
           
protected  ProcessModel.Node findNode(LList pattern)
           
(package private)  ProcessModel.OverallCell findOverallCell(java.lang.String action)
           
 void finishAction(java.lang.String action)
          Called by a watcher when it detects that an action has finished.
 void finishAction(java.lang.String action, int coa)
          Called by a watcher when it detects that an action has finished.
 void finishAction(java.lang.String action, int coa, int level)
          Called by a watcher when it detects that an action has finished.
protected  java.util.Vector fullStateDescription()
           
 java.util.Vector getAllProducts()
           
(package private)  Product getProduct(java.lang.Object name)
           
 void initFromFile(java.lang.String filename)
          Read action definitions from a file.
 LList initialNodes()
           
 LList initialNodes(java.util.Enumeration ne, int level)
           
protected  int[] issueCounts()
           
(package private)  ProcessModel.OverallCell newOverallCellInstance(java.lang.String action)
          Create an instance of an appropriate OverallCell class.
 LList nodesAfter(ProcessModel.Node before)
           
 LList nodesBefore(ProcessModel.Node after)
           
 LList nodesBetween(ProcessModel.Node before, ProcessModel.Node after)
           
 LList nodesInDepthFirstFinishOrder()
           
(package private)  void registerNode(ProcessModel.Node node)
           
 void reset()
          Remove all COAs, their associated actions, and all current state information.
protected  void resetChangeRecord()
           
protected  void seeIfNewCoa(int coa)
           
 void sendFullStateDescription()
          Send the viewer a complete state description, rather than a delta.
 void setViewer(ProcessViewer viewer)
          Install a viewer that will be sent status information when changes occur.
 void startAction(java.lang.String action)
          Called by a watcher when it detects that an action has started.
 void startAction(java.lang.String action, int coa)
          Called by a watcher when it detects that an action has started.
 void startAction(java.lang.String action, int coa, int level)
          Called by a watcher when it detects that an action has started.
protected  void startRecordingChanges()
           
 LList staticExpansionTree()
          Returns a tree that shows the action nesting of the process, to the extent that this can be determined directly from the schema definitions.
protected  java.util.Vector statusChanges()
           
protected  void tellViewer()
           
 LList topLevelNodes()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

viewer

ProcessViewer viewer

domain

Domain domain

nodeTable

ProcessModel.NodeTable nodeTable

allNodes

java.util.Vector allNodes

rowTable

java.util.Hashtable rowTable

overallColumn

java.util.Hashtable overallColumn

numberOfCoas

int numberOfCoas

changedNodes

HashedSet changedNodes

products

java.util.Vector products

productTable

java.util.Hashtable productTable
Constructor Detail

ProcessModel

public ProcessModel()
Create an empty ProcessModel.
Method Detail

setViewer

public void setViewer(ProcessViewer viewer)
Install a viewer that will be sent status information when changes occur.

initFromFile

public void initFromFile(java.lang.String filename)
Read action definitions from a file. Each action definition (or schema) specifies the subactions (if any), a partial order over the subactions, and any special properties of the action that affect how it is modelled. This information is used when building data structures that represent the actions that are present in the process being modelled.

addProduct

void addProduct(Product p)

getProduct

Product getProduct(java.lang.Object name)

getAllProducts

public java.util.Vector getAllProducts()

staticExpansionTree

public LList staticExpansionTree()
Returns a tree that shows the action nesting of the process, to the extent that this can be determined directly from the schema definitions. The tree is a list of entries of the form (pattern subtree).

reset

public void reset()
Remove all COAs, their associated actions, and all current state information. However, the definitions established by the most recent call to initFromFile remain; it is not necessary to call it again after a reset.

addCoa

public void addCoa(int coaNumber)
Add the actions for a new COA to the model. Note that the new COA's number must be exactly one greater than the current number of COAs. The only way to add a higher-numbered COA is to call addCoa more than once.

sendFullStateDescription

public void sendFullStateDescription()
Send the viewer a complete state description, rather than a delta. This is normally a request from the viewer, for instance if it has been ignoring changes (for some reason) and wants to catch up.

fullStateDescription

protected java.util.Vector fullStateDescription()

startAction

public void startAction(java.lang.String action)
Called by a watcher when it detects that an action has started.
Specified by:
startAction in interface WatcherListener

startAction

public void startAction(java.lang.String action,
                        int coa)
Called by a watcher when it detects that an action has started.
Specified by:
startAction in interface WatcherListener

startAction

public void startAction(java.lang.String action,
                        int coa,
                        int level)
Called by a watcher when it detects that an action has started.
Specified by:
startAction in interface WatcherListener

finishAction

public void finishAction(java.lang.String action)
Called by a watcher when it detects that an action has finished.
Specified by:
finishAction in interface WatcherListener

finishAction

public void finishAction(java.lang.String action,
                         int coa)
Called by a watcher when it detects that an action has finished.
Specified by:
finishAction in interface WatcherListener

finishAction

public void finishAction(java.lang.String action,
                         int coa,
                         int level)
Called by a watcher when it detects that an action has finished.
Specified by:
finishAction in interface WatcherListener

seeIfNewCoa

protected void seeIfNewCoa(int coa)

startRecordingChanges

protected void startRecordingChanges()

resetChangeRecord

protected void resetChangeRecord()

tellViewer

protected void tellViewer()

statusChanges

protected java.util.Vector statusChanges()

issueCounts

protected int[] issueCounts()

registerNode

void registerNode(ProcessModel.Node node)

findNode

protected ProcessModel.Node findNode(LList pattern)

findActionNode

public ProcessModel.Node findActionNode(java.lang.String action)

findActionNode

public ProcessModel.Node findActionNode(java.lang.String action,
                                        int coa)

addRowElement

void addRowElement(ProcessModel.Node node)

ensureOverallCell

ProcessModel.OverallCell ensureOverallCell(java.lang.String action)

findOverallCell

ProcessModel.OverallCell findOverallCell(java.lang.String action)

topLevelNodes

public LList topLevelNodes()

initialNodes

public LList initialNodes()

initialNodes

public LList initialNodes(java.util.Enumeration ne,
                          int level)

finalNodes

public LList finalNodes()

finalNodes

public LList finalNodes(java.util.Enumeration ne,
                        int level)

nodesBefore

public LList nodesBefore(ProcessModel.Node after)

nodesAfter

public LList nodesAfter(ProcessModel.Node before)

nodesBetween

public LList nodesBetween(ProcessModel.Node before,
                          ProcessModel.Node after)

nodesInDepthFirstFinishOrder

public LList nodesInDepthFirstFinishOrder()

depthFirstFinishOrder

public LList depthFirstFinishOrder(LList roots,
                                   Function1 successors)

checkConnectivity

public void checkConnectivity()
Checks that we can reach all of the nodes in various ways. This method is not called during the normal operation of the process model but can be called when testing.

newOverallCellInstance

ProcessModel.OverallCell newOverallCellInstance(java.lang.String action)
Create an instance of an appropriate OverallCell class.