public class VertexIdList extends Object implements VertexListInternal
VertexListInternal that stores only the vertex ids
and simply wraps an List and keeps a boolean flag to remember whether this list is in sort order.
In addition, we need a transaction reference in order to construct actual vertex references on request.
This is a more efficient way to represent a vertex result set but only applies to loaded vertices that have ids.
So, compared to VertexArrayList this is an optimization for the special use case that a vertex is loaded.
| Modifier and Type | Field and Description |
|---|---|
static Comparator<Object> |
VERTEX_ID_COMPARATOR |
| Constructor and Description |
|---|
VertexIdList(StandardJanusGraphTx tx) |
VertexIdList(StandardJanusGraphTx tx,
List<Object> vertices,
boolean sorted) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(JanusGraphVertex n)
Adds the provided vertex to this list.
|
void |
addAll(VertexList vertexlist)
Copies all vertices in the given vertex list into this list.
|
JanusGraphVertex |
get(int pos)
Returns the vertex at a given position in the list.
|
Object |
getID(int pos)
Returns the id of the vertex at the specified position
|
List<Object> |
getIDs()
Returns a list of ids of all vertices in this list of vertices in the same order of the original vertex list.
|
boolean |
isSorted()
Whether this list of vertices is sorted by id in increasing order.
|
Iterator<JanusGraphVertex> |
iterator() |
int |
size()
Returns the number of vertices in this list.
|
void |
sort()
Sorts this list according to vertex ids in increasing order.
|
VertexList |
subList(int fromPosition,
int length)
Returns a sub list of this list of vertices from the given position with the given number of vertices.
|
VertexArrayList |
toVertexArrayList() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic static final Comparator<Object> VERTEX_ID_COMPARATOR
public VertexIdList(StandardJanusGraphTx tx)
public VertexIdList(StandardJanusGraphTx tx, List<Object> vertices, boolean sorted)
public void add(JanusGraphVertex n)
VertexListInternaladd in interface VertexListInternalpublic Object getID(int pos)
VertexListgetID in interface VertexListpos - The position of the vertex in the listpublic List<Object> getIDs()
VertexListgetIDs in interface VertexListpublic JanusGraphVertex get(int pos)
VertexListget in interface VertexListpos - Position for which to retrieve the vertex.public void sort()
VertexListsort in interface VertexListpublic boolean isSorted()
VertexListisSorted in interface VertexListpublic VertexList subList(int fromPosition, int length)
VertexListsubList in interface VertexListpublic int size()
VertexListsize in interface VertexListpublic void addAll(VertexList vertexlist)
VertexListInternaladdAll in interface VertexListInternalpublic VertexArrayList toVertexArrayList()
public Iterator<JanusGraphVertex> iterator()
iterator in interface Iterable<JanusGraphVertex>Copyright © 2012–2023. All rights reserved.