Package org.jgrapht.graph
Class DefaultGraphType.Builder
- java.lang.Object
-
- org.jgrapht.graph.DefaultGraphType.Builder
-
- Enclosing class:
- DefaultGraphType
public static class DefaultGraphType.Builder extends java.lang.Object
A builder forDefaultGraphType
.- Author:
- Dimitrios Michail
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultGraphType.Builder
allowCycles(boolean value)
Set whether the graph will allow cycles.DefaultGraphType.Builder
allowMultipleEdges(boolean value)
Set whether to allow multiple edges.DefaultGraphType.Builder
allowSelfLoops(boolean value)
Set whether to allow self-loops.DefaultGraphType
build()
Build the type.DefaultGraphType.Builder
directed()
Set the type as directed.DefaultGraphType.Builder
mixed()
Set the type as mixed.DefaultGraphType.Builder
modifiable(boolean value)
Set whether the graph is modifiable.DefaultGraphType.Builder
undirected()
Set the type as undirected.DefaultGraphType.Builder
weighted(boolean value)
Set whether the graph will be weighted.
-
-
-
Constructor Detail
-
Builder
public Builder()
Construct a new Builder.
-
Builder
public Builder(GraphType type)
Construct a new Builder.- Parameters:
type
- the type to base the builder
-
Builder
public Builder(boolean directed, boolean undirected)
Construct a new Builder.- Parameters:
directed
- whether the graph contains directed edgesundirected
- whether the graph contains undirected edges
-
-
Method Detail
-
directed
public DefaultGraphType.Builder directed()
Set the type as directed.- Returns:
- the builder
-
undirected
public DefaultGraphType.Builder undirected()
Set the type as undirected.- Returns:
- the builder
-
mixed
public DefaultGraphType.Builder mixed()
Set the type as mixed.- Returns:
- the builder
-
allowSelfLoops
public DefaultGraphType.Builder allowSelfLoops(boolean value)
Set whether to allow self-loops.- Parameters:
value
- if true self-values are allowed, otherwise not- Returns:
- the builder
-
allowMultipleEdges
public DefaultGraphType.Builder allowMultipleEdges(boolean value)
Set whether to allow multiple edges.- Parameters:
value
- if true multiple edges are allowed, otherwise not- Returns:
- the builder
-
weighted
public DefaultGraphType.Builder weighted(boolean value)
Set whether the graph will be weighted.- Parameters:
value
- if true the graph will be weighted, otherwise unweighted- Returns:
- the builder
-
allowCycles
public DefaultGraphType.Builder allowCycles(boolean value)
Set whether the graph will allow cycles.- Parameters:
value
- if true the graph will allow cycles, otherwise not- Returns:
- the builder
-
modifiable
public DefaultGraphType.Builder modifiable(boolean value)
Set whether the graph is modifiable.- Parameters:
value
- if true the graph will be modifiable, otherwise not- Returns:
- the builder
-
build
public DefaultGraphType build()
Build the type.- Returns:
- the type
-
-