com.thinkaurelius.titan.graphdb.query.vertex

## Class VertexLongList

- java.lang.Object
- - com.thinkaurelius.titan.graphdb.query.vertex.VertexLongList

- All Implemented Interfaces:
    VertexList, VertexListInternal, Iterable<TitanVertex>

      public class VertexLongList
      extends Object
      implements VertexListInternal

  An implementation of `VertexListInternal` that stores only the vertex ids and simply wraps an `LongArrayList` 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.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VertexLongList(StandardTitanTx tx, com.carrotsearch.hppc.LongArrayList vertices, boolean sorted)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(TitanVertex n)` Adds the provided vertex to this list.
    `void` | `addAll(VertexList vertexlist)` Copies all vertices in the given vertex list into this list.
    `TitanVertex` | `get(int pos)` Returns the vertex at a given position in the list.
    `long` | `getID(int pos)` Returns the id of the vertex at the specified position
    `com.carrotsearch.hppc.LongArrayList` | `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<TitanVertex>` | `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()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VertexLongList

          public VertexLongList(StandardTitanTx tx,
                        com.carrotsearch.hppc.LongArrayList vertices,
                        boolean sorted)

  - ### Method Detail

    - #### add

          public void add(TitanVertex n)

      Description copied from interface: `VertexListInternal`
      Adds the provided vertex to this list.
      Specified by:
        `add` in interface `VertexListInternal`

    - #### getID

          public long getID(int pos)

      Description copied from interface: `VertexList`
      Returns the id of the vertex at the specified position
      Specified by:
        `getID` in interface `VertexList`
      Parameters:
        `pos` - The position of the vertex in the list
      Returns:
        The id of that vertex

    - #### getIDs

          public com.carrotsearch.hppc.LongArrayList getIDs()

      Description copied from interface: `VertexList`
      Returns a list of ids of all vertices in this list of vertices in the same order of the original vertex list.

      Uses an efficient primitive variable-sized array.
      Specified by:
        `getIDs` in interface `VertexList`
      Returns:
        A list of idAuthorities of all vertices in this list of vertices in the same order of the original vertex list.
      See Also:
        `AbstractLongList`

    - #### get

          public TitanVertex get(int pos)

      Description copied from interface: `VertexList`
      Returns the vertex at a given position in the list.
      Specified by:
        `get` in interface `VertexList`
      Parameters:
        `pos` - Position for which to retrieve the vertex.
      Returns:
        TitanVertex at the given position

    - #### sort

          public void sort()

      Description copied from interface: `VertexList`
      Sorts this list according to vertex ids in increasing order. If the list is already sorted, invoking this method incurs no cost.
      Specified by:
        `sort` in interface `VertexList`

    - #### isSorted

          public boolean isSorted()

      Description copied from interface: `VertexList`
      Whether this list of vertices is sorted by id in increasing order.
      Specified by:
        `isSorted` in interface `VertexList`
      Returns:

    - #### subList

          public VertexList subList(int fromPosition,
                           int length)

      Description copied from interface: `VertexList`
      Returns a sub list of this list of vertices from the given position with the given number of vertices.
      Specified by:
        `subList` in interface `VertexList`
      Returns:

    - #### size

          public int size()

      Description copied from interface: `VertexList`
      Returns the number of vertices in this list.
      Specified by:
        `size` in interface `VertexList`
      Returns:
        Number of vertices in the list.

    - #### addAll

          public void addAll(VertexList vertexlist)

      Description copied from interface: `VertexListInternal`
      Copies all vertices in the given vertex list into this list.
      Specified by:
        `addAll` in interface `VertexListInternal`

    - #### toVertexArrayList

          public VertexArrayList toVertexArrayList()

    - #### iterator

          public Iterator<TitanVertex> iterator()

      Specified by:
        `iterator` in interface `Iterable<TitanVertex>`

Copyright © 2012–2014. All rights reserved.