att.grappa
Class Node
java.lang.Object
att.grappa.Element
att.grappa.Node
- All Implemented Interfaces:
- GrappaConstants
public class Node
- extends Element
This class describes a node.
- Version:
- 1.2, 21 Aug 2005; Copyright 1996 - 2005 by AT&T Corp.
- Author:
- John Mocenigo, Research @ AT&T Labs
Field Summary |
static java.lang.String |
defaultNamePrefix
Default node name prefix used by setName(). |
private java.util.Vector |
inEdges
|
private java.util.Vector |
outEdges
|
private java.util.Vector |
Ports
|
Fields inherited from class att.grappa.Element |
attributes, attrsOfInterest, canonName, counter, grappaNexus, highlight, linewidth, name, object, printAllAttributes, printDefaultAttributes, selectable, usePrintList, visastamp, 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, HASHLIST_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 |
Node(Subgraph subg)
Use this constructor when creating a node within a subgraph
with an automatically generated name. |
Node(Subgraph subg,
java.lang.String name)
Use this constructor when creating a node within a subgraph. |
Method Summary |
void |
addEdge(Edge edge,
boolean inEdge)
Add the given edge to this node's inEdges or outEdges dictionaries,
if it is not already there. |
static int |
attributeType(java.lang.String attrname)
Returns the attribute conversion type for the supplied attribute name. |
java.util.Enumeration |
edgeElements()
Get an Enumeration of the edges directed to or from this node. |
Edge |
findInEdgeByKey(Node tail,
java.lang.String key)
Find an inbound edge given its tail and key. |
Edge |
findOutEdgeByKey(Node head,
java.lang.String key)
Find an outbound edge given its head and key. |
GrappaPoint |
getCenterPoint()
Returns the center point of the node. |
int |
getType()
Get the type of this element. |
java.util.Enumeration |
inEdgeElements()
Get an Enumeration of the edges directed to this node. |
boolean |
isNode()
Check if this element is a node. |
private void |
nodeAttrsOfInterest()
|
java.util.Enumeration |
outEdgeElements()
Get an Enumeration of the edges directed from this node. |
void |
printNode(java.io.PrintWriter out)
Print the node description to the provided stream. |
void |
removeEdge(Edge edge,
boolean inEdge)
Remove the given edge from this node's inEdges or outEdges dictionaries. |
private void |
resetEdgeNames()
|
(package private) void |
setName()
Generates and sets the name for this node. |
void |
setName(java.lang.String newName)
Sets the node name to the supplied argument. |
Methods inherited from class att.grappa.Element |
addTag, attrNotOfInterest, attrOfInterest, bdfs, buildShape, canonString, canonValue, clearBBox, delete, deleteCalled, getAttribute, getAttributePairs, getAttributeValue, getDefaultAttribute, getDefaultAttribute, getGraph, getGrappaNexus, getId, getIdKey, getLocalAttribute, getLocalAttributeKeys, getLocalAttributePairs, getName, getPatch, getPatchSize, getSubgraph, getThisAttribute, getThisAttributeValue, hasAttributeForKey, hasDefaultTag, hasDefaultTags, hasLocalTag, hasLocalTags, hasTag, hasTags, isEdge, isOfInterest, isSubgraph, listAttrsOfInterest, printElement, release, removeTag, removeTags, reserve, setAttribute, setAttribute, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setDelete, setGraph, setIdKey, setPatch, setPatch, setPatchSize, setSubgraph, setUserAttributeType, toString, typeString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
defaultNamePrefix
public static final java.lang.String defaultNamePrefix
- Default node name prefix used by setName().
- See Also:
setName()
,
Constant Field Values
inEdges
private java.util.Vector inEdges
outEdges
private java.util.Vector outEdges
Ports
private java.util.Vector Ports
Node
public Node(Subgraph subg,
java.lang.String name)
- Use this constructor when creating a node within a subgraph.
- Parameters:
subg
- the parent subgraph.name
- the name of this node.
Node
public Node(Subgraph subg)
- Use this constructor when creating a node within a subgraph
with an automatically generated name.
- Parameters:
subg
- the parent subgraph.- See Also:
setName()
nodeAttrsOfInterest
private void nodeAttrsOfInterest()
isNode
public boolean isNode()
- Check if this element is a node.
Useful for testing the subclass type of an Element object.
- Overrides:
isNode
in class Element
- Returns:
- true if this object is a Node.
- See Also:
isNode()
getType
public int getType()
- Get the type of this element.
Useful for distinguishing among Element objects.
- Specified by:
getType
in class Element
- Returns:
- the class variable constant Grappa.NODE
- See Also:
GrappaConstants.NODE
setName
void setName()
- Generates and sets the name for this node.
The generated name is the concatenation of Node.defaultNamePrefix
with the numeric id of this node instance.
- Specified by:
setName
in class Element
- See Also:
defaultNamePrefix
,
Element.getId()
setName
public void setName(java.lang.String newName)
throws java.lang.IllegalArgumentException
- Sets the node name to the supplied argument.
When the argument is null, setName() is called.
- Parameters:
newName
- the new name for the node.
- Throws:
java.lang.IllegalArgumentException
- when newName is not unique.- See Also:
setName()
resetEdgeNames
private void resetEdgeNames()
addEdge
public void addEdge(Edge edge,
boolean inEdge)
- Add the given edge to this node's inEdges or outEdges dictionaries,
if it is not already there.
The boolean indicates whether the edge terminates at (inEdge) or
emanates from (outEdge) the node.
- Parameters:
edge
- the edge to be added to this node's dictionary.inEdge
- if set true, add to inEdges dictionary otherwise add
to outEdges dictionary.- See Also:
Edge
findOutEdgeByKey
public Edge findOutEdgeByKey(Node head,
java.lang.String key)
- Find an outbound edge given its head and key.
- Parameters:
head
- the Node at the head of the edgekey
- the key String associated with the edge
- Returns:
- the matching edge or null
findInEdgeByKey
public Edge findInEdgeByKey(Node tail,
java.lang.String key)
- Find an inbound edge given its tail and key.
- Parameters:
tail
- the Node at the tail of the edgekey
- the key String associated with the edge
- Returns:
- the matching edge or null
getCenterPoint
public GrappaPoint getCenterPoint()
- Returns the center point of the node.
as determined from the height
and width attributes of the node.
- Returns:
- the node's center point.
removeEdge
public void removeEdge(Edge edge,
boolean inEdge)
- Remove the given edge from this node's inEdges or outEdges dictionaries.
The boolean indicates whether the edge terminates at (inEdge) or
emanates from (outEdge) the node.
- Parameters:
edge
- the edge to be removed from this node's dictionary.inEdge
- if set true, remove from inEdges dictionary otherwise
remove from outEdges dictionary.- See Also:
Edge
printNode
public void printNode(java.io.PrintWriter out)
- Print the node description to the provided stream.
- Parameters:
out
- the output text stream for writing the description.
attributeType
public static int attributeType(java.lang.String attrname)
- Returns the attribute conversion type for the supplied attribute name.
After node 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
edgeElements
public java.util.Enumeration edgeElements()
- Get an Enumeration of the edges directed to or from this node.
- Returns:
- an Enumeration of all the edges (in or out) associated with this node.
inEdgeElements
public java.util.Enumeration inEdgeElements()
- Get an Enumeration of the edges directed to this node.
- Returns:
- an Enumeration of all the inbound edges associated with this node.
outEdgeElements
public java.util.Enumeration outEdgeElements()
- Get an Enumeration of the edges directed from this node.
- Returns:
- an Enumeration of all the outbound edges associated with this node.