public abstract class NodeRef<N extends NodeDb> extends java.lang.Object implements Node
HeapUsageMonitor}), the {ReferenceManager} may set
that member to `null`, so that the garbage collector can free up some heap, thus avoiding @OutOfMemoryError.
Note that this model only works if nothing else holds references to the NodeDb - which is therefor strongly
discouraged. Instead, the entire application should only ever hold onto NodeRef instances.
When the `node` member is currently null, but is then required (e.g. to lookup a property or an edge), the node will
be fetched from the underlying OdbStorage.
When OdbGraph is started from an existing storage location, only NodeRef instances are created - the nodes
are lazily on demand as described above.| Modifier and Type | Field and Description |
|---|---|
protected Graph |
graph |
protected long |
id |
| Constructor and Description |
|---|
NodeRef(Graph graph,
long id)
used when creating a node without the underlying instance at hand
|
NodeRef(Graph graph,
N node) |
| Modifier and Type | Method and Description |
|---|---|
Edge |
addEdge(java.lang.String label,
Node inNode,
java.util.Map<java.lang.String,java.lang.Object> keyValues)
Add an outgoing edge to the node with provided label and edge properties as key/value pairs.
|
Edge |
addEdge(java.lang.String label,
Node inNode,
java.lang.Object... keyValues)
Add an outgoing edge to the node with provided label and edge properties as key/value pairs.
|
void |
addEdgeSilent(java.lang.String label,
Node inNode,
java.util.Map<java.lang.String,java.lang.Object> keyValues)
Add an outgoing edge to the node with provided label and edge properties as key/value pairs.
|
void |
addEdgeSilent(java.lang.String label,
Node inNode,
java.lang.Object... keyValues)
Add an outgoing edge to the node with provided label and edge properties as key/value pairs.
|
java.util.Iterator<Node> |
both() |
java.util.Iterator<Node> |
both(java.lang.String... edgeLabels) |
java.util.Iterator<Edge> |
bothE() |
java.util.Iterator<Edge> |
bothE(java.lang.String... edgeLabels) |
protected void |
clear() |
boolean |
equals(java.lang.Object obj) |
N |
get() |
java.util.Optional<N> |
getOption() |
Graph |
graph() |
int |
hashCode() |
long |
id() |
java.util.Iterator<Node> |
in() |
java.util.Iterator<Node> |
in(java.lang.String... edgeLabels) |
java.util.Iterator<Edge> |
inE() |
java.util.Iterator<Edge> |
inE(java.lang.String... edgeLabels) |
boolean |
isCleared() |
boolean |
isSet() |
java.util.Iterator<Node> |
out() |
java.util.Iterator<Node> |
out(java.lang.String... edgeLabels) |
java.util.Iterator<Edge> |
outE() |
java.util.Iterator<Edge> |
outE(java.lang.String... edgeLabels) |
protected void |
persist(byte[] data) |
<A> A |
property(PropertyKey<A> key) |
java.lang.Object |
property(java.lang.String propertyKey) |
java.util.Set<java.lang.String> |
propertyKeys() |
java.util.Map<java.lang.String,java.lang.Object> |
propertyMap()
Map with all properties
|
<A> java.util.Optional<A> |
propertyOption(PropertyKey<A> key) |
java.util.Optional<java.lang.Object> |
propertyOption(java.lang.String key) |
void |
remove() |
void |
removeProperty(java.lang.String key) |
protected byte[] |
serializeWhenDirty() |
void |
setNode(N node) |
void |
setProperty(Property<?> property) |
<A> void |
setProperty(PropertyKey<A> key,
A value) |
void |
setProperty(java.lang.String key,
java.lang.Object value) |
java.lang.String |
toString() |
protected final long id
protected final Graph graph
public NodeRef(Graph graph, long id)
public boolean isSet()
public boolean isCleared()
protected void clear()
protected byte[] serializeWhenDirty()
protected void persist(byte[] data)
public final N get()
public final java.util.Optional<N> getOption()
public void setNode(N node)
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic Edge addEdge(java.lang.String label, Node inNode, java.lang.Object... keyValues)
NodeString
property keys and the even numbered arguments are the related property values.public Edge addEdge(java.lang.String label, Node inNode, java.util.Map<java.lang.String,java.lang.Object> keyValues)
Nodepublic void addEdgeSilent(java.lang.String label,
Node inNode,
java.lang.Object... keyValues)
NodeString
property keys and the even numbered arguments are the related property values.
Just like {{{addEdge2}}, but doesn't instantiate and return a dummy edgeaddEdgeSilent in interface Nodepublic void addEdgeSilent(java.lang.String label,
Node inNode,
java.util.Map<java.lang.String,java.lang.Object> keyValues)
NodeaddEdgeSilent in interface Nodepublic java.util.Map<java.lang.String,java.lang.Object> propertyMap()
ElementpropertyMap in interface Elementpublic java.lang.Object property(java.lang.String propertyKey)
public <A> A property(PropertyKey<A> key)
public <A> java.util.Optional<A> propertyOption(PropertyKey<A> key)
propertyOption in interface Elementpublic java.util.Optional<java.lang.Object> propertyOption(java.lang.String key)
propertyOption in interface Elementpublic <A> void setProperty(PropertyKey<A> key, A value)
setProperty in interface Elementpublic void setProperty(Property<?> property)
setProperty in interface Elementpublic void setProperty(java.lang.String key,
java.lang.Object value)
setProperty in interface Elementpublic java.util.Set<java.lang.String> propertyKeys()
propertyKeys in interface Elementpublic void removeProperty(java.lang.String key)
removeProperty in interface Elementpublic java.util.Iterator<Node> out(java.lang.String... edgeLabels)
public java.util.Iterator<Node> in(java.lang.String... edgeLabels)
public java.util.Iterator<Node> both(java.lang.String... edgeLabels)
public java.util.Iterator<Edge> outE(java.lang.String... edgeLabels)
public java.util.Iterator<Edge> inE(java.lang.String... edgeLabels)
public java.util.Iterator<Edge> bothE(java.lang.String... edgeLabels)
public java.lang.String toString()
toString in class java.lang.Object