Class GlobalJoin

java.lang.Object
  |
  +--GlobalJoin
All Implemented Interfaces:
java.lang.Cloneable

public class GlobalJoin
extends java.lang.Object
implements java.lang.Cloneable

Global Join

This class is auxillary in the construction of a flat Uppaal document as done by Flatten. It stores information about global joins which are treated special in the translations, as they can incorporate mulit-synchronization.

The extremal case of a global join is a simple exit of a sub-component. It makes sense to treat it in these lines, for the guards and assignments of the connectors still have to be collected.

Run-to completion steps

As for the semanics of the guards/assigments, in Vanilla-1 we follow the example of Rhapshody: all guards are conjuncted (logical AND), before the first step is taken. The assignments are executed without any pre-determined order (i.e. conflicts are the responsibility of the modeller)

Note

A GlobalJoin grows 'itself' and forks, if it has several possibilities to continue to grow. It uses many methods from Flatten to access the relevant elements.

Version:
Vanilla-1 Sun Apr 1 15:19:20 2001
Author:
M. Oliver Möller
See Also:
Flatten, HierarchicalDocumentReader

Field Summary
 java.util.Vector allAssignments
          Vector containing all assignments as textual String (with the proper renaiming), including the one of the root-transition (if present).
static java.util.Vector allGlobalJoins
          The (global) Vector, all joins are collected in

This is where the additional join is planted to, if the clone() method is called.
 java.util.Vector allGuards
          Vector containing all guards as textual String (with the proper renaiming), including the one of the root-transition (if present).
 java.util.Vector allHierarchicalStartLocations
          The (growing) collection of all the (hierarchical) basic locations, from where the join might start.
The entries of this Vector are TinstElementPairs.
private static ComponentMapper cm
          ComponentMapper to help access.
The entries in it are created by Flatten.
static boolean debug
          For Spamming out information
 java.util.Stack growObligations
          Contains all the unfinished intermediates nodes, i.e.
private static HierarchicalDocumentReader hdr
          The hierarchical document reader
static InstantiationTree iTree
          The (global) tree of instantiation, these joins are relative to.
This is not patrticular to one global join.
Not copied, when cloned.
 TextualInstantiation rootTinst
          The TextualInstantiation, where the rootTransition is instantiated in.
 java.util.Vector rootTransitions
          A list of transitions, that is taken, after the join has been transformed.
(i.e.
static boolean sanityChecks
          Setting this true, slows down but is good for debugging.
 int threshold
          Number of locations that are required to take the join.
 java.util.Stack tinstsToExit
          Stack that collects the textual instantiaions, that have to be exited, when the join is taken.
It preserves a partial order in the sense, that the top-most element in the stack is always at the lowest level and a sub-component A of a component B is always higher in the stack than B.
 java.lang.String triggerVariable
          Name of the counter associated with the global join.
It is also used as a trigger to perform the join completly
static int triggerVariableCounter
          To make trigger Variables unique
 
Constructor Summary
private GlobalJoin()
          Internal constructor, used for cloning (and of course not setting the static fields again).

Needed also, when getGlobalJoin(org.w3c.dom.Element, TextualInstantiation) did not yield an existing join.
 
Method Summary
 java.lang.Object clone()
          Returns a copy of this object, i.e.
static java.util.Stack cloneStackOfPointers(java.util.Stack original)
          Clones a stack of pointers, preserving the order.

Assumes that a stack is sorted, starting with position 0 as the bottommost element.
private static java.util.Vector cloneVectorOfPointers(java.util.Vector original)
          Returns a new Vector containing all (pointers to) objects of the Vector in the same order.
private  java.util.Vector cloneVectorOfStrings(java.util.Vector original)
          Returns a new Vector containing all the strings of the old one (intentionally, but not necessarily in the same order).
private  void finishGrowth()
          Grow loop
static GlobalJoin getGlobalJoin(org.w3c.dom.Element theRootTransition, TextualInstantiation theTinst)
          Constructor specifying the root transition (in the hierarchical version)

Throws Exception, if HierarchicalDocumentReader.addGuardsAndAssignmentsOfConnectionInContext fails.

If the second argument is Flatten.rootInstDummy, then this gobal join is global exit of a component.
 org.w3c.dom.Element getTopmostComponent()
          Returns the (hierarchical) component that is left here, as seen from the rootTransitions.
 org.w3c.dom.Element getTopmostExit()
          Returns the (only) exit that the global join is allowed to be specific to, before finishGrowth() is called.

Thrwos exception, if it is not exactly one.
 void grow(TextualInstantiation tinst, org.w3c.dom.Element exitOrExitpoint)
          Main method telling the global join to continue to grow, starting with one particular <exit> or <exitpoint> the search for possibly different growth stops, when the listOfExitPoints contains only exits of OR templates/components if a grow is completed, the join is defined completely the last thing that is set is the triggerVariable if at some point in the growing, the join has several options to continue, it splits itself according to these options, adds all of the new ones to the Vector allGlobalJoins and calls grow() on them
static void growAll()
          Finish growing all global joins.

That typicaly increases their number.
static void init(ComponentMapper theCm, HierarchicalDocumentReader theHdr)
          Required static setups
private static java.lang.String inventNewTriggerVariable()
          Make a new Variable name
private  void stopGrowingThisOne()
          Remove from {link #allGlobalJoins} and terminate the growth obligations.
 java.lang.String toString()
          Exhaustively describes this global join
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

hdr

private static HierarchicalDocumentReader hdr
The hierarchical document reader

cm

private static ComponentMapper cm
ComponentMapper to help access.
The entries in it are created by Flatten.

iTree

public static InstantiationTree iTree
The (global) tree of instantiation, these joins are relative to.
This is not patrticular to one global join.
Not copied, when cloned.

allGlobalJoins

public static java.util.Vector allGlobalJoins
The (global) Vector, all joins are collected in

This is where the additional join is planted to, if the clone() method is called.

triggerVariableCounter

public static int triggerVariableCounter
To make trigger Variables unique

sanityChecks

public static boolean sanityChecks
Setting this true, slows down but is good for debugging.

debug

public static boolean debug
For Spamming out information

growObligations

public java.util.Stack growObligations
Contains all the unfinished intermediates nodes, i.e. TinstElementPairs.
They are worked off in the while loop finishGrowth().

triggerVariable

public java.lang.String triggerVariable
Name of the counter associated with the global join.
It is also used as a trigger to perform the join completly

threshold

public int threshold
Number of locations that are required to take the join.

(should be identical to the number of textual instantiation to exit , right?)

tinstsToExit

public java.util.Stack tinstsToExit
Stack that collects the textual instantiaions, that have to be exited, when the join is taken.
It preserves a partial order in the sense, that the top-most element in the stack is always at the lowest level and a sub-component A of a component B is always higher in the stack than B.

rootTransitions

public java.util.Vector rootTransitions
A list of transitions, that is taken, after the join has been transformed.
(i.e. the starting point of these transitions is the root of the join)

rootTinst

public TextualInstantiation rootTinst
The TextualInstantiation, where the rootTransition is instantiated in.

allGuards

public java.util.Vector allGuards
Vector containing all guards as textual String (with the proper renaiming), including the one of the root-transition (if present).

allAssignments

public java.util.Vector allAssignments
Vector containing all assignments as textual String (with the proper renaiming), including the one of the root-transition (if present).

allHierarchicalStartLocations

public java.util.Vector allHierarchicalStartLocations
The (growing) collection of all the (hierarchical) basic locations, from where the join might start.
The entries of this Vector are TinstElementPairs.
Constructor Detail

GlobalJoin

private GlobalJoin()
Internal constructor, used for cloning (and of course not setting the static fields again).

Needed also, when getGlobalJoin(org.w3c.dom.Element, TextualInstantiation) did not yield an existing join.
Does NOT insert the new join in allGlobalJoins.
Method Detail

getGlobalJoin

public static GlobalJoin getGlobalJoin(org.w3c.dom.Element theRootTransition,
                                       TextualInstantiation theTinst)
                                throws java.lang.Exception
Constructor specifying the root transition (in the hierarchical version)

Throws Exception, if HierarchicalDocumentReader.addGuardsAndAssignmentsOfConnectionInContext fails.

If the second argument is Flatten.rootInstDummy, then this gobal join is global exit of a component.

init

public static void init(ComponentMapper theCm,
                        HierarchicalDocumentReader theHdr)
Required static setups

grow

public void grow(TextualInstantiation tinst,
                 org.w3c.dom.Element exitOrExitpoint)
          throws java.lang.Exception
Main method telling the global join to continue to grow, starting with one particular <exit> or <exitpoint>

Default-Exits

A default exit is reached by all locations in this template and by all components.
In particular, it is assumed that every exit of every component is connected to the default exit.

finishGrowth

private void finishGrowth()
                   throws java.lang.Exception
Grow loop

stopGrowingThisOne

private void stopGrowingThisOne()
Remove from {link #allGlobalJoins} and terminate the growth obligations.

growAll

public static void growAll()
                    throws java.lang.Exception
Finish growing all global joins.

That typicaly increases their number.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a copy of this object, i.e.

DEEP copies of fields

SHALLOW copies of fields

Uncopied (inner-eye-dots of clones)

Static fields are of course not cloned.

The clone is automatically inserted in the Vector allGlobalJoins.
Overrides:
clone in class java.lang.Object

cloneVectorOfStrings

private java.util.Vector cloneVectorOfStrings(java.util.Vector original)
                                       throws java.lang.CloneNotSupportedException
Returns a new Vector containing all the strings of the old one (intentionally, but not necessarily in the same order).

Throws an CloneNotSupportedException, if one of the contents is not a String.

cloneStackOfPointers

public static java.util.Stack cloneStackOfPointers(java.util.Stack original)
Clones a stack of pointers, preserving the order.

Assumes that a stack is sorted, starting with position 0 as the bottommost element.

cloneVectorOfPointers

private static java.util.Vector cloneVectorOfPointers(java.util.Vector original)
Returns a new Vector containing all (pointers to) objects of the Vector in the same order.
The 'contents' themself are not cloned.

inventNewTriggerVariable

private static java.lang.String inventNewTriggerVariable()
Make a new Variable name

getTopmostComponent

public org.w3c.dom.Element getTopmostComponent()
                                        throws java.lang.Exception
Returns the (hierarchical) component that is left here, as seen from the rootTransitions.

getTopmostExit

public org.w3c.dom.Element getTopmostExit()
                                   throws java.lang.Exception
Returns the (only) exit that the global join is allowed to be specific to, before finishGrowth() is called.

Thrwos exception, if it is not exactly one.

toString

public java.lang.String toString()
Exhaustively describes this global join
Overrides:
toString in class java.lang.Object