Interface IdBuilderInt
-
- 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 anIntGraph
.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, seeIntGraph.addEdge(int, int, int)
andIntGraph.addEdge(int, int)
. The graph expose its vertex and edge builders usingIntGraph.vertexBuilder()
andIntGraph.edgeBuilder()
, which may returnnull
. 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
forIntGraph
.- Author:
- Barak Ugav
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description int
build(IntSet existing)
Builds a unique identifier for a vertex or an edge.default Integer
build(Set<Integer> existing)
Deprecated.usebuild(IntSet)
instead to avoid unnecessary un/boxingstatic IdBuilderInt
defaultBuilder()
Get an default builder forint
identifiers.static Supplier<IdBuilderInt>
defaultFactory()
Get an default factory forint
identifiers.
-
-
-
Method Detail
-
build
@Deprecated default Integer build(Set<Integer> existing)
Deprecated.usebuild(IntSet)
instead to avoid unnecessary un/boxingBuilds a unique identifier for a vertex or an edge.
-
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 forint
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 forint
identifiers.The returned factory may be passed to
GraphFactory.setVertexFactory(Supplier)
.- Returns:
- a default factory for
int
identifiers
-
-