|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.data.trees.data.Node
public abstract class Node
A tree node.
| Nested Class Summary | |
|---|---|
static class |
Node.State
Enumerates the state of the node with respect to remote storage. |
| Constructor Summary | |
|---|---|
|
Node()
Creates an instance. |
protected |
Node(String id)
|
protected |
Node(String i,
Node.State s,
Map<QName,String> as)
|
| Method Summary | |
|---|---|
List<InnerNode> |
ancestors()
Returns the ancestors of the node. |
List<Node> |
ancestorsAndSelf()
Returns the ancestors of the node along with the node itself. |
String |
attribute(QName name)
Returns the value of an attribute with a given name. |
String |
attribute(String name)
Returns the value of an attribute with a given name. |
Map<QName,String> |
attributes()
Returns (a copy of) the node attributes. |
void |
delete()
Marks the node as Node.State.DELETED, removing all its attributes. |
protected Node |
delta(Node future)
Returns a node that reflects the delta between this node and a given input node. |
boolean |
equals(Object obj)
|
boolean |
hasAttribute(QName name)
Indicates whether the node has an attribute with a given name. |
boolean |
hasAttribute(String name)
Indicates whether the node has an attribute with a given name. |
int |
hashCode()
|
String |
id()
Returns the node identifier. |
InnerNode |
parent()
Returns the parent of the node. |
String |
removeAttribute(QName name)
Removes an attribute from the node, if it exists. |
String |
removeAttribute(String name)
Removes an attribute from the node, if it exists. |
String |
setAttribute(QName name,
String value)
Sets the value of a given node attribute, or adds the attribute if it does not exist already. |
String |
setAttribute(String name,
String value)
Sets the value of a given node attribute, or adds the attribute if it does not exist already. |
protected void |
setParent(InnerNode p)
Sets the parent of the node. |
abstract long |
size()
Returns the size of the tree rooted in this node, in bytes. |
Node.State |
state()
Returns the node state. |
protected void |
state(Node.State s)
|
void |
update(Node delta)
Applies the changes captured by the delta node in input.. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Node()
protected Node(String id)
protected Node(String i,
Node.State s,
Map<QName,String> as)
| Method Detail |
|---|
public abstract long size()
public String id()
public Map<QName,String> attributes()
public String setAttribute(QName name,
String value)
name - the name of the attribute.value - the value of the attribute.
null if the attribute does not exist already.
public String setAttribute(String name,
String value)
throws IllegalArgumentException
name - the local name of the attribute.value - the value of the attribute.
null if the attribute does not exist already.
IllegalArgumentException - if the local name of the attribute is null.public String removeAttribute(QName name)
name - the name of the attribute.
null if the attribute does not exist.
IllegalStateException - if the nodes does not have an attribute with the given name.
public String removeAttribute(String name)
throws IllegalStateException,
IllegalArgumentException
name - the local name of the attribute.
null if the attribute does not exist.
IllegalStateException - if the nodes does not have an attribute with the given name.
IllegalArgumentException - if the local name of the attribute is null.
public String attribute(QName name)
throws IllegalStateException
name - the name.
IllegalStateException - if an attribute with the given name does not exist.
public String attribute(String name)
throws IllegalStateException,
IllegalArgumentException
name - the local name of the attribute.
IllegalStateException - if an attribute with the given name does not exist.
IllegalArgumentException - if the local name of the attribute is null.public boolean hasAttribute(QName name)
name - the name.
true if it does, false otherwise.
public boolean hasAttribute(String name)
throws IllegalArgumentException
name - the name.
true if it does, false otherwise.
IllegalArgumentException - if the local name of the attribute is null.public Node.State state()
protected void state(Node.State s)
public void delete()
Node.State.DELETED, removing all its attributes.
public void update(Node delta)
throws IllegalStateException,
IllegalArgumentException
This operation acts as the inverse of delta(Node). In particular:
null;
null value which do no exist in this node;
delta - the delta node
IllegalStateException - if this node has no identifier
IllegalArgumentException - if the delta node has an unexpected state,
or its identifier differs form this node's, or more generally its attributes do not relate to those of this
node as expected
protected Node delta(Node future)
throws IllegalStateException,
IllegalArgumentException
The delta node can only be computed if the input node has the same identifier as this node. For all purposes, in fact, the input node is expected to be (or simply look 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.State.MODIFIED if the attributes of the two nodes are not identical.
Subclasses that extend the comparison to additional pieces of state, must:
super;
future - the input node.
IllegalStateException - if this node has no identifier.
IllegalArgumentException - if this node has no identifier, or a different identifier's from the input node.protected void setParent(InnerNode p)
p - the parent.public InnerNode parent()
public List<InnerNode> ancestors()
public List<Node> ancestorsAndSelf()
public boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||