|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.DisplayGraph
public abstract class DisplayGraph
All tools used to display Scale graphs must extend this class.
$Id: DisplayGraph.java,v 1.31 2007-08-27 18:26:25 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
The class instances that are displayed must adhere to the DisplayNode interface.
The sequence to using a display graph is
DisplayGraph
instance
newGraph()
addEdge()
and
addNode()
.
openWindow()
interact()
Both graph files and GUI instantiations may be generated by classes derived from this base class.
It is important that every program, that creates a
DisplayGraph
instance, call the
interact()
method and use System.exit()
to terminate. The graphical display class may create additional
threads which may not terminate when all of the windows are closed.
Thus a simple return from the main()
method will not
necessarily terminate the process. The interact()
method should be programmed to return only when all the windows are
closed. Then, the sequence
display.interact(); System.exit(0);will guarantee proper termination of the complete process.
interact
and closeWindow
methods do not
need to do anything other than just return. The file containing
the graphing commands should be created and closed by the
openWindow
method.
DisplayNode
Field Summary | |
---|---|
static int |
DISPLAY_EDGE_LABELS
Grap attribute: display edge labels. |
protected static java.lang.String |
outputPath
|
static int |
SHOW_ANNO
Display annotations. |
static int |
SHOW_CDG
Display control dependence. |
static int |
SHOW_CLEF
Display Clef types & declarations. |
static int |
SHOW_DD
Display data dependence relations. |
static int |
SHOW_DEFUSE
Display def-use links. |
static int |
SHOW_DOM
Display dominance relations. |
static int |
SHOW_EXPR
Display expressions - both high & low. |
static int |
SHOW_EXPR_MASK
Mask for SHOW_EXPR, SHOW_LOW_EXPR, SHOW_HIGH_EXPR. |
static int |
SHOW_HIGH_EXPR
Display high expressions only. |
static int |
SHOW_LOW_EXPR
Display low expressions only. |
static int |
SHOW_MAYUSE
Display may-use, may-def links. |
static int |
SHOW_PDOM
Display post dominance relations. |
static int |
SHOW_TYPE
Display Clef types & declarations. |
Constructor Summary | |
---|---|
DisplayGraph()
|
Method Summary | |
---|---|
protected void |
addDisplayString(java.lang.String v,
java.lang.StringBuffer buf)
Convert a string to a form suitable for display and append it to the StringBuffer. |
abstract void |
addEdge(DisplayNode n1,
DisplayNode n2,
DColor color,
DEdge edgeAttributes,
java.lang.Object edgeInfo)
Add an edge to the graph from node n1 to node n2. |
abstract void |
addNode(DisplayNode n)
Add a node to the graph. |
abstract void |
closeWindow(java.lang.String context)
This closes an existing visualization window. |
static DisplayGraph |
getVisualizer()
Return the current visualizer or null if none. |
static void |
initColors()
Generate the java.awt.Color values for the colors array. |
abstract void |
interact()
Respond to interative events with this display. |
abstract void |
newGraph(java.lang.String context,
boolean top)
Initialize for a new graph. |
abstract void |
openWindow(java.lang.String context,
java.lang.String title,
int graphAttributes)
This opens a new visualization window. |
static void |
setOutputPath(java.lang.String path)
Specify the path to use when creating graphic display files. |
static void |
setVisualizer(DisplayGraph v)
Make the specified DisplayGraph available to
all parts of the process. |
abstract void |
terminate()
Terminates the visualizer process. |
abstract boolean |
visited(DisplayNode n)
Return true if the node has been processed. |
abstract boolean |
windowExists(java.lang.String context)
Return true if the window for the given context still exists. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DISPLAY_EDGE_LABELS
public static final int SHOW_DEFUSE
public static final int SHOW_MAYUSE
public static final int SHOW_CLEF
public static final int SHOW_TYPE
public static final int SHOW_ANNO
public static final int SHOW_EXPR
public static final int SHOW_LOW_EXPR
public static final int SHOW_HIGH_EXPR
public static final int SHOW_DD
public static final int SHOW_DOM
public static final int SHOW_PDOM
public static final int SHOW_CDG
public static final int SHOW_EXPR_MASK
protected static java.lang.String outputPath
Constructor Detail |
---|
public DisplayGraph()
Method Detail |
---|
public static void setVisualizer(DisplayGraph v)
DisplayGraph
available to
all parts of the process. If a visualizer was already
set, terminate it.
public static DisplayGraph getVisualizer()
null
if none.
public static void setOutputPath(java.lang.String path)
public static void initColors()
public abstract void newGraph(java.lang.String context, boolean top)
DisplayGraph
instance.
context
- is the name associated with the graphtop
- if true places the root node at the top of the displaypublic abstract void addEdge(DisplayNode n1, DisplayNode n2, DColor color, DEdge edgeAttributes, java.lang.Object edgeInfo)
bits | use |
---|---|
5-0 | color |
6 | type: normal, backedge |
8-7 | pattern: solid, dashed, dotted
n1
- is the first noden2
- is the second nodeedgeAttributes
- specifies the color, type, and form of the edgeedgeInfo
- is additional information about the edgepublic abstract void addNode(DisplayNode n)
n
- is the nodepublic abstract boolean visited(DisplayNode n)
n
- the node to checkpublic abstract void terminate()
public abstract void openWindow(java.lang.String context, java.lang.String title, int graphAttributes)
newGraph()
.
bits | use |
---|---|
0 | display graph edge labels |
context
- is the user defined string to distinguish between
different windowstitle
- is title for the windowgraphAttributes
- species attributes for the graphnewGraph(java.lang.String, boolean)
public abstract void closeWindow(java.lang.String context)
context
- is the user defined string to distinguish between
different windowsnewGraph(java.lang.String, boolean)
public abstract boolean windowExists(java.lang.String context)
public abstract void interact()
protected void addDisplayString(java.lang.String v, java.lang.StringBuffer buf)
v
- the original string
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |