|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The Node
class provides the abstraction of a persistent node
in a graph. A node may be marked by one or more markers, and may be the
value of one or more vertices in other nodes. The Node
class
provides methods to retrieve any markers that mark this node, and to retrieve
any nodes that contain vertices with this node as their value. Nodes that
contain a vertex with this node as its value are parents of this node.
A node is said to be unreachable if no markers mark it and the node is not the value of any vertex. Unreachable nodes (and all their recursively unreachable vertices) are automatically closed and deleted.
A node can contain any number of vertices; the node is said to be the originating node for these vertices. Vertices are named and indexed in order of occurrence, and each vertex has a type and value. More than one vertex with the same name can occur in a given node, and vertices are identified either by index or by name and occurrence index. Indices are zero-based, that is, the first vertex in a node has index 0.
Each node is identified by an integer that is unique within the storage containing this node.
Method Summary | |
Vertex |
addNode(int index,
java.lang.String name)
Creates a new node, and inserts a new vertex with the specified name which points to the new node into this node's list of vertices at the specified position. |
Vertex |
addNode(java.lang.String name)
Creates a new node, and appends a new vertex with the specified name which points to the new node to this node's list of vertices. |
Vertex |
addVertex(int index,
java.lang.String name,
java.lang.Object value)
Inserts a new vertex with the specified name and value into this node's list of vertices at the specified position. |
Vertex |
addVertex(java.lang.String name,
java.lang.Object value)
Appends a new vertex with the specified name and value to the end of this node's list of vertices. |
void |
close()
Releases a node's resources and closes it immediately. |
boolean |
containsVertex(java.lang.String name)
Returns true if there is at least one vertex in this node named name. |
boolean |
containsVertices(java.lang.String name,
int n)
Returns true if there are at least n vertices in this node named name. |
boolean |
delete()
Deletes this node from its persistent storage. |
java.util.List |
getMarkers()
Returns a list of the markers marking this node. |
int |
getOccurrenceCount()
Returns the number of vertices that contain this node as their value. |
int |
getOccurrenceCount(Node parent)
Returns the number of vertices within parent that contain this node as their value. |
java.util.List |
getParents()
Returns a list of this node's parent nodes. |
Storage |
getStorage()
Returns the storage containing this node. |
int |
getUniqueID()
Returns an integer identifier for this node guaranteed to be unique within the context of the storage containing this node. |
Vertex |
getVertex(int index)
Returns the vertex at the specified index. |
Vertex |
getVertex(java.lang.String name)
Returns the first vertex named name, or null if no such vertex exists. |
Vertex |
getVertex(java.lang.String name,
int nth)
Returns the nth vertex named name, or null if no such vertex exists. |
boolean |
getVertexBooleanValue(int index)
Returns the boolean value of the vertex at the specified index. |
boolean |
getVertexBooleanValue(java.lang.String name)
Returns the boolean value of the first vertex named name, or null if no such vertex exists. |
boolean |
getVertexBooleanValue(java.lang.String name,
int nth)
Returns the boolean value of the nth vertex named name, or null if no such vertex exists. |
byte[] |
getVertexBytesValue(int index)
Returns the byte array value of the vertex at the specified index. |
byte[] |
getVertexBytesValue(java.lang.String name)
Returns the byte array value of the first vertex named name, or null if no such vertex exists. |
byte[] |
getVertexBytesValue(java.lang.String name,
int nth)
Returns the byte array value of the nth vertex named name, or null if no such vertex exists. |
int |
getVertexCount()
Returns the number of vertices in this node. |
double |
getVertexDoubleValue(int index)
Returns the double-precision floating-point value of the vertex at the specified index. |
double |
getVertexDoubleValue(java.lang.String name)
Returns the double-precision floating-point value of the first vertex named name, or null if no such vertex exists. |
double |
getVertexDoubleValue(java.lang.String name,
int nth)
Returns the double-precision floating-point value of the nth vertex named name, or null if no such vertex exists. |
float |
getVertexFloatValue(int index)
Returns the single-precision floating-point value of the vertex at the specified index. |
float |
getVertexFloatValue(java.lang.String name)
Returns the single-precision floating-point value of the first vertex named name, or null if no such vertex exists. |
float |
getVertexFloatValue(java.lang.String name,
int nth)
Returns the single-precision floating-point value of the nth vertex named name, or null if no such vertex exists. |
int |
getVertexIntValue(int index)
Returns the integer value of the vertex at the specified index. |
int |
getVertexIntValue(java.lang.String name)
Returns the integer value of the first vertex named name, or null if no such vertex exists. |
int |
getVertexIntValue(java.lang.String name,
int nth)
Returns the integer value of the nth vertex named name, or null if no such vertex exists. |
long |
getVertexLongValue(int index)
Returns the long integer value of the vertex at the specified index. |
long |
getVertexLongValue(java.lang.String name)
Returns the long integer value of the first vertex named name, or null if no such vertex exists. |
long |
getVertexLongValue(java.lang.String name,
int nth)
Returns the long integer value of the nth vertex named name, or null if no such vertex exists. |
Node |
getVertexNodeValue(int index)
Returns the node value of the vertex at the specified index. |
Node |
getVertexNodeValue(java.lang.String name)
Returns the node value of the first vertex named name, or null if no such vertex exists. |
Node |
getVertexNodeValue(java.lang.String name,
int nth)
Returns the node value of the nth vertex named name, or null if no such vertex exists. |
java.lang.String |
getVertexStringValue(int index)
Returns the string value of the vertex at the specified index. |
java.lang.String |
getVertexStringValue(java.lang.String name)
Returns the string value of the first vertex named name, or null if no such vertex exists. |
java.lang.String |
getVertexStringValue(java.lang.String name,
int nth)
Returns the string value of the nth vertex named name, or null if no such vertex exists. |
java.lang.Object |
getVertexValue(int index)
Returns the value of the vertex at the specified index. |
java.lang.Object |
getVertexValue(java.lang.String name)
Returns the value of the first vertex named name, or null if no such vertex exists. |
java.lang.Object |
getVertexValue(java.lang.String name,
int nth)
Returns the value of the nth vertex named name, or null if no such vertex exists. |
boolean |
isClosed()
Tests to see if a node is closed. |
boolean |
isMarked()
Returns true if there is at least one marker that is marking this node. |
boolean |
isRoot()
Returns true if this node has no parents. |
void |
mark(Marker m)
Adds the marker m to the list of markers marking this node. |
void |
mark(java.lang.String name)
Adds a new marker named name to the list of markers marking this node. |
void |
unmark(int index)
Removes the marker at index from the list of markers marking this node. |
void |
unmark(Marker m)
Removes the marker m from the list of markers marking this node. |
java.util.ListIterator |
vertices()
Returns an iterator over the list of vertices in this node, in index order. |
java.util.ListIterator |
vertices(Vertex start)
Returns an iterator over the list of vertices in this node, in index order, starting with the specified vertex. |
java.util.ListIterator |
vertices(VertexFilter filter)
Returns an iterator over the list of vertices in this node accepted by the specified filter, in index order. |
java.util.ListIterator |
vertices(Vertex start,
VertexFilter filter)
Returns an iterator over the list of vertices in this node accepted by the specified filter, in index order, starting with the specified vertex. |
Method Detail |
public int getVertexCount()
public Vertex addVertex(java.lang.String name, java.lang.Object value) throws E4GraphException
name
- the name of the new vertexvalue
- the value of the new vertexE4GraphException
- if the node is closedpublic Vertex addVertex(int index, java.lang.String name, java.lang.Object value) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- index at which the new vertex is to be insertedname
- the name of the new vertexvalue
- the value of the new vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic boolean containsVertex(java.lang.String name) throws E4GraphException
name
- the name of the vertex to look forE4GraphException
- if the node is closedpublic boolean containsVertices(java.lang.String name, int n) throws E4GraphException
name
- the name of the vertices to look forn
- the minimum number of vertices requiredE4GraphException
- if the node is closedpublic Vertex getVertex(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic Vertex getVertex(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic Vertex getVertex(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic java.lang.Object getVertexValue(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic java.lang.Object getVertexValue(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic java.lang.Object getVertexValue(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic Node getVertexNodeValue(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic Node getVertexNodeValue(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic Node getVertexNodeValue(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic java.lang.String getVertexStringValue(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic java.lang.String getVertexStringValue(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic java.lang.String getVertexStringValue(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic byte[] getVertexBytesValue(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic byte[] getVertexBytesValue(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic byte[] getVertexBytesValue(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic int getVertexIntValue(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic int getVertexIntValue(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic int getVertexIntValue(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic long getVertexLongValue(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic long getVertexLongValue(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic long getVertexLongValue(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic float getVertexFloatValue(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic float getVertexFloatValue(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic float getVertexFloatValue(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic double getVertexDoubleValue(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic double getVertexDoubleValue(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic double getVertexDoubleValue(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic boolean getVertexBooleanValue(int index) throws java.lang.IndexOutOfBoundsException, E4GraphException
index
- the index of the desired vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if the node is closedpublic boolean getVertexBooleanValue(java.lang.String name) throws E4GraphException
name
- the name of the desired vertexE4GraphException
- if the node is closedpublic boolean getVertexBooleanValue(java.lang.String name, int nth) throws E4GraphException
name
- the name of the desired vertexnth
- the occurrence index of the desired vertexE4GraphException
- if the node is closedpublic Vertex addNode(java.lang.String name) throws E4GraphException
name
- the name of the new vertexE4GraphException
- if this node is closedpublic Vertex addNode(int index, java.lang.String name) throws E4GraphException
index
- index at which the new vertex is to be insertedname
- the name of the new vertexjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getVertexCount())E4GraphException
- if this node is closedpublic java.util.ListIterator vertices() throws E4GraphException
E4GraphException
- if the node is closedpublic java.util.ListIterator vertices(VertexFilter filter) throws E4GraphException
filter
- a VertexFilter
valueE4GraphException
- if the node is closedpublic java.util.ListIterator vertices(Vertex start) throws E4GraphException
start
- the first vertex in the listE4GraphException
- if the node or starting vertex is closedpublic java.util.ListIterator vertices(Vertex start, VertexFilter filter) throws E4GraphException
start
- the first vertex in the listfilter
- the filter to useE4GraphException
- if the node or starting vertex is closedpublic java.util.List getParents() throws E4GraphException
E4GraphException
- if the node is closedpublic boolean isRoot()
public int getOccurrenceCount()
public int getOccurrenceCount(Node parent)
parent
- a parent nodepublic java.util.List getMarkers() throws E4GraphException
E4GraphException
- if the node is closedpublic void mark(java.lang.String name) throws E4GraphException
name
- the name of the new markerE4GraphException
- if the node is closedpublic void mark(Marker m) throws E4GraphException
m
- a marker to be added to the list of markers marking this nodeE4GraphException
- if the node or specified marker is closedpublic void unmark(Marker m) throws E4GraphException
m
- a marker to be removed from the list of markers marking this nodeE4GraphException
- if the node or specified marker is closedpublic void unmark(int index) throws E4GraphException, java.lang.IndexOutOfBoundsException
index
- the index of the marker to be removedE4GraphException
- if the node is closedjava.lang.IndexOutOfBoundsException
- if the index is out of rangepublic boolean isMarked()
public Storage getStorage() throws E4GraphException
E4GraphException
- if the node is closedpublic int getUniqueID() throws E4GraphException
E4GraphException
- if the node is closedpublic boolean delete() throws E4GraphException
E4GraphException
- if an error occurspublic boolean isClosed()
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |