Interface IdBuilderInt

All Superinterfaces:
IdBuilder<Integer>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IdBuilderInt extends IdBuilder<Integer>
Builder for unique identifiers of vertices or edges in an IntGraph.

An IntGraph allows adding vertices by either providing an identifier (IntGraph.addVertex(int)) or without (IntGraph.addVertexInt()). If no identifier is provided, the graph will generate one using an instance of this interface. The same is true for edges, see IntGraph.addEdge(int, int, int) and IntGraph.addEdge(int, int). The graph expose its vertex and edge builders using IntGraph.vertexBuilder() and IntGraph.edgeBuilder(), which may return null. The identifiers returned by this interface must be unique in the graph.

This interface is shared for both vertices and edges, but an instance of this interface is used only for one of them at a time.

This interface is a specification of IdBuilder for IntGraph.

Author:
Barak Ugav
  • Method Details

    • build

      @Deprecated default Integer build(Set<Integer> existing)
      Deprecated.
      use build(IntSet) instead to avoid unnecessary un/boxing
      Builds a unique identifier for a vertex or an edge.
      Specified by:
      build in interface IdBuilder<Integer>
      Parameters:
      existing - the identifiers of the vertices or edges already in the graph
      Returns:
      a unique identifier
    • build

      int build(IntSet existing)
      Builds a unique identifier for a vertex or an edge.
      Parameters:
      existing - the identifiers of the vertices or edges already in the graph
      Returns:
      a unique identifier
    • defaultBuilder

      static IdBuilderInt defaultBuilder()
      Get an default builder for int identifiers.

      The returned factory may be passed to GraphFactory.setVertexBuilder(IdBuilder).

      Returns:
      a default builder for int identifiers
    • defaultFactory

      static Supplier<IdBuilderInt> defaultFactory()
      Get an default factory for int identifiers.

      The returned factory may be passed to GraphFactory.setVertexFactory(Supplier).

      Returns:
      a default factory for int identifiers