|
|||||||||
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 | |
---|---|
(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. |
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 |
---|
private Graph graph
private Subgraph subgraph
long visastamp
private boolean deleteCalled
private boolean busy
private static java.util.Hashtable userAttributeTypeMap
public java.lang.Object object
public boolean visible
public boolean selectable
public int linewidth
public static boolean usePrintList
public int counter
public int highlight
private java.lang.Long idKey
java.lang.String name
java.util.Hashtable attributes
java.util.Hashtable<java.lang.String,java.lang.String> attrsOfInterest
GrappaNexus grappaNexus
public boolean printAllAttributes
Subgraph.printSubgraph(java.io.PrintWriter)
,
Grappa.elementPrintAllAttributes
public boolean printDefaultAttributes
Subgraph.printSubgraph(java.io.PrintWriter)
,
Grappa.elementPrintDefaultAttributes
java.lang.String canonName
private double patchSize
private java.awt.geom.Rectangle2D.Double patch
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 |
---|
private void elementAttrsOfInterest()
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()
abstract void setName()
public java.lang.String getName()
boolean reserve()
void release()
boolean setDelete(boolean delete)
private boolean setReserved(boolean state, boolean isDelete)
protected void attrOfInterest(java.lang.String name)
name
- the name of the attributeprotected void attrNotOfInterest(java.lang.String name)
name
- the name of the attributepublic java.util.Enumeration 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
private Attribute removeAttribute(java.lang.String name)
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.Enumeration getLocalAttributeKeys()
public java.util.Enumeration getLocalAttributePairs()
public java.util.Enumeration 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()
void setGraph(Graph graph)
graph
- the overall graph that contains this element.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.private void printAttributes(java.io.PrintWriter out, java.lang.String outerIndent)
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.
boolean deleteCalled()
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 void buildShape()
public GrappaNexus getGrappaNexus()
public java.util.Vector bdfs(int steps)
steps
- when negative, the search is exhaustive; otherwise the search stops after the number of steps indicated
private static void doBDFS(int type, int depth, long stamp, int level, java.util.Vector inbox, java.util.Vector layers)
double getPatchSize()
void setPatchSize(double val)
java.awt.geom.Rectangle2D.Double getPatch()
void setPatch(java.awt.geom.Rectangle2D.Double p)
void setPatch(double x, double y, double w, double h)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |