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
-
Element()
- Element constructor needed only during init phase of
Graph class.
-
Element(int, Subgraph)
- Element constructor used during init phase of the
Node,
Edge and
Subgraph classes.
-
addTag(String)
- Tags the element with the supplied string.
-
canonString(String)
- Canonicalizes the supplied string for output.
-
canonValue(String)
- Canonicalizes the supplied string for look-up.
-
delete()
- Method for deleting an element.
-
getAppObject()
- Get the AppObject for this Element.
-
getAttribute(String)
- Get the Attribute of this Element for the specified key.
-
getAttributePairs()
- Get an enumeration of all attribute pairs for this element.
-
getAttributeValue(String)
- Get the Attribute value of this Element for the specified key.
-
getDefaultAttribute(int, String)
- Get the corresponding default attribute for the specified type and key.
-
getDefaultAttribute(String)
- Get the default attribute of this element for the specified key.
-
getDrawObject()
- Get the DrawObject for this Element.
-
getGraph()
- Get the Graph of this Element.
-
getId()
- Get the ID number of this Element.
-
getIdKey()
- Get the ID of this Element as a Long object.
-
getLocalAttribute(String)
- Get only the corresponding local attribute for the specified key.
-
getLocalAttributeKeys()
- Gets an enumeration of the keys for this Element's local attributes.
-
getLocalAttributePairs()
- Get an Enumeration of the Attribute objects for this Element.
-
getName()
- Get the name of this Element.
-
getSubgraph()
- Get the containing Subgraph of this Element.
-
getType()
- Get the type of this Element.
-
hasAttributeForKey(String)
- Checks to see if this element has an Attribute matching the key
-
hasTag(String)
- Check if this Element has the supplied tag.
-
isEdge()
- Check if this Element is an edge.
-
isNode()
- Check if this Element is a node.
-
isSubgraph()
- Check if this Element is a subgraph.
-
isVisible()
- Check if this Element is flagged as visible.
-
printElement(PrintWriter)
- Print a description of this element to the given print stream.
-
removeAllTags()
- Removes any and all tags associated with this element.
-
removeTag(String)
- Removes the specified tag from this element.
-
setAppObject(AppObject)
- set AppObject associated with element.
-
setAttribute(Attribute)
- Sets or creates an attribute for this element from the attribute supplied.
-
setAttribute(String, String)
- Sets or creates an attribute for this element from the supplied
arguments.
-
setDefaultAttribute(Attribute)
- Sets or creates a default attribute for this element type within the
containing subgraph of this element from the supplied arguments.
-
setDefaultAttribute(int, Attribute)
- Sets or creates a default attribute of the specified type within the
containing subgraph of this element from the supplied arguments.
-
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.
-
setDefaultAttribute(String, String)
- Sets or creates a default attribute for this element type within the
containing subgraph of this element from the supplied arguments.
-
setIdKey(int)
- Sets the id key of this element
-
setSubgraph(Subgraph)
- Set the parent subgraph for this element.
-
setVisible(boolean)
- Sets the visibility flag of this element to the specified value.
-
toString()
- Get the String rendition of the element.
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:
- NODE, EDGE, SUBGRAPH
getAppObject
public AppObject getAppObject()
- Get the AppObject for this Element.
- Returns:
- the application object associated with this element
- See Also:
- AppObject
getDrawObject
public DrawObject getDrawObject()
- Get the DrawObject for this Element.
- Returns:
- the draw object associated with this element
- See Also:
- DrawObject
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
isNode
public boolean isNode()
- Check if this Element is a node. Overridden in Node to return true.
- Returns:
- false, unless overridden.
- See Also:
- isNode
isEdge
public boolean isEdge()
- Check if this Element is an edge. Overridden in Edge to return true.
- Returns:
- false, unless overridden.
- See Also:
- isEdge
isSubgraph
public boolean isSubgraph()
- Check if this Element is a subgraph. Overridden in Subgraph to return true.
- Returns:
- false, unless overridden.
- See Also:
- isSubgraph
getName
public String getName()
- Get the name of this Element.
- Returns:
- the name of the element.
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
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
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
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
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
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
getLocalAttributeKeys
public Enumeration getLocalAttributeKeys()
- Gets an enumeration of the keys for this Element's local attributes.
- Returns:
- an Enumneration of String objects
getLocalAttributePairs
public Enumeration getLocalAttributePairs()
- Get an Enumeration of the Attribute objects for this Element.
- Returns:
- an Enumneration of the (local) Attribute objects.
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.
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.
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.
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.
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.
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.
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.
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.
setSubgraph
public void setSubgraph(Subgraph subgraph)
- Set the parent subgraph for this element.
- Parameters:
- subgraph - the parent subgraph that contains this element.
getId
public int getId()
- Get the ID number of this Element.
- Returns:
- the id number of this element.
getIdKey
public 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(PrintWriter out)
- Print a description of this element to the given print stream.
- Parameters:
- out - the print stream for output.
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
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.
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.
setAppObject
protected void setAppObject(AppObject appObject)
- set AppObject associated with element.
- Parameters:
- appObject - value to which appObject is to be set
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
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.
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
removeAllTags
public void removeAllTags()
- Removes any and all tags associated with this element.
removeTag
public void removeTag(String tag)
- Removes the specified tag from this element.
- Parameters:
- tag - the tag value to remove
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
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