Class VerticesImpl<V extends Vertex>

  • Type Parameters:
    V - concrete class of vertices that are being created
    All Implemented Interfaces:
    Iterable<V>, Vertices<V>

    public class VerticesImpl<V extends Vertex>
    extends Object
    implements Vertices<V>
    Vertices implementation using a graphbuilder <V> to create the vertices
    Author:
    markr
    • Constructor Detail

      • VerticesImpl

        public VerticesImpl​(GraphBuilder<V,​?> graphBuilder)
        Constructor
        Parameters:
        graphBuilder - the graph builder to use to create vertices
    • Method Detail

      • updateIdMapping

        protected void updateIdMapping()
        updates the vertex map keys based on vertex ids in case an external force has changed already registered vertices
      • remove

        public void remove​(V vertex)
        Remove
        Specified by:
        remove in interface Vertices<V extends Vertex>
        Parameters:
        vertex - to remove
      • remove

        public void remove​(long vertexId)
        Remove by id
        Specified by:
        remove in interface Vertices<V extends Vertex>
        Parameters:
        vertexId - to remove vertex for
      • createNew

        public V createNew()
        Create a new vertex (without registering on this class)
        Specified by:
        createNew in interface Vertices<V extends Vertex>
        Returns:
        created vertex
      • register

        public V register​(V vertex)
        Add to the container
        Specified by:
        register in interface Vertices<V extends Vertex>
        Parameters:
        vertex - to be registered in this network
        Returns:
        entity, in case it overrides an existing entry, the removed entryis returned
      • registerNew

        public V registerNew()
        Create and register new entity
        Specified by:
        registerNew in interface Vertices<V extends Vertex>
        Returns:
        new node created
      • size

        public int size()
        Return number of registered entity
        Specified by:
        size in interface Vertices<V extends Vertex>
        Returns:
        number of registered entity
      • get

        public V get​(long id)
        Find a entity by its d
        Specified by:
        get in interface Vertices<V extends Vertex>
        Parameters:
        id - Id of entity
        Returns:
        retrieved entity