|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatt.grappa.Element
public abstract class Element
This abstract class is the root class for the Node, Edge, Subgraph and Graph classes. It is the basis for describing the graph elements.
Field Summary | |
---|---|
int |
counter
A convenience variable, not used by Grappa, but available to keep track of or otherwise mark graph elements when traversing a graph. |
int |
highlight
Determines the type of highlighting to apply, if any, when drawing. |
int |
linewidth
Indicates indicates line width for element (for nodes or subgraphs, it is the outline width, when applicable). |
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. |
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. |
static boolean |
usePrintList
Indicates whether only the list of attributes found in the PRINTLIST_ATTR should be printed. |
boolean |
visible
Indicates whether this element should be considered visible or not. |
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 |
attrOfInterest(java.lang.String[] names)
fairly hacked code to allow sharing of attribute Sets. |
java.util.List |
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. |
Attribute |
getAttribute(java.lang.String key)
Get the Attribute of this Element for the specified key. |
java.util.Iterator<Attribute> |
getAttributePairs()
Get an Iterator 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.Iterator<java.lang.String> |
getLocalAttributeKeys()
Gets an Iterator of the keys for this Element's local attributes. |
java.util.Iterator<Attribute> |
getLocalAttributePairs()
Get an Iterator of the Attribute objects for this Element. |
java.lang.String |
getName()
Get the name of this Element. |
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.Iterator<java.lang.String> |
listAttrsOfInterest()
Provide an iterator of the names of the attributes of interest. |
void |
printElement(java.io.PrintWriter out)
Print a description of this element to the given print stream. |
void |
removeTag(java.lang.String tag)
Removes the specified tag locally from this element. |
void |
removeTags()
Removes all tags locally associated with this element. |
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. |
protected void |
setIdKey(int type)
Sets the id key of this element |
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 |
---|
public java.lang.Object object
public boolean visible
public boolean selectable
public int linewidth
public static boolean usePrintList
public int counter
public int highlight
public boolean printAllAttributes
Subgraph.printSubgraph(java.io.PrintWriter)
,
Grappa.elementPrintAllAttributes
public boolean printDefaultAttributes
Subgraph.printSubgraph(java.io.PrintWriter)
,
Grappa.elementPrintDefaultAttributes
Constructor Detail |
---|
protected Element()
protected Element(int type, Subgraph subg)
type
- the type of the element (Grappa.NODE, Grappa.EDGE or Grappa.SUBGRAPH).subg
- the subgraph containing this element.GrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
Method Detail |
---|
public abstract int getType()
GrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public boolean isNode()
Node.isNode()
public boolean isEdge()
Edge.isEdge()
public boolean isSubgraph()
Subgraph.isSubgraph()
public java.lang.String getName()
protected void attrOfInterest(java.lang.String[] names)
names
- public java.util.Iterator<java.lang.String> listAttrsOfInterest()
public boolean isOfInterest(java.lang.String name)
name
- the name of the attribute
public java.lang.Object setAttribute(Attribute attr)
attr
- the attribute from which to set the element's attribute.
public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
name
- the attribute namevalue
- the attribute value
public java.lang.Object setDefaultAttribute(java.lang.String name, java.lang.Object value)
name
- the attribute namevalue
- the attribute value
public java.lang.Object setDefaultAttribute(int type, java.lang.String name, java.lang.Object value)
type
- the default attribute typename
- the attribute namevalue
- the attribute value
public java.lang.Object setDefaultAttribute(Attribute attr)
attr
- the attribute to which the default should be set
public java.lang.Object setDefaultAttribute(int type, Attribute attr)
type
- the default attribute typeattr
- the attribute to which the default should be set
public java.util.Iterator<java.lang.String> getLocalAttributeKeys()
public java.util.Iterator<Attribute> getLocalAttributePairs()
public java.util.Iterator<Attribute> getAttributePairs()
public Attribute getLocalAttribute(java.lang.String key)
key
- the search key for the corresponding attribute.
public Attribute getThisAttribute(java.lang.String key)
key
- the search key for the corresponding attribute.
public java.lang.Object getThisAttributeValue(java.lang.String key)
key
- the search key for the corresponding attribute.
public Attribute getDefaultAttribute(int type, java.lang.String key)
type
- the type of the default attributekey
- the search key for the corresponding attribute.
public Attribute getDefaultAttribute(java.lang.String key)
key
- the search key for the corresponding attribute.
public Attribute getAttribute(java.lang.String key)
key
- the search key for the attribute.
public java.lang.Object getAttributeValue(java.lang.String key)
key
- the search key for the attribute.
public boolean hasAttributeForKey(java.lang.String key)
key
- the search key for the attribute.
public Graph getGraph()
public Subgraph getSubgraph()
public void setSubgraph(Subgraph subgraph)
subgraph
- the parent subgraph that contains this element.protected void clearBBox()
public int getId()
public java.lang.Long getIdKey()
protected void setIdKey(int type)
public void printElement(java.io.PrintWriter out)
out
- the print stream for output.public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String canonString(java.lang.String input)
input
- the string to be quoted, possibly.
public static final java.lang.String typeString(int elemType, boolean uplow)
elemType
- an integer value representing an element typeuplow
- set true to indicate the return value should be
leading-capitalized, otherwise lower-case is returned
public static java.lang.String canonValue(java.lang.String input)
input
- the string to be canonicalized.
public final boolean delete()
Graph.reset()
public void addTag(java.lang.String tag)
tag
- the tag to associate with this Element.public boolean hasTag(java.lang.String tag)
tag
- tag value to be searched for
public boolean hasLocalTag(java.lang.String tag)
tag
- tag value to be searched for
public boolean hasDefaultTag(java.lang.String tag)
tag
- tag value to be searched for
public boolean hasTags()
public boolean hasLocalTags()
public boolean hasDefaultTags()
public void removeTags()
public void removeTag(java.lang.String tag)
tag
- the tag value to removepublic static int setUserAttributeType(java.lang.String attrname, int attrtype)
attrname
- the attribute nameattrtype
- the attribute type
public static int attributeType(java.lang.String attrname)
attrname
- the attribute name
public final void buildShape()
public GrappaNexus getGrappaNexus()
public java.util.List bdfs(int steps)
steps
- when negative, the search is exhaustive; otherwise the search stops after the number of steps indicated
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |