|
||||||||||
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
Field Summary | |
---|---|
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(). |
Fields inherited from class att.grappa.Element |
---|
counter, highlight, linewidth, object, printAllAttributes, printDefaultAttributes, selectable, usePrintList, visible |
Constructor Summary | |
---|---|
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. |
static int |
attributeType(java.lang.String attrname)
Returns the attribute conversion type for the supplied attribute name. |
void |
clearPatchWork()
|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
|
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.Iterator<Edge> |
edgeElements()
Get an Iterator of the edge elements in this subgraph. |
Edge[] |
edgeElementsAsArray()
|
GraphIterator |
elements()
Get an Iterator of all elements in this subgraph and any subgraphs under this one. |
GraphIterator |
elements(int types)
Get an Iterator 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. |
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.Iterator<java.lang.String> |
getEdgeAttributeKeys()
Gets an Iterator of the subgraph-specific edge attribute keys |
java.util.Iterator<Attribute> |
getEdgeAttributePairs()
Gets an Iterator 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.Iterator<java.lang.String> |
getNodeAttributeKeys()
Gets an Iterator of the subgraph-specific node attribute keys |
java.util.Iterator<Attribute> |
getNodeAttributePairs()
Gets an Iterator 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. |
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.List<Element> |
listOfElements(int types)
Get a vector of elements in this subgraph and, by recursion, descendant subgraphs. |
java.util.Iterator<Node> |
nodeElements()
Get an Iterator of the node elements in this subgraph. |
Node[] |
nodeElementsAsArray()
|
void |
patchWork(java.awt.geom.Rectangle2D.Double r,
boolean square,
int mode)
|
double |
preparePatchWork(int mode)
|
void |
printSubgraph(java.io.PrintWriter out)
Prints an ascii description of each graph element to the supplied stream. |
Edge |
removeEdge(java.lang.String edgeName)
Removes the edge matching the specified name from the subgraph's Edge dictionary. |
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. |
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. |
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. |
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 |
java.util.Iterator<Subgraph> |
subgraphElements()
Get an Iterator of the subgraph elements in this subgraph. |
Subgraph[] |
subgraphElementsAsArray()
|
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 Valuespublic java.lang.Object currentSelection
Constructor Detail |
---|
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 |
---|
public boolean isSubgraph()
isSubgraph
in class Element
isSubgraph()
public int getType()
getType
in class Element
GrappaConstants.SUBGRAPH
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.Iterator<java.lang.String> getNodeAttributeKeys()
public java.util.Iterator<Attribute> 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
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
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.Iterator<java.lang.String> getEdgeAttributeKeys()
public java.util.Iterator<Attribute> 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.public static int attributeType(java.lang.String attrname)
attrname
- the attribute 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)
public void computePatchWork(java.awt.geom.Rectangle2D.Double r, boolean square)
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.Iterator<Node> nodeElements()
public Node[] nodeElementsAsArray()
public java.util.Iterator<Edge> edgeElements()
public Edge[] edgeElementsAsArray()
public java.util.Iterator<Subgraph> subgraphElements()
public Subgraph[] subgraphElementsAsArray()
public GraphIterator elements(int types)
types
- a bitwise-oring of NODE, EDGE, SUBGRAPH to
determine which element types should be in the Iterator
GrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public GraphIterator elements()
elements(NODE|EDGE|SUBGRAPH)
elements(int)
public java.util.List<Element> listOfElements(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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |