All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class att.grappa.Element

java.lang.Object
   |
   +----att.grappa.Element

public abstract class Element
extends Object
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.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Constructor Index

 o Element()
Element constructor needed only during init phase of Graph class.
 o Element(int, Subgraph)
Element constructor used during init phase of the Node, Edge and Subgraph classes.

Method Index

 o addTag(String)
Tags the element with the supplied string.
 o canonString(String)
Canonicalizes the supplied string for output.
 o canonValue(String)
Canonicalizes the supplied string for look-up.
 o delete()
Method for deleting an element.
 o getAppObject()
Get the AppObject for this Element.
 o getAttribute(String)
Get the Attribute of this Element for the specified key.
 o getAttributePairs()
Get an enumeration of all attribute pairs for this element.
 o getAttributeValue(String)
Get the Attribute value of this Element for the specified key.
 o getDefaultAttribute(int, String)
Get the corresponding default attribute for the specified type and key.
 o getDefaultAttribute(String)
Get the default attribute of this element for the specified key.
 o getDrawObject()
Get the DrawObject for this Element.
 o getGraph()
Get the Graph of this Element.
 o getId()
Get the ID number of this Element.
 o getIdKey()
Get the ID of this Element as a Long object.
 o getLocalAttribute(String)
Get only the corresponding local attribute for the specified key.
 o getLocalAttributeKeys()
Gets an enumeration of the keys for this Element's local attributes.
 o getLocalAttributePairs()
Get an Enumeration of the Attribute objects for this Element.
 o getName()
Get the name of this Element.
 o getSubgraph()
Get the containing Subgraph of this Element.
 o getType()
Get the type of this Element.
 o hasAttributeForKey(String)
Checks to see if this element has an Attribute matching the key
 o hasTag(String)
Check if this Element has the supplied tag.
 o isEdge()
Check if this Element is an edge.
 o isNode()
Check if this Element is a node.
 o isSubgraph()
Check if this Element is a subgraph.
 o isVisible()
Check if this Element is flagged as visible.
 o printElement(PrintWriter)
Print a description of this element to the given print stream.
 o removeAllTags()
Removes any and all tags associated with this element.
 o removeTag(String)
Removes the specified tag from this element.
 o setAppObject(AppObject)
set AppObject associated with element.
 o setAttribute(Attribute)
Sets or creates an attribute for this element from the attribute supplied.
 o setAttribute(String, String)
Sets or creates an attribute for this element from the supplied arguments.
 o setDefaultAttribute(Attribute)
Sets or creates a default attribute for this element type within the containing subgraph of this element from the supplied arguments.
 o setDefaultAttribute(int, Attribute)
Sets or creates a default attribute of the specified type within the containing subgraph of this element from the supplied arguments.
 o setDefaultAttribute(int, String, String)
Sets or creates a default attribute of the specified type within the containing subgraph of this element from the supplied arguments.
 o setDefaultAttribute(String, String)
Sets or creates a default attribute for this element type within the containing subgraph of this element from the supplied arguments.
 o setIdKey(int)
Sets the id key of this element
 o setSubgraph(Subgraph)
Set the parent subgraph for this element.
 o setVisible(boolean)
Sets the visibility flag of this element to the specified value.
 o toString()
Get the String rendition of the element.

Constructors

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

 o 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:
NODE, EDGE, SUBGRAPH

Methods

 o getAppObject
 public AppObject getAppObject()
Get the AppObject for this Element.

Returns:
the application object associated with this element
See Also:
AppObject
 o getDrawObject
 public DrawObject getDrawObject()
Get the DrawObject for this Element.

Returns:
the draw object associated with this element
See Also:
DrawObject
 o getType
 public abstract int getType()
Get the type of this Element. Useful for distinguishing Element objects.

Returns:
the appropriate class variable constant
See Also:
NODE, EDGE, SUBGRAPH
 o isNode
 public boolean isNode()
Check if this Element is a node. Overridden in Node to return true.

Returns:
false, unless overridden.
See Also:
isNode
 o isEdge
 public boolean isEdge()
Check if this Element is an edge. Overridden in Edge to return true.

Returns:
false, unless overridden.
See Also:
isEdge
 o isSubgraph
 public boolean isSubgraph()
Check if this Element is a subgraph. Overridden in Subgraph to return true.

Returns:
false, unless overridden.
See Also:
isSubgraph
 o getName
 public String getName()
Get the name of this Element.

Returns:
the name of the element.
 o setAttribute
 public String 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
 o setAttribute
 public String setAttribute(String name,
                            String 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
 o setDefaultAttribute
 public String setDefaultAttribute(String name,
                                   String 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
 o setDefaultAttribute
 public String setDefaultAttribute(int type,
                                   String name,
                                   String 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
 o setDefaultAttribute
 public String 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
 o setDefaultAttribute
 public String 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
 o getLocalAttributeKeys
 public Enumeration getLocalAttributeKeys()
Gets an enumeration of the keys for this Element's local attributes.

Returns:
an Enumneration of String objects
 o getLocalAttributePairs
 public Enumeration getLocalAttributePairs()
Get an Enumeration of the Attribute objects for this Element.

Returns:
an Enumneration of the (local) Attribute objects.
 o getAttributePairs
 public Enumeration getAttributePairs()
Get an enumeration of all attribute pairs for this element.

Returns:
an enumeration of local and default Attribute objects for this element.
 o getLocalAttribute
 public Attribute getLocalAttribute(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 value of the local Attribute object matching the key or null.
 o getDefaultAttribute
 public Attribute getDefaultAttribute(int type,
                                      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.
 o getDefaultAttribute
 public Attribute getDefaultAttribute(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.
 o getAttribute
 public Attribute getAttribute(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.
 o getAttributeValue
 public String getAttributeValue(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.
 o hasAttributeForKey
 public boolean hasAttributeForKey(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.
 o getGraph
 public Graph getGraph()
Get the Graph of this Element.

Returns:
the containing graph object.
 o getSubgraph
 public Subgraph getSubgraph()
Get the containing Subgraph of this Element.

Returns:
the parent subgraph object.
 o setSubgraph
 public void setSubgraph(Subgraph subgraph)
Set the parent subgraph for this element.

Parameters:
subgraph - the parent subgraph that contains this element.
 o getId
 public int getId()
Get the ID number of this Element.

Returns:
the id number of this element.
 o getIdKey
 public Long getIdKey()
Get the ID of this Element as a Long object.

Returns:
the id object of this element.
 o setIdKey
 protected void setIdKey(int type)
Sets the id key of this element

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

Parameters:
out - the print stream for output.
 o toString
 public String toString()
Get the String rendition of the element.

Returns:
the string rendition of the element, quoted as needed.
Overrides:
toString in class Object
 o canonString
 public static String canonString(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.
 o canonValue
 public static String canonValue(String input)
Canonicalizes the supplied string for look-up.

Parameters:
input - the string to be canonicalized.
Returns:
the input string, with non-alphanumerics removed and alphabetics are converted to lower-case.
 o setAppObject
 protected void setAppObject(AppObject appObject)
set AppObject associated with element.

Parameters:
appObject - value to which appObject is to be set
 o delete
 public void delete()
Method for deleting an element. Clears element references from graph tables and frees up space explicitly. Also calls the AppObject delete() method.

See Also:
delete, reset
 o addTag
 public void addTag(String tag)
Tags the element with the supplied string. Unlike attributes, tags are only used within Grappa are cannot be saved to disk and reloaded.

Parameters:
tag - the tag to associate with this Element.
 o hasTag
 public boolean hasTag(String tag)
Check if this Element has the supplied tag.

Parameters:
tag - tag value to be searched for
Returns:
true, if this Element contains the supplied tag
 o removeAllTags
 public void removeAllTags()
Removes any and all tags associated with this element.

 o removeTag
 public void removeTag(String tag)
Removes the specified tag from this element.

Parameters:
tag - the tag value to remove
 o setVisible
 public boolean setVisible(boolean newValue)
Sets the visibility flag of this element to the specified value. Draws or erases the element on any existing DrawPanes.

Parameters:
newValue - the new value to assign to the visibilty flag
Returns:
the old value of the visibility flag
 o isVisible
 public boolean isVisible()
Check if this Element is flagged as visible.

Returns:
the current value of this element's visibility flag

All Packages  Class Hierarchy  This Package  Previous  Next  Index