Class GraphBuilderImpl

    • Field Detail

    • Constructor Detail

      • GraphBuilderImpl

        public GraphBuilderImpl​(IdGroupingToken groupIdToken)
        Constructor
        Parameters:
        groupIdToken - to use for creating element ids
    • Method Detail

      • createEdge

        public Edge createEdge​(Vertex vertexA,
                               Vertex vertexB,
                               double length)
                        throws PlanItException
        Create a new link instance
        Specified by:
        createEdge in interface GraphBuilder<Vertex,​Edge>
        Parameters:
        vertexA - the first vertex in this edge
        vertexB - the second vertex in this edge
        length - the length (in km)
        Returns:
        created edge
        Throws:
        PlanItException - thrown if there is an error
      • setIdGroupingToken

        public void setIdGroupingToken​(IdGroupingToken groupIdToken)
        Each builder needs a group if token to allow all underlying factory methods to generated ids uniquely tied to the group the entities belong to
        Specified by:
        setIdGroupingToken in interface GraphBuilder<Vertex,​Edge>
        Parameters:
        groupIdToken - , contiguous id generation within this group for instances created with the factory methods
      • recreateIds

        public void recreateIds​(Edges<? extends Edge> edges)
        recreate the ids for all passed in edges
        Specified by:
        recreateIds in interface GraphBuilder<Vertex,​Edge>
        Parameters:
        edges - to recreate ids for
      • recreateIds

        public void recreateIds​(Vertices<? extends Vertex> vertices)
        recreate the ids for all passed in vertices
        Specified by:
        recreateIds in interface GraphBuilder<Vertex,​Edge>
        Parameters:
        vertices - to recreate ids for
      • createUniqueCopyOf

        public Edge createUniqueCopyOf​(Edge edgeToCopy)
        create a shallo copy of the passed in edge, albeit with unique internal ids
        Specified by:
        createUniqueCopyOf in interface GraphBuilder<Vertex,​Edge>
        Parameters:
        edgeToCopy - the edge to copy
        Returns:
        new edge based on passed in edge