|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatt.grappa.Element
att.grappa.Subgraph
public class Subgraph
This class describes a subgraph, which can consist of nodes, edges and other subgraphs. Note: The topmost or root subgraph is the entire graph (the Graph object), which is an extension of this class.
Graph
Nested Class Summary | |
---|---|
(package private) class |
Subgraph.Enumerator
|
Field Summary | |
---|---|
private boolean |
cluster
|
java.lang.Object |
currentSelection
Reference to the current selection (or vector of selections). |
static java.lang.String |
defaultNamePrefix
Default graph name prefix used by setName(). |
private java.util.Hashtable |
edgeAttributes
|
private java.util.Hashtable |
edgedict
|
private boolean |
edgeLabels
|
private Element[] |
elPatches
|
private java.util.Hashtable |
graphdict
|
private java.util.Hashtable |
nodeAttributes
|
private java.util.Hashtable |
nodedict
|
private boolean |
nodeLabels
|
private GrappaBox |
patch
|
private double |
PATCHEDGE
|
private double |
PATCHEDGE2
|
private Element[] |
sgPatches
|
private boolean |
subgLabels
|
Fields inherited from class att.grappa.Element |
---|
attributes, attrsOfInterest, canonName, counter, grappaNexus, highlight, linewidth, name, object, printAllAttributes, printDefaultAttributes, selectable, usePrintList, visastamp, visible |
Constructor Summary | |
---|---|
Subgraph()
This constructor is needed by the Graph constructor |
|
Subgraph(Subgraph subg)
Use this constructor when creating a subgraph within a subgraph with an automatically generated name. |
|
Subgraph(Subgraph subg,
java.lang.String name)
Use this constructor when creating a subgraph within a subgraph. |
Method Summary | |
---|---|
void |
addEdge(Edge newEdge)
Adds the specified edge to the subgraph's Edge dictionary. |
void |
addNode(Node newNode)
Adds the specified node to the subgraph's Node dictionary. |
void |
addSubgraph(Subgraph newGraph)
Adds the specified subgraph to the subgraph's graph dictionary. |
void |
addTypeTag(int type,
java.lang.String tag)
Adds a default tag for the specified element type within this subgraph. |
(package private) double |
aspect(java.awt.geom.Rectangle2D.Double r)
|
static int |
attributeType(java.lang.String attrname)
Returns the attribute conversion type for the supplied attribute name. |
void |
clearPatchWork()
|
private void |
combPatchWork()
|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
|
private void |
compSqPatchWork(java.awt.geom.Rectangle2D.Double r,
boolean top)
|
private void |
compStdPatchWork(java.awt.geom.Rectangle2D.Double r,
boolean top)
|
void |
computePatchWork(java.awt.geom.Rectangle2D.Double r,
boolean square)
|
int |
countOfElements(int types)
Get a count of elements in this subgraph and, by recursion, descendant subgraphs. |
int |
countOfLocalElements(int types)
Get a count of elements in this subgraph. |
Element |
createElement(int type,
java.lang.Object[] info,
Attribute[] attrs)
Creates a new element and adds it to the subgraph's element dictionary. |
java.util.Enumeration |
edgeElements()
Get an enumeration of the edge elements in this subgraph. |
GraphEnumeration |
elements()
Get an enumeration of all elements in this subgraph and any subgraphs under this one. |
GraphEnumeration |
elements(int types)
Get an enumeration of elements in this subgraph and any subgraphs under this one. |
boolean |
equals(java.lang.Object obj)
|
Edge |
findEdgeByName(java.lang.String edgeName)
Searches current subgraph and, by recursion, descendent subgraphs for the edge matching the supplied name. |
private Element |
findElementByName(int type,
java.lang.String name)
|
private Element |
findElementInSubgraphByName(int type,
java.lang.String name)
|
Node |
findNodeByName(java.lang.String nodeName)
Searches current subgraph and, by recursion, descendent subgraphs for the node matching the supplied name. |
Subgraph |
findSubgraphByName(java.lang.String graphName)
Searches current subgraph and, by recursion, descendent subgraphs for the subgraph matching the supplied name. |
java.awt.geom.Rectangle2D |
getBoundingBox()
Get the bounding box of the subgraph. |
Attribute |
getEdgeAttribute(java.lang.String key)
Gets the subgraph-specific default attribute for the named edge attribute. |
java.util.Enumeration |
getEdgeAttributeKeys()
Gets an enumeration of the subgraph-specific edge attribute keys |
java.util.Enumeration |
getEdgeAttributePairs()
Gets an enumeration of the subgraph-specific edge attributes |
java.lang.Object |
getEdgeAttributeValue(java.lang.String key)
Gets the subgraph-specific default value for the named edge attribute. |
Attribute |
getNodeAttribute(java.lang.String key)
Gets the subgraph-specific default attribute for the named node attribute. |
java.util.Enumeration |
getNodeAttributeKeys()
Gets an enumeration of the subgraph-specific node attribute keys |
java.util.Enumeration |
getNodeAttributePairs()
Gets an enumeration of the subgraph-specific node attributes |
java.lang.Object |
getNodeAttributeValue(java.lang.String key)
Gets the subgraph-specific default value for the named node attribute. |
private Attribute |
getParentDefault(int type,
java.lang.String key)
|
(package private) Element[] |
getPatches()
|
boolean |
getShowEdgeLabels()
Get flag that indicates if edge labels should be rendered |
boolean |
getShowNodeLabels()
Get flag that indicates if node labels should be rendered |
boolean |
getShowSubgraphLabels()
Get flag that indicates if subgraph labels should be rendered |
int |
getType()
Get the type of this element. |
boolean |
hasEmptySubgraphs()
|
boolean |
hasTypeTag(int type,
java.lang.String tag)
Check if the specified element type has the supplied default tag within this subgraph. |
boolean |
hasTypeTags(int type)
Check if this element type has any default tags at all. |
boolean |
isCluster()
Check if the subgraph is a cluster subgraph. |
boolean |
isLR()
Check if the orientation of this subgraph is LR (left-to-right) as opposed to TB (top-to-bottom). |
boolean |
isRoot()
Check if the subgraph is the root of the graph. |
boolean |
isSubgraph()
Check if this element is a subgraph. |
java.util.Enumeration |
nodeElements()
Get an enumeration of the node elements in this subgraph. |
void |
patchWork(java.awt.geom.Rectangle2D.Double r,
boolean square,
int mode)
|
double |
preparePatchWork(int mode)
|
private double |
prepPatchWork(java.lang.String attrname,
int mode)
|
private void |
printDflt(java.io.PrintWriter out,
int type)
|
private void |
printDfltAttr(java.io.PrintWriter out,
java.util.Hashtable dfltAttr,
int type,
java.lang.String prefix,
java.lang.String suffix)
|
void |
printSubgraph(java.io.PrintWriter out)
Prints an ascii description of each graph element to the supplied stream. |
(package private) void |
recurseVectorOfElements(int types,
java.util.Vector retVec,
int count)
|
Edge |
removeEdge(java.lang.String edgeName)
Removes the edge matching the specified name from the subgraph's Edge dictionary. |
private void |
removeEdgeAttribute(java.lang.String name)
|
void |
removeEmptySubgraphs()
Delete this subgraph or any contained subgraph, at any depth, if the subgraph contains no elements. |
Node |
removeNode(java.lang.String nodeName)
Removes the node matching the specified name from the subgraph's Node dictionary. |
private void |
removeNodeAttribute(java.lang.String name)
|
Subgraph |
removeSubgraph(java.lang.String graphName)
Removes the subgraph matching the specified name from the subgraph's graph dictionary. |
void |
removeTypeTag(int type,
java.lang.String tag)
Removes the specified tag from this element. |
void |
removeTypeTags(int type)
Removes any and all default tags associated with this element type. |
java.awt.geom.Rectangle2D |
resetBoundingBox()
Removes bounding box information from this subgraph and any contained subgraphs including the BBOX_ATTR value and then recomputes the bounding boxes. |
(package private) double |
score(double wd,
double ht)
|
java.lang.Object |
setAttribute(Attribute attr)
Sets the subgraph-specific default for the specified graph attribute. |
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the subgraph-specific default using the specified name/value pair. |
java.lang.Object |
setEdgeAttribute(Attribute attr)
Sets the subgraph-specific default for the specified edge attribute. |
java.lang.Object |
setEdgeAttribute(java.lang.String name,
java.lang.Object value)
Sets the subgraph-specific default using the specified name/value pair. |
(package private) void |
setName()
Generates and sets the name for this subgraph. |
void |
setName(java.lang.String newName)
Sets the subgraph name to a copy of the supplied argument. |
java.lang.Object |
setNodeAttribute(Attribute attr)
Sets the subgraph-specific default for the specified node attribute. |
java.lang.Object |
setNodeAttribute(java.lang.String name,
java.lang.Object value)
Sets the subgraph-specific default using the specified name/value pair. |
boolean |
setShowEdgeLabels(boolean value)
Set flag to indicate if edge labels should be rendered |
boolean |
setShowNodeLabels(boolean value)
Set flag to indicate if node labels should be rendered |
boolean |
setShowSubgraphLabels(boolean value)
Set flag to indicate if subgraph labels should be rendered |
private void |
subgraphAttrsOfInterest()
|
java.util.Enumeration |
subgraphElements()
Get an enumeration of the subgraph elements in this subgraph. |
java.util.Vector |
vectorOfElements(int types)
Get a vector of elements in this subgraph and, by recursion, descendant subgraphs. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String defaultNamePrefix
setName()
,
Constant Field Valuesprivate java.util.Hashtable nodedict
private java.util.Hashtable edgedict
private java.util.Hashtable graphdict
private boolean nodeLabels
private boolean edgeLabels
private boolean subgLabels
private java.util.Hashtable nodeAttributes
private java.util.Hashtable edgeAttributes
private boolean cluster
public java.lang.Object currentSelection
private double PATCHEDGE
private double PATCHEDGE2
private Element[] sgPatches
private Element[] elPatches
private GrappaBox patch
Constructor Detail |
---|
Subgraph()
public Subgraph(Subgraph subg, java.lang.String name)
subg
- the parent subgraph.name
- the name of this subgraph.public Subgraph(Subgraph subg)
subg
- the parent subgraph.setName()
Method Detail |
---|
private void subgraphAttrsOfInterest()
public boolean isSubgraph()
isSubgraph
in class Element
isSubgraph()
public int getType()
getType
in class Element
GrappaConstants.SUBGRAPH
void setName()
setName
in class Element
Element.getId()
public void setName(java.lang.String newName) throws java.lang.IllegalArgumentException
newName
- the new name for the subgraph.
java.lang.IllegalArgumentException
setName()
public boolean isCluster()
public boolean isRoot()
public Attribute getNodeAttribute(java.lang.String key)
key
- the name of the node attribute pair to be retrieved.
public java.lang.Object getNodeAttributeValue(java.lang.String key)
key
- the name of the node attribute pair to be retrieved.
public java.util.Enumeration getNodeAttributeKeys()
public java.util.Enumeration getNodeAttributePairs()
public java.lang.Object setNodeAttribute(Attribute attr)
attr
- the node Attribute object to set as a default.
Subgraph#setNodeAttribute(java.lang.String, java.lang.String)
public java.lang.Object setNodeAttribute(java.lang.String name, java.lang.Object value)
name
- the node attribute namevalue
- the node attribute value
private void removeNodeAttribute(java.lang.String name)
public java.lang.Object setEdgeAttribute(Attribute attr)
attr
- the edge attribute pair to set.
Subgraph#setEdgeAttribute(java.lang.String, java.lang.String)
public java.lang.Object setEdgeAttribute(java.lang.String name, java.lang.Object value)
name
- the edge attribute namevalue
- the edge attribute value
private void removeEdgeAttribute(java.lang.String name)
public java.lang.Object setAttribute(Attribute attr)
setAttribute
in class Element
attr
- the graph attribute pair to set.
Subgraph#setAttribute(java.lang.String, java.lang.String)
public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in class Element
name
- the graph attribute namevalue
- the graph attribute value
public Attribute getEdgeAttribute(java.lang.String key)
key
- the name of the edge attribute pair to be retrieved.
public java.lang.Object getEdgeAttributeValue(java.lang.String key)
key
- the name of the edge attribute pair to be retrieved.
public java.util.Enumeration getEdgeAttributeKeys()
public java.util.Enumeration getEdgeAttributePairs()
public java.awt.geom.Rectangle2D getBoundingBox()
public java.awt.geom.Rectangle2D resetBoundingBox()
public void printSubgraph(java.io.PrintWriter out)
output
- the OutputStream for writing the graph description.private void printDflt(java.io.PrintWriter out, int type)
private void printDfltAttr(java.io.PrintWriter out, java.util.Hashtable dfltAttr, int type, java.lang.String prefix, java.lang.String suffix)
public static int attributeType(java.lang.String attrname)
attrname
- the attribute name
private Attribute getParentDefault(int type, java.lang.String key)
private Element findElementByName(int type, java.lang.String name)
private Element findElementInSubgraphByName(int type, java.lang.String name)
public Node findNodeByName(java.lang.String nodeName)
nodeName
- the name of the node to be found.
public Edge findEdgeByName(java.lang.String edgeName)
edgeName
- the name of the edge to be found.
public Subgraph findSubgraphByName(java.lang.String graphName)
graphName
- the name of the subgraph to be found.
public Element createElement(int type, java.lang.Object[] info, Attribute[] attrs)
type
- type of the element to be addedinfo
- a vector specifics for the particular type of element being createdattrs
- attributes describing the element to be created
java.lang.InstantiationException
- whenever element cannot be createdpublic void addNode(Node newNode)
newNode
- the node to be added to the dictionary.public Node removeNode(java.lang.String nodeName)
nodeName
- the name of the node to be removed from the dictionary.
public void addEdge(Edge newEdge)
newEdge
- the edge to be added to the dictionary.public Edge removeEdge(java.lang.String edgeName)
edgeName
- the name of the edge to be removed from the dictionary.
public void addSubgraph(Subgraph newGraph)
newGraph
- the subgraph to be added to the dictionary.public Subgraph removeSubgraph(java.lang.String graphName)
graphName
- the name of the subgraph to be removed from the dictionary.
public boolean setShowSubgraphLabels(boolean value)
public boolean setShowNodeLabels(boolean value)
public boolean setShowEdgeLabels(boolean value)
public boolean getShowSubgraphLabels()
public boolean getShowNodeLabels()
public boolean getShowEdgeLabels()
public boolean isLR()
public void addTypeTag(int type, java.lang.String tag)
type
- the element type for this tag operationtag
- the tag to associate with this element type.public boolean hasTypeTag(int type, java.lang.String tag)
type
- the element type for this tag operationtag
- tag value to be searched for
public boolean hasTypeTags(int type)
type
- the element type for this tag operation
public void removeTypeTags(int type)
type
- the element type for this tag operationpublic void removeTypeTag(int type, java.lang.String tag)
type
- the element type for this tag operationtag
- the tag value to removepublic int countOfLocalElements(int types)
types
- a bitwise-oring of NODE, EDGE, SUBGRAPH to
determine which element types should be in the count
GrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public int countOfElements(int types)
types
- a bitwise-oring of NODE, EDGE, SUBGRAPH to
determine which element types should be in the count
GrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public void removeEmptySubgraphs()
public boolean hasEmptySubgraphs()
public void clearPatchWork()
public void patchWork(java.awt.geom.Rectangle2D.Double r, boolean square, int mode)
public double preparePatchWork(int mode)
Element[] getPatches()
private void combPatchWork()
private double prepPatchWork(java.lang.String attrname, int mode)
double aspect(java.awt.geom.Rectangle2D.Double r)
double score(double wd, double ht)
public void computePatchWork(java.awt.geom.Rectangle2D.Double r, boolean square)
private void compSqPatchWork(java.awt.geom.Rectangle2D.Double r, boolean top)
private void compStdPatchWork(java.awt.geom.Rectangle2D.Double r, boolean top)
public int compare(java.lang.Object o1, java.lang.Object o2)
compare
in interface java.util.Comparator
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Comparator
equals
in class java.lang.Object
public java.util.Enumeration nodeElements()
public java.util.Enumeration edgeElements()
public java.util.Enumeration subgraphElements()
public GraphEnumeration elements(int types)
types
- a bitwise-oring of NODE, EDGE, SUBGRAPH to
determine which element types should be in the enumeration
GrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public GraphEnumeration elements()
elements(NODE|EDGE|SUBGRAPH)
elements(int)
public java.util.Vector vectorOfElements(int types)
types
- a bitwise-oring of NODE, EDGE, SUBGRAPH to
determine which element types should be in the count
GrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
void recurseVectorOfElements(int types, java.util.Vector retVec, int count)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |