att.grappa
Class Subgraph

java.lang.Object
  extended by att.grappa.Element
      extended by att.grappa.Subgraph
All Implemented Interfaces:
GrappaConstants, java.util.Comparator
Direct Known Subclasses:
Graph

public class Subgraph
extends Element
implements java.util.Comparator

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.

Version:
1.2, ; Copyright 1996 - 2010 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs
See Also:
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
 
Fields inherited from interface att.grappa.GrappaConstants
_NO_TYPE, ANONYMOUS_PREFIX, BBOX_ATTR, BBOX_HASH, BOX_SHAPE, BOX_TYPE, CLUSTERRANK_ATTR, COLOR_ATTR, COLOR_HASH, COLOR_TYPE, CUSTOM_ATTR, CUSTOM_HASH, CUSTOM_SHAPE, DELETION_MASK, DIAMOND_SHAPE, DIR_ATTR, DIR_HASH, DIR_TYPE, DISTORTION_ATTR, DISTORTION_HASH, DOUBLE_TYPE, DOUBLECIRCLE_SHAPE, DOUBLEOCTAGON_SHAPE, EDGE, EGG_SHAPE, FILLCOLOR_ATTR, FILLCOLOR_HASH, FONTCOLOR_ATTR, FONTCOLOR_HASH, FONTNAME_ATTR, FONTNAME_HASH, FONTSIZE_ATTR, FONTSIZE_HASH, FONTSTYLE_ATTR, FONTSTYLE_HASH, FONTSTYLE_TYPE, GRAPPA_BACKGROUND_COLOR_ATTR, GRAPPA_BACKGROUND_COLOR_HASH, GRAPPA_DELETION_STYLE_ATTR, GRAPPA_DELETION_STYLE_HASH, GRAPPA_FONTSIZE_ADJUSTMENT_ATTR, GRAPPA_FONTSIZE_ADJUSTMENT_HASH, GRAPPA_SELECTION_STYLE_ATTR, GRAPPA_SELECTION_STYLE_HASH, GRAPPA_SHAPE, HASHMAP_TYPE, HEADLABEL_ATTR, HEADLABEL_HASH, HEADLP_ATTR, HEADLP_HASH, HEIGHT_ATTR, HEIGHT_HASH, HEXAGON_SHAPE, HIGHLIGHT_MASK, HIGHLIGHT_OFF, HIGHLIGHT_ON, HIGHLIGHT_TOGGLE, HOUSE_SHAPE, IDENTXFRM, IMAGE_ATTR, IMAGE_HASH, INTEGER_TYPE, INVERTEDHOUSE_SHAPE, INVERTEDTRAPEZIUM_SHAPE, INVERTEDTRIANGLE_SHAPE, LABEL_ATTR, LABEL_HASH, LINE_SHAPE, LINE_TYPE, LOG10, LP_ATTR, LP_HASH, MARGIN_ATTR, MARGIN_HASH, MCIRCLE_SHAPE, MCLIMIT_ATTR, MCLIMIT_HASH, MDIAMOND_SHAPE, MINBOX_ATTR, MINBOX_HASH, MINLEN_ATTR, MINLEN_HASH, MINSIZE_ATTR, MINSIZE_HASH, MRECORD_SHAPE, MSQUARE_SHAPE, NBSP, NEW_LINE, NO_SHAPE, NODE, NODESEP_ATTR, NODESEP_HASH, OCTAGON_SHAPE, ORIENTATION_ATTR, ORIENTATION_HASH, OVAL_SHAPE, PACKAGE_PREFIX, PARALLELOGRAM_SHAPE, PATCH_ATTR, PATCH_HASH, PENTAGON_SHAPE, PERIPHERIES_ATTR, PERIPHERIES_HASH, PERIPHERY_GAP, PKG_LOWER, PKG_UPLOW, PKG_UPPER, PLAINTEXT_SHAPE, POINT_SHAPE, POINT_TYPE, PointsPerInch, POLYGON_SHAPE, POS_ATTR, POS_HASH, PRINTLIST_ATTR, PRINTLIST_HASH, RANKDIR_ATTR, RANKDIR_HASH, RANKSEP_ATTR, RANKSEP_HASH, RECORD_SHAPE, RECTS_ATTR, RECTS_HASH, ROTATION_ATTR, ROTATION_HASH, ROUNDEDBOX_SHAPE, SELECTION_MASK, SHAPE_ATTR, SHAPE_HASH, SHAPE_MASK, SHAPE_TYPE, SIDES_ATTR, SIDES_HASH, SIZE_ATTR, SIZE_HASH, SIZE_TYPE, SKEW_ATTR, SKEW_HASH, STRING_TYPE, STYLE_ATTR, STYLE_HASH, STYLE_TYPE, SUBGRAPH, SYSTEM, TAG_ATTR, TAG_HASH, TAILLABEL_ATTR, TAILLABEL_HASH, TAILLP_ATTR, TAILLP_HASH, TIP_ATTR, TIP_HASH, TRAPEZIUM_SHAPE, TRIANGLE_SHAPE, TRIPLEOCTAGON_SHAPE, TYPES_SHIFT, WEIGHT_ATTR, WEIGHT_HASH, WIDTH_ATTR, WIDTH_HASH
 
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 att.grappa.Element
addTag, attrOfInterest, bdfs, buildShape, canonString, canonValue, clearBBox, delete, getAttribute, getAttributePairs, getAttributeValue, getDefaultAttribute, getDefaultAttribute, getGraph, getGrappaNexus, getId, getIdKey, getLocalAttribute, getLocalAttributeKeys, getLocalAttributePairs, getName, getSubgraph, getThisAttribute, getThisAttributeValue, hasAttributeForKey, hasDefaultTag, hasDefaultTags, hasLocalTag, hasLocalTags, hasTag, hasTags, isEdge, isNode, isOfInterest, listAttrsOfInterest, printElement, removeTag, removeTags, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setIdKey, setSubgraph, setUserAttributeType, toString, typeString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultNamePrefix

public static final java.lang.String defaultNamePrefix
Default graph name prefix used by setName().

See Also:
setName(), Constant Field Values

currentSelection

public java.lang.Object currentSelection
Reference to the current selection (or vector of selections). Normally set and used by a GrappaAdapter.

Constructor Detail

Subgraph

public Subgraph(Subgraph subg,
                java.lang.String name)
Use this constructor when creating a subgraph within a subgraph.

Parameters:
subg - the parent subgraph.
name - the name of this subgraph.

Subgraph

public Subgraph(Subgraph subg)
Use this constructor when creating a subgraph within a subgraph with an automatically generated name.

Parameters:
subg - the parent subgraph.
See Also:
setName()
Method Detail

isSubgraph

public boolean isSubgraph()
Check if this element is a subgraph. Useful for testing the subclass type of a Element object.

Overrides:
isSubgraph in class Element
Returns:
true if this object is a Subgraph.
See Also:
isSubgraph()

getType

public int getType()
Get the type of this element. Useful for distinguishing Element objects.

Specified by:
getType in class Element
Returns:
the class variable constant SUBGRAPH.
See Also:
GrappaConstants.SUBGRAPH

setName

public void setName(java.lang.String newName)
             throws java.lang.IllegalArgumentException
Sets the subgraph name to a copy of the supplied argument. When the argument is null, setName() is called. When the name is not unique or when the name has the same format as that generated by setName(), a IllegalArgumentException is thrown.

Parameters:
newName - the new name for the subgraph.
Throws:
java.lang.IllegalArgumentException
See Also:
setName()

isCluster

public boolean isCluster()
Check if the subgraph is a cluster subgraph.

Returns:
true, if the graph is a cluster subgraph.

isRoot

public boolean isRoot()
Check if the subgraph is the root of the graph.

Returns:
true, if the graph is the root of the graph.

getNodeAttribute

public Attribute getNodeAttribute(java.lang.String key)
Gets the subgraph-specific default attribute for the named node attribute.

Parameters:
key - the name of the node attribute pair to be retrieved.
Returns:
the requested attribute pair or null if not found.

getNodeAttributeValue

public java.lang.Object getNodeAttributeValue(java.lang.String key)
Gets the subgraph-specific default value for the named node attribute.

Parameters:
key - the name of the node attribute pair to be retrieved.
Returns:
the requested attribute value or null if not found.

getNodeAttributeKeys

public java.util.Iterator<java.lang.String> getNodeAttributeKeys()
Gets an Iterator of the subgraph-specific node attribute keys

Returns:
an Iterator of String objects.

getNodeAttributePairs

public java.util.Iterator<Attribute> getNodeAttributePairs()
Gets an Iterator of the subgraph-specific node attributes

Returns:
an Iterator of Attribute objects.

setNodeAttribute

public java.lang.Object setNodeAttribute(Attribute attr)
Sets the subgraph-specific default for the specified node attribute. If the attribute is not from the parent subgraph, then setNodeAttribute(attr.getName(), attr.getValue()) is called.

Parameters:
attr - the node Attribute object to set as a default.
Returns:
the Attribute object previously stored for this attribute, if any.
See Also:
Subgraph#setNodeAttribute(java.lang.String, java.lang.String)

setNodeAttribute

public java.lang.Object setNodeAttribute(java.lang.String name,
                                         java.lang.Object value)
Sets the subgraph-specific default using the specified name/value pair. A new attribute will be created if needed.

Parameters:
name - the node attribute name
value - the node attribute value
Returns:
the Attribute object previously stored for this attribute, if any.

setEdgeAttribute

public java.lang.Object setEdgeAttribute(Attribute attr)
Sets the subgraph-specific default for the specified edge attribute. If the attribute is not from the parent subgraph, then setEdgeAttribute(attr.getName(), attr.getValue()) is called.

Parameters:
attr - the edge attribute pair to set.
Returns:
the attribute pair previously stored for this attribute.
See Also:
Subgraph#setEdgeAttribute(java.lang.String, java.lang.String)

setEdgeAttribute

public java.lang.Object setEdgeAttribute(java.lang.String name,
                                         java.lang.Object value)
Sets the subgraph-specific default using the specified name/value pair. A new attribute will be created if needed.

Parameters:
name - the edge attribute name
value - the edge attribute value
Returns:
the attribute pair previously stored for this attribute.

setAttribute

public java.lang.Object setAttribute(Attribute attr)
Sets the subgraph-specific default for the specified graph attribute. If the attribute is not from the parent subgraph, then setAttribute(attr.getName(), attr.getValue()) is called. Overrides Element method.

Overrides:
setAttribute in class Element
Parameters:
attr - the graph attribute pair to set.
Returns:
the attribute pair previously stored for this attribute.
See Also:
Subgraph#setAttribute(java.lang.String, java.lang.String)

setAttribute

public java.lang.Object setAttribute(java.lang.String name,
                                     java.lang.Object value)
Sets the subgraph-specific default using the specified name/value pair. A new attribute will be created if needed. Overrides Element method.

Overrides:
setAttribute in class Element
Parameters:
name - the graph attribute name
value - the graph attribute value
Returns:
the attribute pair previously stored for this attribute.

getEdgeAttribute

public Attribute getEdgeAttribute(java.lang.String key)
Gets the subgraph-specific default attribute for the named edge attribute.

Parameters:
key - the name of the edge attribute pair to be retrieved.
Returns:
the requested attribute pair or null if not found.

getEdgeAttributeValue

public java.lang.Object getEdgeAttributeValue(java.lang.String key)
Gets the subgraph-specific default value for the named edge attribute.

Parameters:
key - the name of the edge attribute pair to be retrieved.
Returns:
the requested attribute value or null if not found.

getEdgeAttributeKeys

public java.util.Iterator<java.lang.String> getEdgeAttributeKeys()
Gets an Iterator of the subgraph-specific edge attribute keys

Returns:
an Iterator of String objects.

getEdgeAttributePairs

public java.util.Iterator<Attribute> getEdgeAttributePairs()
Gets an Iterator of the subgraph-specific edge attributes

Returns:
an Iterator of Attribute objects.

getBoundingBox

public java.awt.geom.Rectangle2D getBoundingBox()
Get the bounding box of the subgraph.

Returns:
the bounding box of the subgraph.

resetBoundingBox

public 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.

Returns:
the new bounding box of the subgraph.

printSubgraph

public void printSubgraph(java.io.PrintWriter out)
Prints an ascii description of each graph element to the supplied stream.

Parameters:
output - the OutputStream for writing the graph description.

attributeType

public static int attributeType(java.lang.String attrname)
Returns the attribute conversion type for the supplied attribute name. After subgraph specific attribute name/type mappings are checked, mappings at the element level are checked.

Parameters:
attrname - the attribute name
Returns:
the currently associated attribute type

findNodeByName

public Node findNodeByName(java.lang.String nodeName)
Searches current subgraph and, by recursion, descendent subgraphs for the node matching the supplied name.

Parameters:
nodeName - the name of the node to be found.
Returns:
the Node matching the name or null, if there is no match.

findEdgeByName

public Edge findEdgeByName(java.lang.String edgeName)
Searches current subgraph and, by recursion, descendent subgraphs for the edge matching the supplied name.

Parameters:
edgeName - the name of the edge to be found.
Returns:
the Edge matching the name or null, if there is no match.

findSubgraphByName

public Subgraph findSubgraphByName(java.lang.String graphName)
Searches current subgraph and, by recursion, descendent subgraphs for the subgraph matching the supplied name.

Parameters:
graphName - the name of the subgraph to be found.
Returns:
the Subgraph matching the name or null, if there is no match.

createElement

public Element createElement(int type,
                             java.lang.Object[] info,
                             Attribute[] attrs)
Creates a new element and adds it to the subgraph's element dictionary. For nodes, the info vector can be null or contains: For edges, the info vector must contain (in this order) at least: Optionally, the info vector can also contain at its end (in this order): For subgraphs, the info vector can be null or contains:

Parameters:
type - type of the element to be added
info - a vector specifics for the particular type of element being created
attrs - attributes describing the element to be created
Throws:
java.lang.InstantiationException - whenever element cannot be created

addNode

public void addNode(Node newNode)
Adds the specified node to the subgraph's Node dictionary.

Parameters:
newNode - the node to be added to the dictionary.

removeNode

public Node removeNode(java.lang.String nodeName)
Removes the node matching the specified name from the subgraph's Node dictionary.

Parameters:
nodeName - the name of the node to be removed from the dictionary.
Returns:
the node that was removed.

addEdge

public void addEdge(Edge newEdge)
Adds the specified edge to the subgraph's Edge dictionary.

Parameters:
newEdge - the edge to be added to the dictionary.

removeEdge

public Edge removeEdge(java.lang.String edgeName)
Removes the edge matching the specified name from the subgraph's Edge dictionary.

Parameters:
edgeName - the name of the edge to be removed from the dictionary.
Returns:
the edge that was removed.

addSubgraph

public void addSubgraph(Subgraph newGraph)
Adds the specified subgraph to the subgraph's graph dictionary.

Parameters:
newGraph - the subgraph to be added to the dictionary.

removeSubgraph

public Subgraph removeSubgraph(java.lang.String graphName)
Removes the subgraph matching the specified name from the subgraph's graph dictionary.

Parameters:
graphName - the name of the subgraph to be removed from the dictionary.
Returns:
the subgraph that was removed.

setShowSubgraphLabels

public boolean setShowSubgraphLabels(boolean value)
Set flag to indicate if subgraph labels should be rendered

Returns:
the previous value

setShowNodeLabels

public boolean setShowNodeLabels(boolean value)
Set flag to indicate if node labels should be rendered

Returns:
the previous value

setShowEdgeLabels

public boolean setShowEdgeLabels(boolean value)
Set flag to indicate if edge labels should be rendered

Returns:
the previous value

getShowSubgraphLabels

public boolean getShowSubgraphLabels()
Get flag that indicates if subgraph labels should be rendered

Returns:
the flag value

getShowNodeLabels

public boolean getShowNodeLabels()
Get flag that indicates if node labels should be rendered

Returns:
the flag value

getShowEdgeLabels

public boolean getShowEdgeLabels()
Get flag that indicates if edge labels should be rendered

Returns:
the flag value

isLR

public boolean isLR()
Check if the orientation of this subgraph is LR (left-to-right) as opposed to TB (top-to-bottom).

Returns:
true if the orientation is left-to-right.

addTypeTag

public void addTypeTag(int type,
                       java.lang.String tag)
Adds a default tag for the specified element type within this subgraph.

Parameters:
type - the element type for this tag operation
tag - the tag to associate with this element type.

hasTypeTag

public boolean hasTypeTag(int type,
                          java.lang.String tag)
Check if the specified element type has the supplied default tag within this subgraph.

Parameters:
type - the element type for this tag operation
tag - tag value to be searched for
Returns:
true, if this subgraph contains the supplied tag as a default for the given type

hasTypeTags

public boolean hasTypeTags(int type)
Check if this element type has any default tags at all.

Parameters:
type - the element type for this tag operation
Returns:
true, if this Element has any tags

removeTypeTags

public void removeTypeTags(int type)
Removes any and all default tags associated with this element type.

Parameters:
type - the element type for this tag operation

removeTypeTag

public void removeTypeTag(int type,
                          java.lang.String tag)
Removes the specified tag from this element.

Parameters:
type - the element type for this tag operation
tag - the tag value to remove

countOfLocalElements

public int countOfLocalElements(int types)
Get a count of elements in this subgraph. No recursion to descendants is done.

Parameters:
types - a bitwise-oring of NODE, EDGE, SUBGRAPH to determine which element types should be in the count
Returns:
a count of the specified elements in this subgraph.
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

countOfElements

public int countOfElements(int types)
Get a count of elements in this subgraph and, by recursion, descendant subgraphs. The subgraph itself is not counted.

Parameters:
types - a bitwise-oring of NODE, EDGE, SUBGRAPH to determine which element types should be in the count
Returns:
a count of the specified elements in this subgraph and its descendants.
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

removeEmptySubgraphs

public void removeEmptySubgraphs()
Delete this subgraph or any contained subgraph, at any depth, if the subgraph contains no elements.


hasEmptySubgraphs

public boolean hasEmptySubgraphs()
Returns:
true if this subgraph or any subgraph contained within this subgraph, at any depth, is empty.

clearPatchWork

public void clearPatchWork()

patchWork

public void patchWork(java.awt.geom.Rectangle2D.Double r,
                      boolean square,
                      int mode)

preparePatchWork

public double preparePatchWork(int mode)

computePatchWork

public void computePatchWork(java.awt.geom.Rectangle2D.Double r,
                             boolean square)

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Specified by:
compare in interface java.util.Comparator

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object

nodeElements

public java.util.Iterator<Node> nodeElements()
Get an Iterator of the node elements in this subgraph.

Returns:
an Iterator of Node objects

nodeElementsAsArray

public Node[] nodeElementsAsArray()

edgeElements

public java.util.Iterator<Edge> edgeElements()
Get an Iterator of the edge elements in this subgraph.

Returns:
an Iterator of Edge objects

edgeElementsAsArray

public Edge[] edgeElementsAsArray()

subgraphElements

public java.util.Iterator<Subgraph> subgraphElements()
Get an Iterator of the subgraph elements in this subgraph.

Returns:
an Iterator of Subgraph objects

subgraphElementsAsArray

public Subgraph[] subgraphElementsAsArray()

elements

public GraphIterator elements(int types)
Get an Iterator of elements in this subgraph and any subgraphs under this one.

Parameters:
types - a bitwise-oring of NODE, EDGE, SUBGRAPH to determine which element types should be in the Iterator
Returns:
a GraphIterator containing Element objects.
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

elements

public GraphIterator elements()
Get an Iterator of all elements in this subgraph and any subgraphs under this one. A convenience method equivalent to: elements(NODE|EDGE|SUBGRAPH)

Returns:
a GraphIterator containing Element objects.
See Also:
elements(int)

listOfElements

public java.util.List<Element> listOfElements(int types)
Get a vector of elements in this subgraph and, by recursion, descendant subgraphs.

Parameters:
types - a bitwise-oring of NODE, EDGE, SUBGRAPH to determine which element types should be in the count
Returns:
a vector of the specified elements in this subgraph and its descendants (excluding the current subgraph itself).
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH


Grappa 1.2