|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.data.trees.data.Node
org.gcube.data.trees.data.InnerNode
public class InnerNode
An inner Node, i.e. a node which is not a leaf.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.gcube.data.trees.data.Node |
|---|
Node.State |
| Constructor Summary | |
|---|---|
InnerNode(Edge... edges)
Constructs an instance with a given edges. |
|
InnerNode(InnerNode n)
Copy constructor, creates an instance as a clone of a given InnerNode. |
|
InnerNode(String id)
Constructs an instance with a given identifier. |
|
InnerNode(String id,
Edge... edges)
Constructs an instance with a given identifier and edges. |
|
InnerNode(String id,
Map<QName,String> attributes,
Edge... edges)
Constructs an instance with a given identifier, attributes, and edges. |
|
InnerNode(String id,
Node.State state,
Map<QName,String> attributes,
Edge... edges)
Constructs an instance with a given identifier, state, attributes, and edges. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(Edge... es)
Adds one or more edges. |
|
boolean |
add(Edge e)
Adds one edge. |
|
boolean |
add(List<Edge> es)
Adds one or more edges. |
|
|
child(Class<T> type,
QName l)
Returns a child of this node with a given label and of a given node type, if exactly one exists. |
|
|
child(Class<T> type,
String l)
Returns a child of this node with a given label and of a given node type, if exactly one exists. |
|
|
child(Class<T> type,
String ns,
String l)
Returns a child of this node with a given label and of a given type, if exactly one exists. |
|
Node |
child(QName l)
Returns a child of this node with a given label, if exactly one exists. |
|
Node |
child(String l)
Returns a child of this node with a given label, if exactly one exists. |
|
Node |
child(String ns,
String l)
Returns a child of this node with a given label, if exactly one exists. |
|
List<Node> |
children()
Returns all the children. |
|
|
children(Class<T> type)
Returns all the children of a given node type. |
|
|
children(Class<T> type,
QName l)
Returns all the children with a given label and a given node type. |
|
|
children(Class<T> type,
String l)
Returns all the children with a given label and a given node type. |
|
|
children(Class<T> type,
String ns,
String l)
Returns all the children with a given label and given node type. |
|
List<Node> |
children(QName l)
Returns all the children with a given label. |
|
List<Node> |
children(String l)
Returns all the children with a given label. |
|
List<Node> |
children(String ns,
String l)
Returns all the children with a given label. |
|
protected static void |
clearState(Node n)
|
|
void |
delete()
Marks the node as Node.State.DELETED, removing all its attributes and all its edges. |
|
InnerNode |
delta(Node f)
Returns a node that reflects the delta between this node and a given input node. |
|
|
descendant(Class<T> type,
String... descendantIDs)
Returns the descendant of a given node type which can be reached from this node by following a given path of identifiers. |
|
Node |
descendant(String... ids)
Returns the descendant that can be reached from this node by following a given path of node identifiers. |
|
|
descendants(Class<T> type,
QName... labels)
Returns all the descendants of a given node type which can be reached from this node by following a given path of labels. |
|
|
descendants(Class<T> type,
String... labels)
Returns all the descendants of a given node type that can be reached from this node by following a given sequence of labels. |
|
List<? extends Node> |
descendants(QName... labels)
Returns all the descendants that can be reached from this node by following a given path of labels. |
|
List<? extends Node> |
descendants(String... labels)
Returns all the descendants that can be reached from this node by following a given sequence of labels. |
|
Edge |
edge(QName l)
Returns the edges with a given label, if exactly one exists. |
|
Edge |
edge(String l)
Returns the edges with a given label, if exactly one exists. |
|
Edge |
edge(String ns,
String l)
Returns the edges with a given label, if exactly one exists. |
|
List<Edge> |
edges()
Returns all the edges. |
|
List<Edge> |
edges(QName l)
Returns the outgoing edges with a given label. |
|
List<Edge> |
edges(String l)
Returns the outgoing edges with a given label. |
|
List<Edge> |
edges(String ns,
String l)
Returns the outgoing edges with a given label. |
|
boolean |
equals(Object obj)
|
|
List<? extends Node> |
find(QName... labels)
Returns all the descendants of this node that can be reached from this node or any other descendant by following a given path of labels. |
|
List<? extends Node> |
find(String... labels)
Returns all the descendants of this node that can be reached from this node or any other descendant by following a given path of labels. |
|
boolean |
hasEdge(QName l)
Indicates whether the node has at least an edge with a given label. |
|
boolean |
hasEdge(String l)
Indicates whether the node has at least an edge with a given label. |
|
boolean |
hasEdge(String ns,
String l)
Indicates whether the node has at least an edge with a given label. |
|
int |
hashCode()
|
|
List<QName> |
labels()
Returns the labels of all the outgoing edges. |
|
List<QName> |
labels(QName l)
Returns all the labels that match a given one. |
|
protected static void |
markAsNew(Node n)
|
|
boolean |
remove(Edge... es)
Removes one or more edges. |
|
boolean |
remove(Edge e)
Removes an edge. |
|
boolean |
remove(List<Edge> es)
Removes one or more edges. |
|
List<Node> |
remove(String... childIDs)
Removes one or more children. |
|
Node |
remove(String childID)
Removes a child. |
|
long |
size()
Returns the size of the tree rooted in this node, in bytes. |
|
String |
toString()
|
|
void |
update(Node delta)
Applies the changes captured by the delta node in input (cf. |
|
| Methods inherited from class org.gcube.data.trees.data.Node |
|---|
ancestors, ancestorsAndSelf, attribute, attribute, attributes, hasAttribute, hasAttribute, id, parent, removeAttribute, removeAttribute, setAttribute, setAttribute, setParent, state, state, uri, uri |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public InnerNode(InnerNode n)
InnerNode.
n - the nodepublic InnerNode(String id)
id - the identifier
public InnerNode(String id,
Edge... edges)
id - the identifieredges - the edgespublic InnerNode(Edge... edges)
edges - the edges
public InnerNode(String id,
Map<QName,String> attributes,
Edge... edges)
id - the identifierattributes - the attributesedges - the edges
public InnerNode(String id,
Node.State state,
Map<QName,String> attributes,
Edge... edges)
id - the identifierstate - the stateattributes - the attributesedges - the edges| Method Detail |
|---|
public List<Node> children()
public <T extends Node> List<T> children(Class<T> type)
type - the node type
public List<Node> children(QName l)
l - the label
public <T extends Node> List<T> children(Class<T> type,
QName l)
type - the node typel - the label
public List<Node> children(String l)
throws IllegalArgumentException
l - the local name of the label
IllegalArgumentException - if the label's local name is null
public <T extends Node> List<T> children(Class<T> type,
String l)
throws IllegalArgumentException
type - the node typel - the local name of the label
IllegalArgumentException - if the label's local name is null
public List<Node> children(String ns,
String l)
throws IllegalArgumentException
ns - the namespace of the labell - the local name of the label
IllegalArgumentException - if the label's local name is null
public <T extends Node> List<T> children(Class<T> type,
String ns,
String l)
type - the node typens - the namespace of the labell - the local name of the label
public Node descendant(String... ids)
throws IllegalStateException
ids - the identifiers that comprise the path
IllegalStateException - if the sequence does not lead to a descendant.
public <T extends Node> T descendant(Class<T> type,
String... descendantIDs)
throws IllegalStateException
type - the tree typedescendantIDs - the identifiers that comprise the path
IllegalStateException - if the sequence does not lead to a descendant of the given typepublic List<? extends Node> descendants(QName... labels)
labels - the labels that comprise the path
public <T extends Node> List<T> descendants(Class<T> type,
QName... labels)
throws IllegalArgumentException
type - the node typelabels - the labels that comprise the path
IllegalArgumentException - if no labels are specifiedpublic List<? extends Node> descendants(String... labels)
labels - the local names of the labels
IllegalArgumentException - if no labels are specified
public <T extends Node> List<T> descendants(Class<T> type,
String... labels)
type - the node typelabels - the local names of the labels
public Node child(QName l)
throws IllegalStateException
l - the label
IllegalStateException - if the node has zero or more than one children with the given label
public <T extends Node> T child(Class<T> type,
QName l)
throws IllegalStateException
type - the node typel - the label
IllegalStateException - if the node has zero or more than one children with the given label and of
the given type
public Node child(String l)
throws IllegalArgumentException,
IllegalStateException
l - the local name of the label
IllegalArgumentException - if the label's local name is null
IllegalStateException - if the node has zero or more than one children with the given label
public <T extends Node> T child(Class<T> type,
String l)
throws IllegalArgumentException,
IllegalStateException
type - the node typel - the local name of the label.
IllegalArgumentException - if the label's local name is null
IllegalStateException - if the node has zero or more than one children with the given label
and of the given type
public Node child(String ns,
String l)
throws IllegalArgumentException,
IllegalStateException
ns - the namespace of the labell - the local name of the label
IllegalArgumentException - if the label's local name is null
IllegalStateException - if the node has zero or more than one children with the given label
public <T extends Node> T child(Class<T> type,
String ns,
String l)
throws IllegalArgumentException,
IllegalStateException
type - the node type.ns - the namespace of the labell - the local name of the label
IllegalArgumentException - if the label's local name is null
IllegalStateException - if the node has zero or more than one children with the given label and
of the given typepublic List<Edge> edges()
public List<Edge> edges(QName l)
l - the label
public List<Edge> edges(String ns,
String l)
throws IllegalArgumentException
ns - the namespace of the labell - the local name of the label
IllegalArgumentException - if the label's local name is null
public List<Edge> edges(String l)
throws IllegalArgumentException
l - the local name of the label
IllegalArgumentException - if the label's local name is nullpublic boolean hasEdge(QName l)
l - the label
true if it does, false otherwise
public boolean hasEdge(String l)
throws IllegalArgumentException
l - the local name of the label
true if it does, false otherwise
IllegalArgumentException - if the label's local name is null
public boolean hasEdge(String ns,
String l)
throws IllegalArgumentException
ns - the namespace of the labell - the local name of the label
true if it does, false otherwise
IllegalArgumentException - if the label's local name is null
public Edge edge(QName l)
throws IllegalStateException
l - the label
IllegalStateException - if there no edge or more than one edge with a give label
public Edge edge(String l)
throws IllegalStateException,
IllegalArgumentException
l - the local name of the label
IllegalStateException - if there no edge or more than one edge with a give label
IllegalArgumentException - if the label's local name is null
public Edge edge(String ns,
String l)
throws IllegalStateException,
IllegalArgumentException
ns - the namespace of the labell - local name of the label
IllegalStateException - if there no edge or more than one edge with a give label
IllegalArgumentException - if the label's local name is nullpublic List<QName> labels()
public List<QName> labels(QName l)
l - the label to match
public boolean remove(List<Edge> es)
es - the edges
true if any edge was actually removed, false otherwisepublic boolean remove(Edge e)
e - the edge
true if the edge was actually removed, false otherwisepublic boolean remove(Edge... es)
es - the edges
true if any edge was actually removed, false otherwise
public Node remove(String childID)
throws IllegalStateException
childID - the child's identifier
true if the child was actually removed, false otherwise
IllegalStateException - if the child does not existpublic List<Node> remove(String... childIDs)
childIDs - the children's identifiers
public List<? extends Node> find(QName... labels)
labels - the labels that comprise the path
public List<? extends Node> find(String... labels)
labels - the labels that comprise the path
public boolean add(List<Edge> es)
es - the edges
true if any edge was actually added, false otherwisepublic boolean add(Edge e)
e - the edge
true if the edge was actually added, false otherwisepublic boolean add(Edge... es)
es - the edges
true if any edge was actually added, false otherwisepublic void delete()
Node.State.DELETED, removing all its attributes and all its edges.
delete in class Node
public void update(Node delta)
throws IllegalStateException,
IllegalArgumentException
delta(Node)).
This operation acts as the inverse of delta(Node). In particular:
null;
null value whihc do no exist in this node;
Node.State.DELETEDin the delta node;
Node.State.NEW (clearing the mark);
Node.State.MODIFIED.
delta - the delta node
IllegalStateException - if this node has no identifier
IllegalArgumentException - if the delta node is not an inner node, or has has an unexpected state,
or its identifier differs form this node's, or more generally its attributes and children do not relate to those of this
node as expected
public InnerNode delta(Node f)
throws IllegalArgumentException,
IllegalStateException
The delta node is computed under the expectation that the the input node is (or simply looks like) a future version of this node, as if it was originally cloned from this node and had evolved since.
Under this assumption, the delta node has:
null value (node by node);
Node.State.DELETED, for deleted, and
emptied of their attributes and their own children;
Node.State.NEW, for new;
Node.State.MODIFIED, for updated (was it only for a change of value in a leaf node).
Node.State.MODIFIED if, based on the rules above, the delta node has at least some children or attributes.
delta in class Nodef - the input node
IllegalArgumentException - in the following circumstances:
IllegalStateException - if this node has no identifier.
protected static void clearState(Node n)
throws IllegalStateException
IllegalStateException
protected static void markAsNew(Node n)
throws IllegalStateException
IllegalStateExceptionpublic long size()
size in class Nodepublic String toString()
toString in class Objectpublic boolean equals(Object obj)
equals in class Nodepublic int hashCode()
hashCode in class Node
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||