Node.State| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
<T extends Node> |
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.
|
<T extends Node> |
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.
|
<T extends Node> |
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.
|
<T extends Node> |
children(Class<T> type)
Returns all the children of a given node type.
|
<T extends Node> |
children(Class<T> type,
QName l)
Returns all the children with a given label and a given node type.
|
<T extends Node> |
children(Class<T> type,
String l)
Returns all the children with a given label and a given node type.
|
<T extends Node> |
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.
|
<T extends 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.
|
<T extends Node> |
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.
|
<T extends Node> |
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.
|
ancestors, ancestorsAndSelf, attribute, attribute, attributes, hasAttribute, hasAttribute, id, parent, removeAttribute, removeAttribute, setAttribute, setAttribute, setParent, state, state, uri, uripublic InnerNode(InnerNode n)
InnerNode.n - the nodepublic InnerNode(String id)
id - the identifierpublic InnerNode(String id, Edge... edges)
id - the identifieredges - the edgespublic InnerNode(Edge... edges)
edges - the edgespublic InnerNode(String id, Map<QName,String> attributes, Edge... edges)
id - the identifierattributes - the attributesedges - the edgespublic <T extends Node> List<T> children(Class<T> type)
type - the node typepublic List<Node> children(QName l)
l - the labelpublic <T extends Node> List<T> children(Class<T> type, QName l)
type - the node typel - the labelpublic List<Node> children(String l) throws IllegalArgumentException
l - the local name of the labelIllegalArgumentException - if the label's local name is nullpublic <T extends Node> List<T> children(Class<T> type, String l) throws IllegalArgumentException
type - the node typel - the local name of the labelIllegalArgumentException - if the label's local name is nullpublic List<Node> children(String ns, String l) throws IllegalArgumentException
ns - the namespace of the labell - the local name of the labelIllegalArgumentException - if the label's local name is nullpublic <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 labelpublic Node descendant(String... ids) throws IllegalStateException
ids - the identifiers that comprise the pathIllegalStateException - 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 pathIllegalStateException - 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 pathpublic <T extends Node> List<T> descendants(Class<T> type, QName... labels) throws IllegalArgumentException
type - the node typelabels - the labels that comprise the pathIllegalArgumentException - if no labels are specifiedpublic List<? extends Node> descendants(String... labels)
labels - the local names of the labelsIllegalArgumentException - if no labels are specifiedpublic <T extends Node> List<T> descendants(Class<T> type, String... labels)
type - the node typelabels - the local names of the labelspublic Node child(QName l) throws IllegalStateException
l - the labelIllegalStateException - if the node has zero or more than one children with the given labelpublic <T extends Node> T child(Class<T> type, QName l) throws IllegalStateException
type - the node typel - the labelIllegalStateException - if the node has zero or more than one children with the given label and of
the given typepublic Node child(String l) throws IllegalArgumentException, IllegalStateException
l - the local name of the labelIllegalArgumentException - if the label's local name is nullIllegalStateException - if the node has zero or more than one children with the given labelpublic <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 nullIllegalStateException - if the node has zero or more than one children with the given label
and of the given typepublic Node child(String ns, String l) throws IllegalArgumentException, IllegalStateException
ns - the namespace of the labell - the local name of the labelIllegalArgumentException - if the label's local name is nullIllegalStateException - if the node has zero or more than one children with the given labelpublic <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 labelIllegalArgumentException - if the label's local name is nullIllegalStateException - if the node has zero or more than one children with the given label and
of the given typepublic List<Edge> edges(QName l)
l - the labelpublic List<Edge> edges(String ns, String l) throws IllegalArgumentException
ns - the namespace of the labell - the local name of the labelIllegalArgumentException - if the label's local name is nullpublic List<Edge> edges(String l) throws IllegalArgumentException
l - the local name of the labelIllegalArgumentException - if the label's local name is nullpublic boolean hasEdge(QName l)
l - the labeltrue if it does, false otherwisepublic boolean hasEdge(String l) throws IllegalArgumentException
l - the local name of the labeltrue if it does, false otherwiseIllegalArgumentException - if the label's local name is nullpublic boolean hasEdge(String ns, String l) throws IllegalArgumentException
ns - the namespace of the labell - the local name of the labeltrue if it does, false otherwiseIllegalArgumentException - if the label's local name is nullpublic Edge edge(QName l) throws IllegalStateException
l - the labelIllegalStateException - if there no edge or more than one edge with a give labelpublic Edge edge(String l) throws IllegalStateException, IllegalArgumentException
l - the local name of the labelIllegalStateException - if there no edge or more than one edge with a give labelIllegalArgumentException - if the label's local name is nullpublic Edge edge(String ns, String l) throws IllegalStateException, IllegalArgumentException
ns - the namespace of the labell - local name of the labelIllegalStateException - if there no edge or more than one edge with a give labelIllegalArgumentException - if the label's local name is nullpublic List<QName> labels()
public List<QName> labels(QName l)
l - the label to matchpublic boolean remove(List<Edge> es)
es - the edgestrue if any edge was actually removed, false otherwisepublic boolean remove(Edge e)
e - the edgetrue if the edge was actually removed, false otherwisepublic boolean remove(Edge... es)
es - the edgestrue if any edge was actually removed, false otherwisepublic Node remove(String childID) throws IllegalStateException
childID - the child's identifiertrue if the child was actually removed, false otherwiseIllegalStateException - if the child does not existpublic List<Node> remove(String... childIDs)
childIDs - the children's identifierspublic List<? extends Node> find(QName... labels)
labels - the labels that comprise the pathpublic List<? extends Node> find(String... labels)
labels - the labels that comprise the pathpublic boolean add(List<Edge> es)
es - the edgestrue if any edge was actually added, false otherwisepublic boolean add(Edge e)
e - the edgetrue if the edge was actually added, false otherwisepublic boolean add(Edge... es)
es - the edgestrue if any edge was actually added, false otherwisepublic void delete()
Node.State.DELETED, removing all its attributes and all its edges.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.update in class Nodedelta - the delta nodeIllegalStateException - if this node has no identifierIllegalArgumentException - 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 expectedpublic 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:
nil 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 nodeIllegalArgumentException - in the following circumstances:
IllegalStateException - if this node has no identifier.protected static void clearState(Node n) throws IllegalStateException
IllegalStateExceptionprotected static void markAsNew(Node n) throws IllegalStateException
IllegalStateExceptionpublic long size()
Copyright © 2017. All Rights Reserved.