Package com.arcadedb.graph
Class ImmutableVertex
- java.lang.Object
-
- com.arcadedb.database.BaseRecord
-
- com.arcadedb.database.BaseDocument
-
- com.arcadedb.database.ImmutableDocument
-
- com.arcadedb.graph.ImmutableVertex
-
- All Implemented Interfaces:
Document
,Identifiable
,Record
,Vertex
,VertexInternal
,Externalizable
,Serializable
public class ImmutableVertex extends ImmutableDocument implements VertexInternal
Immutable read-only vertex. It is returned from database on read operations such as queries or lookups. To modify a vertex usemodify()
to have the MutableVertex instance created form the current record. Adding or removing edges does not change the state of the vertex as dirty because edges are managed on different data structures. Any operation on edges is actually computed on the most updated version of the vertex in transaction.- Author:
- Luca Garulli ([email protected])
- See Also:
MutableVertex
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.arcadedb.graph.Vertex
Vertex.DIRECTION
-
-
Field Summary
-
Fields inherited from class com.arcadedb.database.BaseDocument
propertiesStartingPosition, type
-
Fields inherited from class com.arcadedb.database.BaseRecord
buffer, database, rid
-
Fields inherited from interface com.arcadedb.database.Document
RECORD_TYPE
-
Fields inherited from interface com.arcadedb.graph.Vertex
RECORD_TYPE
-
-
Constructor Summary
Constructors Constructor Description ImmutableVertex(Database database, DocumentType type, RID rid, Binary buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vertex
asVertex()
Returns the vertex record.Vertex
asVertex(boolean loadContent)
Returns the vertex record.protected boolean
checkForLazyLoading()
long
countEdges(Vertex.DIRECTION direction, String edgeType)
Object
get(String propertyName)
Iterable<Edge>
getEdges()
Iterable<Edge>
getEdges(Vertex.DIRECTION direction, String... edgeTypes)
RID
getInEdgesHeadChunk()
RID
getOutEdgesHeadChunk()
byte
getRecordType()
Iterable<Vertex>
getVertices()
Returns all the connected vertices, both directions, any edge type.Iterable<Vertex>
getVertices(Vertex.DIRECTION direction, String... edgeTypes)
Returns the connected vertices.boolean
isConnectedTo(Identifiable toVertex)
boolean
isConnectedTo(Identifiable toVertex, Vertex.DIRECTION direction)
MutableVertex
modify()
MutableEdge
newEdge(String edgeType, Identifiable toVertex, boolean bidirectional, Object... properties)
ImmutableLightEdge
newLightEdge(String edgeType, Identifiable toVertex, boolean bidirectional)
void
setInEdgesHeadChunk(RID inEdges)
void
setOutEdgesHeadChunk(RID outEdges)
-
Methods inherited from class com.arcadedb.database.ImmutableDocument
getPropertyNames, has, toJSON, toMap, toString
-
Methods inherited from class com.arcadedb.database.BaseDocument
asDocument, asDocument, detach, getBoolean, getByte, getDate, getDecimal, getDouble, getEmbedded, getFloat, getInteger, getLong, getShort, getString, getType, getTypeName, readExternal, reload, writeExternal
-
Methods inherited from class com.arcadedb.database.BaseRecord
asEdge, asEdge, delete, equals, getBuffer, getDatabase, getIdentity, getRecord, getRecord, hashCode, setBuffer
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.arcadedb.database.Document
asDocument, asDocument, detach, getBoolean, getByte, getDate, getDecimal, getDouble, getEmbedded, getFloat, getInteger, getLong, getPropertyNames, getShort, getString, getType, getTypeName, has, toJSON, toMap
-
Methods inherited from interface com.arcadedb.database.Identifiable
asEdge, asEdge, getRecord, getRecord
-
Methods inherited from interface com.arcadedb.database.Record
delete, getDatabase, getIdentity, reload
-
-
-
-
Constructor Detail
-
ImmutableVertex
public ImmutableVertex(Database database, DocumentType type, RID rid, Binary buffer)
-
-
Method Detail
-
getRecordType
public byte getRecordType()
- Specified by:
getRecordType
in interfaceRecord
- Overrides:
getRecordType
in classBaseDocument
-
modify
public MutableVertex modify()
-
get
public Object get(String propertyName)
- Specified by:
get
in interfaceDocument
- Overrides:
get
in classImmutableDocument
-
getOutEdgesHeadChunk
public RID getOutEdgesHeadChunk()
- Specified by:
getOutEdgesHeadChunk
in interfaceVertexInternal
-
getInEdgesHeadChunk
public RID getInEdgesHeadChunk()
- Specified by:
getInEdgesHeadChunk
in interfaceVertexInternal
-
setOutEdgesHeadChunk
public void setOutEdgesHeadChunk(RID outEdges)
- Specified by:
setOutEdgesHeadChunk
in interfaceVertexInternal
-
setInEdgesHeadChunk
public void setInEdgesHeadChunk(RID inEdges)
- Specified by:
setInEdgesHeadChunk
in interfaceVertexInternal
-
newEdge
public MutableEdge newEdge(String edgeType, Identifiable toVertex, boolean bidirectional, Object... properties)
-
newLightEdge
public ImmutableLightEdge newLightEdge(String edgeType, Identifiable toVertex, boolean bidirectional)
- Specified by:
newLightEdge
in interfaceVertex
-
countEdges
public long countEdges(Vertex.DIRECTION direction, String edgeType)
- Specified by:
countEdges
in interfaceVertex
-
getEdges
public Iterable<Edge> getEdges(Vertex.DIRECTION direction, String... edgeTypes)
-
getVertices
public Iterable<Vertex> getVertices()
Description copied from interface:Vertex
Returns all the connected vertices, both directions, any edge type.- Specified by:
getVertices
in interfaceVertex
- Returns:
- An iterator of PIndexCursorEntry entries
-
getVertices
public Iterable<Vertex> getVertices(Vertex.DIRECTION direction, String... edgeTypes)
Description copied from interface:Vertex
Returns the connected vertices.- Specified by:
getVertices
in interfaceVertex
- Parameters:
direction
- Direction between OUT, IN or BOTH- Returns:
- An iterator of PIndexCursorEntry entries
-
isConnectedTo
public boolean isConnectedTo(Identifiable toVertex)
- Specified by:
isConnectedTo
in interfaceVertex
-
isConnectedTo
public boolean isConnectedTo(Identifiable toVertex, Vertex.DIRECTION direction)
- Specified by:
isConnectedTo
in interfaceVertex
-
asVertex
public Vertex asVertex()
Description copied from interface:Identifiable
Returns the vertex record. If the record is not a vertex, a UnsupportedOperationException exception is thrown.- Specified by:
asVertex
in interfaceIdentifiable
- Specified by:
asVertex
in interfaceVertex
- Overrides:
asVertex
in classBaseRecord
- Returns:
- the
Vertex
-
asVertex
public Vertex asVertex(boolean loadContent)
Description copied from interface:Identifiable
Returns the vertex record. If the record is not a vertex, a UnsupportedOperationException exception is thrown.- Specified by:
asVertex
in interfaceIdentifiable
- Specified by:
asVertex
in interfaceVertex
- Overrides:
asVertex
in classBaseRecord
- Parameters:
loadContent
- specifies if pre-load the record content- Returns:
- the
Vertex
-
checkForLazyLoading
protected boolean checkForLazyLoading()
- Overrides:
checkForLazyLoading
in classImmutableDocument
-
-