att.grappa
Class Element

java.lang.Object
  extended by att.grappa.Element
All Implemented Interfaces:
GrappaConstants
Direct Known Subclasses:
Edge, Node, Subgraph

public abstract class Element
extends java.lang.Object
implements GrappaConstants

This abstract class is the root class for the Node, Edge, Subgraph and Graph classes. It is the basis for describing the graph elements.

Version:
1.2, 21 Aug 2005; Copyright 1996 - 2005 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Field Summary
(package private)  java.util.Hashtable attributes
           
(package private)  java.util.Hashtable<java.lang.String,java.lang.String> attrsOfInterest
           
private  boolean busy
           
(package private)  java.lang.String canonName
           
 int counter
          A convenience variable, not used by Grappa, but available to keep track of or otherwise mark graph elements when traversing a graph.
private  boolean deleteCalled
           
private  Graph graph
           
(package private)  GrappaNexus grappaNexus
           
 int highlight
          Determines the type of highlighting to apply, if any, when drawing.
private  java.lang.Long idKey
           
 int linewidth
          Indicates indicates line width for element (for nodes or subgraphs, it is the outline width, when applicable).
(package private)  java.lang.String name
           
 java.lang.Object object
          A general-purpose object not used by Grappa and intended for application writers to attach whatever they want to an Element without the need for extending the class.
private  java.awt.geom.Rectangle2D.Double patch
           
private  double patchSize
           
 boolean printAllAttributes
          Boolean to indicate if all of this element's attributes should be printed.
 boolean printDefaultAttributes
          Boolean to indicate if the default attributes associated with this element should be printed.
 boolean selectable
          Indicates whether this element should be considered selectable or not.
private  Subgraph subgraph
           
static boolean usePrintList
          Indicates whether only the list of attributes found in the PRINTLIST_ATTR should be printed.
private static java.util.Hashtable userAttributeTypeMap
           
(package private)  long visastamp
           
 boolean visible
          Indicates whether this element should be considered visible or not.
 
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
protected Element()
          Element constructor needed only during init phase of Graph class.
protected Element(int type, Subgraph subg)
          Element constructor used during init phase of the Node, Edge and Subgraph classes.
 
Method Summary
 void addTag(java.lang.String tag)
          Tags the element with the supplied string.
static int attributeType(java.lang.String attrname)
          Returns the attribute conversion type for the supplied attribute name.
protected  void attrNotOfInterest(java.lang.String name)
          Remove the name of an attribute of interest to this object
protected  void attrOfInterest(java.lang.String name)
          Add the name of an attribute of interest to this element
 java.util.Vector bdfs(int steps)
          Performs a breadth-first or a depth-first search starting at this Element.
 void buildShape()
          Creates and populates the GrappaNexus object for this element.
static java.lang.String canonString(java.lang.String input)
          Canonicalizes the supplied string for output.
static java.lang.String canonValue(java.lang.String input)
          Canonicalizes the supplied string for look-up.
protected  void clearBBox()
           
 boolean delete()
          Method for deleting an element.
(package private)  boolean deleteCalled()
          Boolean inicating if a delete request has been received by this element.
private static void doBDFS(int type, int depth, long stamp, int level, java.util.Vector inbox, java.util.Vector layers)
           
private  void elementAttrsOfInterest()
           
 Attribute getAttribute(java.lang.String key)
          Get the Attribute of this Element for the specified key.
 java.util.Enumeration getAttributePairs()
          Get an enumeration of all attribute pairs for this element.
 java.lang.Object getAttributeValue(java.lang.String key)
          Get the Attribute value of this Element for the specified key.
 Attribute getDefaultAttribute(int type, java.lang.String key)
          Get the corresponding default attribute for the specified type and key.
 Attribute getDefaultAttribute(java.lang.String key)
          Get the default attribute of this element for the specified key.
 Graph getGraph()
          Get the Graph of this Element.
 GrappaNexus getGrappaNexus()
          Returns the GrappaNexus object associated with this element.
 int getId()
          Get the ID number of this Element.
 java.lang.Long getIdKey()
          Get the ID of this Element as a Long object.
 Attribute getLocalAttribute(java.lang.String key)
          Get only the corresponding local attribute for the specified key.
 java.util.Enumeration getLocalAttributeKeys()
          Gets an enumeration of the keys for this Element's local attributes.
 java.util.Enumeration getLocalAttributePairs()
          Get an Enumeration of the Attribute objects for this Element.
 java.lang.String getName()
          Get the name of this Element.
(package private)  java.awt.geom.Rectangle2D.Double getPatch()
           
(package private)  double getPatchSize()
           
 Subgraph getSubgraph()
          Get the containing Subgraph of this Element.
 Attribute getThisAttribute(java.lang.String key)
          Get only the corresponding local attribute for the specified key if it is not inherited from the parent, otherwise return null.
 java.lang.Object getThisAttributeValue(java.lang.String key)
          Get only the value of the corresponding local attribute for the specified key if the attribute is not inherited from the parent, otherwise return null.
abstract  int getType()
          Get the type of this Element.
 boolean hasAttributeForKey(java.lang.String key)
          Checks to see if this element has an Attribute matching the key
 boolean hasDefaultTag(java.lang.String tag)
          Check if this Element has the supplied tag as a default tag.
 boolean hasDefaultTags()
          Check if this Element has any default tags at all.
 boolean hasLocalTag(java.lang.String tag)
          Check if this Element has the supplied tag locally.
 boolean hasLocalTags()
          Check if this Element is tagged at all locally.
 boolean hasTag(java.lang.String tag)
          Check if this Element has the supplied tag either locally or as a default.
 boolean hasTags()
          Check if this Element is tagged at all either locally or with a default.
 boolean isEdge()
          Check if this Element is an edge.
 boolean isNode()
          Check if this Element is a node.
 boolean isOfInterest(java.lang.String name)
          Check if the name of an attribute of interest to this object
 boolean isSubgraph()
          Check if this Element is a subgraph.
 java.util.Enumeration listAttrsOfInterest()
          Provide an enumeration of the names of the attributes of interest.
private  void printAttributes(java.io.PrintWriter out, java.lang.String outerIndent)
           
 void printElement(java.io.PrintWriter out)
          Print a description of this element to the given print stream.
(package private)  void release()
          Release the reservation on this Element, if any.
private  Attribute removeAttribute(java.lang.String name)
           
 void removeTag(java.lang.String tag)
          Removes the specified tag locally from this element.
 void removeTags()
          Removes all tags locally associated with this element.
(package private)  boolean reserve()
          Check if this Element can be reserved, otherwise queue request
 java.lang.Object setAttribute(Attribute attr)
          Sets or creates an attribute for this element from the attribute supplied.
 java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
          Sets or creates an attribute for this element from the supplied arguments.
 java.lang.Object setDefaultAttribute(Attribute attr)
          Sets or creates a default attribute for this element type within the containing subgraph of this element from the supplied arguments.
 java.lang.Object setDefaultAttribute(int type, Attribute attr)
          Sets or creates a default attribute of the specified type within the containing subgraph of this element from the supplied arguments.
 java.lang.Object setDefaultAttribute(int type, java.lang.String name, java.lang.Object value)
          Sets or creates a default attribute of the specified type within the containing subgraph of this element from the supplied arguments.
 java.lang.Object setDefaultAttribute(java.lang.String name, java.lang.Object value)
          Sets or creates a default attribute for this element type within the containing subgraph of this element from the supplied arguments.
(package private)  boolean setDelete(boolean delete)
          Queue or unqueue a delete request.
(package private)  void setGraph(Graph graph)
          Set the containing graph for this element.
protected  void setIdKey(int type)
          Sets the id key of this element
(package private) abstract  void setName()
          Intended to be a subclass-specific name generating method.
(package private)  void setPatch(double x, double y, double w, double h)
           
(package private)  void setPatch(java.awt.geom.Rectangle2D.Double p)
           
(package private)  void setPatchSize(double val)
           
private  boolean setReserved(boolean state, boolean isDelete)
           
 void setSubgraph(Subgraph subgraph)
          Set the parent subgraph for this element.
static int setUserAttributeType(java.lang.String attrname, int attrtype)
          Sets the conversion type of a user-defined attribute.
 java.lang.String toString()
          Get the String rendition of the element.
static java.lang.String typeString(int elemType, boolean uplow)
          Provides the element type as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

graph

private Graph graph

subgraph

private Subgraph subgraph

visastamp

long visastamp

deleteCalled

private boolean deleteCalled

busy

private boolean busy

userAttributeTypeMap

private static java.util.Hashtable userAttributeTypeMap

object

public java.lang.Object object
A general-purpose object not used by Grappa and intended for application writers to attach whatever they want to an Element without the need for extending the class.


visible

public boolean visible
Indicates whether this element should be considered visible or not. If not visible, it will not be drawn and will not be selected by a mouse click (if the supplied selection methods are used). Note that there is redundancy here with the invis component of the style attribute. This value must be true and invis must be false for the element to be visible.


selectable

public boolean selectable
Indicates whether this element should be considered selectable or not. The default is true.


linewidth

public int linewidth
Indicates indicates line width for element (for nodes or subgraphs, it is the outline width, when applicable). The default is 0 (single pixel).


usePrintList

public static boolean usePrintList
Indicates whether only the list of attributes found in the PRINTLIST_ATTR should be printed. The default is false.


counter

public int counter
A convenience variable, not used by Grappa, but available to keep track of or otherwise mark graph elements when traversing a graph.


highlight

public int highlight
Determines the type of highlighting to apply, if any, when drawing. Currently recognized choices are SELECTION_MASK and DELETION_MASK.


idKey

private java.lang.Long idKey

name

java.lang.String name

attributes

java.util.Hashtable attributes

attrsOfInterest

java.util.Hashtable<java.lang.String,java.lang.String> attrsOfInterest

grappaNexus

GrappaNexus grappaNexus

printAllAttributes

public boolean printAllAttributes
Boolean to indicate if all of this element's attributes should be printed. Either this flag or the elementPrintAllAttributes can turn on printing of all attributes.

See Also:
Subgraph.printSubgraph(java.io.PrintWriter), Grappa.elementPrintAllAttributes

printDefaultAttributes

public boolean printDefaultAttributes
Boolean to indicate if the default attributes associated with this element should be printed. Naturally, this option only is effective if the element is a subgraph.

See Also:
Subgraph.printSubgraph(java.io.PrintWriter), Grappa.elementPrintDefaultAttributes

canonName

java.lang.String canonName

patchSize

private double patchSize

patch

private java.awt.geom.Rectangle2D.Double patch
Constructor Detail

Element

protected Element()
Element constructor needed only during init phase of Graph class. Since the Element class is abstact, it cannot be instantiated directly.


Element

protected Element(int type,
                  Subgraph subg)
Element constructor used during init phase of the Node, Edge and Subgraph classes. Since the Element class is abstact, it cannot be instantiated directly.

Parameters:
type - the type of the element (Grappa.NODE, Grappa.EDGE or Grappa.SUBGRAPH).
subg - the subgraph containing this element.
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH
Method Detail

elementAttrsOfInterest

private void elementAttrsOfInterest()

getType

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

Returns:
the appropriate class variable constant
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

isNode

public boolean isNode()
Check if this Element is a node. Overridden in Node to return true.

Returns:
false, unless overridden.
See Also:
Node.isNode()

isEdge

public boolean isEdge()
Check if this Element is an edge. Overridden in Edge to return true.

Returns:
false, unless overridden.
See Also:
Edge.isEdge()

isSubgraph

public boolean isSubgraph()
Check if this Element is a subgraph. Overridden in Subgraph to return true.

Returns:
false, unless overridden.
See Also:
Subgraph.isSubgraph()

setName

abstract void setName()
Intended to be a subclass-specific name generating method. Used by edges and when nodes or graphs are created without an explicit name. Note that graphs and nodes should also have a setName that takes an explicit name as an argument.


getName

public java.lang.String getName()
Get the name of this Element.

Returns:
the name of the element.

reserve

boolean reserve()
Check if this Element can be reserved, otherwise queue request

Returns:
true, if successfully reserved.

release

void release()
Release the reservation on this Element, if any.


setDelete

boolean setDelete(boolean delete)
Queue or unqueue a delete request.

Returns:
true, unless a delete request has already been queued for this Element.

setReserved

private boolean setReserved(boolean state,
                            boolean isDelete)

attrOfInterest

protected void attrOfInterest(java.lang.String name)
Add the name of an attribute of interest to this element

Parameters:
name - the name of the attribute

attrNotOfInterest

protected void attrNotOfInterest(java.lang.String name)
Remove the name of an attribute of interest to this object

Parameters:
name - the name of the attribute

listAttrsOfInterest

public java.util.Enumeration listAttrsOfInterest()
Provide an enumeration of the names of the attributes of interest.

Returns:
an enumeration of attribute names that are of interest

isOfInterest

public boolean isOfInterest(java.lang.String name)
Check if the name of an attribute of interest to this object

Parameters:
name - the name of the attribute
Returns:
true when the name is of interest

setAttribute

public java.lang.Object setAttribute(Attribute attr)
Sets or creates an attribute for this element from the attribute supplied. The storage key is the attribute name. If the value portion of the supplied attribute is null, then the attribute will be removed from the element.

Parameters:
attr - the attribute from which to set the element's attribute.
Returns:
the value of the (local) attribute previously stored under the same name

setAttribute

public java.lang.Object setAttribute(java.lang.String name,
                                     java.lang.Object value)
Sets or creates an attribute for this element from the supplied arguments. The storage key is the attribute name. If the value argument is null, then the attribute will be removed from the element.

Parameters:
name - the attribute name
value - the attribute value
Returns:
the value of the (local) attribute previously stored under the same name

removeAttribute

private Attribute removeAttribute(java.lang.String name)

setDefaultAttribute

public java.lang.Object setDefaultAttribute(java.lang.String name,
                                            java.lang.Object value)
Sets or creates a default attribute for this element type within the containing subgraph of this element from the supplied arguments. The storage key is the attribute name. If the value argument is null, then the attribute will be removed from the subgraph.

Parameters:
name - the attribute name
value - the attribute value
Returns:
the value of the (default) attribute previously stored under the same name

setDefaultAttribute

public java.lang.Object setDefaultAttribute(int type,
                                            java.lang.String name,
                                            java.lang.Object value)
Sets or creates a default attribute of the specified type within the containing subgraph of this element from the supplied arguments. The storage key is the attribute name. If the value argument is null, then the attribute will be removed from the subgraph.

Parameters:
type - the default attribute type
name - the attribute name
value - the attribute value
Returns:
the value of the (default) attribute previously stored under the same name

setDefaultAttribute

public java.lang.Object setDefaultAttribute(Attribute attr)
Sets or creates a default attribute for this element type within the containing subgraph of this element from the supplied arguments. The storage key is the attribute name. If the value portion of the supplied attribute is null, then the attribute will be removed from the subgraph.

Parameters:
attr - the attribute to which the default should be set
Returns:
the value of the (default) attribute previously stored under the same name

setDefaultAttribute

public java.lang.Object setDefaultAttribute(int type,
                                            Attribute attr)
Sets or creates a default attribute of the specified type within the containing subgraph of this element from the supplied arguments. The storage key is the attribute name. If the value portion of the supplied attribute is null, then the attribute will be removed from the subgraph.

Parameters:
type - the default attribute type
attr - the attribute to which the default should be set
Returns:
the value of the (default) attribute previously stored under the same name

getLocalAttributeKeys

public java.util.Enumeration getLocalAttributeKeys()
Gets an enumeration of the keys for this Element's local attributes.

Returns:
an Enumneration of String objects

getLocalAttributePairs

public java.util.Enumeration getLocalAttributePairs()
Get an Enumeration of the Attribute objects for this Element.

Returns:
an Enumneration of the (local) Attribute objects.

getAttributePairs

public java.util.Enumeration getAttributePairs()
Get an enumeration of all attribute pairs for this element.

Returns:
an enumeration of local and default Attribute objects for this element.

getLocalAttribute

public Attribute getLocalAttribute(java.lang.String key)
Get only the corresponding local attribute for the specified key. A local attribute is one associated directly with this element as opposed to a subgraph ancestor.

Parameters:
key - the search key for the corresponding attribute.
Returns:
the local Attribute object matching the key or null.

getThisAttribute

public Attribute getThisAttribute(java.lang.String key)
Get only the corresponding local attribute for the specified key if it is not inherited from the parent, otherwise return null. Sometimes a local attribute will be set, but it will be a pointer to the parent value. This method distinguishes that case.

Parameters:
key - the search key for the corresponding attribute.
Returns:
the local Attribute object matching the key or null if it is not defined or it is a pointer to the parent attribute..

getThisAttributeValue

public java.lang.Object getThisAttributeValue(java.lang.String key)
Get only the value of the corresponding local attribute for the specified key if the attribute is not inherited from the parent, otherwise return null. Sometimes a local attribute will be set, but it will be simply a pointer to the parent attribute. This method distinguishes that case.

Parameters:
key - the search key for the corresponding attribute.
Returns:
the value of the local Attribute object matching the key or null if it is not defined or it is a pointer to the parent attribute..

getDefaultAttribute

public Attribute getDefaultAttribute(int type,
                                     java.lang.String key)
Get the corresponding default attribute for the specified type and key.

Parameters:
type - the type of the default attribute
key - the search key for the corresponding attribute.
Returns:
the value of the default Attribute object matching the key or null.

getDefaultAttribute

public Attribute getDefaultAttribute(java.lang.String key)
Get the default attribute of this element for the specified key.

Parameters:
key - the search key for the corresponding attribute.
Returns:
the value of the default Attribute object matching the key or null.

getAttribute

public Attribute getAttribute(java.lang.String key)
Get the Attribute of this Element for the specified key. Search first local, then default attributes until a match is found.

Parameters:
key - the search key for the attribute.
Returns:
the corresponding Attribute object or null.

getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String key)
Get the Attribute value of this Element for the specified key. Search first local, then default attributes until a match is found.

Parameters:
key - the search key for the attribute.
Returns:
the corresponding attribute value or null.

hasAttributeForKey

public boolean hasAttributeForKey(java.lang.String key)
Checks to see if this element has an Attribute matching the key

Parameters:
key - the search key for the attribute.
Returns:
true if there is a matching attribute, false otherwise.

getGraph

public Graph getGraph()
Get the Graph of this Element.

Returns:
the containing graph object.

getSubgraph

public Subgraph getSubgraph()
Get the containing Subgraph of this Element.

Returns:
the parent subgraph object.

setGraph

void setGraph(Graph graph)
Set the containing graph for this element.

Parameters:
graph - the overall graph that contains this element.

setSubgraph

public void setSubgraph(Subgraph subgraph)
Set the parent subgraph for this element.

Parameters:
subgraph - the parent subgraph that contains this element.

clearBBox

protected void clearBBox()

getId

public int getId()
Get the ID number of this Element.

Returns:
the id number of this element.

getIdKey

public java.lang.Long getIdKey()
Get the ID of this Element as a Long object.

Returns:
the id object of this element.

setIdKey

protected void setIdKey(int type)
Sets the id key of this element


printElement

public void printElement(java.io.PrintWriter out)
Print a description of this element to the given print stream.

Parameters:
out - the print stream for output.

printAttributes

private void printAttributes(java.io.PrintWriter out,
                             java.lang.String outerIndent)

toString

public java.lang.String toString()
Get the String rendition of the element.

Overrides:
toString in class java.lang.Object
Returns:
the string rendition of the element, quoted as needed.

canonString

public static java.lang.String canonString(java.lang.String input)
Canonicalizes the supplied string for output.

Parameters:
input - the string to be quoted, possibly.
Returns:
the input string, possibly enclosed in double quotes and with internal double quotes protected.

typeString

public static final java.lang.String typeString(int elemType,
                                                boolean uplow)
Provides the element type as a string.

Parameters:
elemType - an integer value representing an element type
uplow - set true to indicate the return value should be leading-capitalized, otherwise lower-case is returned
Returns:
the meaning of the element type in english

canonValue

public static java.lang.String canonValue(java.lang.String input)
Canonicalizes the supplied string for look-up. NOTE: Not currently used by Grappa.

Parameters:
input - the string to be canonicalized.
Returns:
the input string, with non-alphanumerics removed and alphabetics are converted to lower-case.

deleteCalled

boolean deleteCalled()
Boolean inicating if a delete request has been received by this element.


delete

public final boolean delete()
Method for deleting an element. Clears element references from graph tables and frees up space explicitly.

See Also:
Graph.reset()

addTag

public void addTag(java.lang.String tag)
Tags the element with the supplied string.

Parameters:
tag - the tag to associate with this Element.

hasTag

public boolean hasTag(java.lang.String tag)
Check if this Element has the supplied tag either locally or as a default.

Parameters:
tag - tag value to be searched for
Returns:
true, if this Element contains the supplied tag

hasLocalTag

public boolean hasLocalTag(java.lang.String tag)
Check if this Element has the supplied tag locally.

Parameters:
tag - tag value to be searched for
Returns:
true, if this Element contains the supplied tag

hasDefaultTag

public boolean hasDefaultTag(java.lang.String tag)
Check if this Element has the supplied tag as a default tag.

Parameters:
tag - tag value to be searched for
Returns:
true, if this Element has the supplied tag as a default tag

hasTags

public boolean hasTags()
Check if this Element is tagged at all either locally or with a default.

Returns:
true, if this Element is tagged at all

hasLocalTags

public boolean hasLocalTags()
Check if this Element is tagged at all locally.

Returns:
true, if this Element is tagged locally

hasDefaultTags

public boolean hasDefaultTags()
Check if this Element has any default tags at all.

Returns:
true, if this Element has any default tags

removeTags

public void removeTags()
Removes all tags locally associated with this element.


removeTag

public void removeTag(java.lang.String tag)
Removes the specified tag locally from this element.

Parameters:
tag - the tag value to remove

setUserAttributeType

public static int setUserAttributeType(java.lang.String attrname,
                                       int attrtype)
Sets the conversion type of a user-defined attribute. Unless provided for a specific attribute name, the attribute value will only be treated as a string. When provided, the string value of the attribute will be converted to the given type and vice versa.

Parameters:
attrname - the attribute name
attrtype - the attribute type
Returns:
the previous type associated with this attribute name

attributeType

public static int attributeType(java.lang.String attrname)
Returns the attribute conversion type for the supplied attribute name.

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

buildShape

public void buildShape()
Creates and populates the GrappaNexus object for this element. The GrappaNexus object provides bounding and drawing information for the element based on the element's attributes.


getGrappaNexus

public GrappaNexus getGrappaNexus()
Returns the GrappaNexus object associated with this element.


bdfs

public java.util.Vector bdfs(int steps)
Performs a breadth-first or a depth-first search starting at this Element.

Parameters:
steps - when negative, the search is exhaustive; otherwise the search stops after the number of steps indicated
Returns:
a Vector of Vector, the ith element of which gives the search results for step i. Reading the vector in increasing order gives breadth-first search results, while using decreasing order gives depth-first results.

doBDFS

private static void doBDFS(int type,
                           int depth,
                           long stamp,
                           int level,
                           java.util.Vector inbox,
                           java.util.Vector layers)

getPatchSize

double getPatchSize()

setPatchSize

void setPatchSize(double val)

getPatch

java.awt.geom.Rectangle2D.Double getPatch()

setPatch

void setPatch(java.awt.geom.Rectangle2D.Double p)

setPatch

void setPatch(double x,
              double y,
              double w,
              double h)