Package org.eclipse.gef.graph
Class Graph.Builder
java.lang.Object
org.eclipse.gef.graph.Graph.Builder
- Enclosing class:
- Graph
The
Graph.Builder
can be used to construct a new Graph
little
by little.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
A context object passed to nested builders when creating a builder chain. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionPuts the given key-value-pair into theattributes map
of theGraph
which is constructed by thisGraph.Builder
.<T> Graph.Builder
attr
(BiConsumer<Graph, T> setter, T value) Uses the given setter to set the attribute value.build()
Constructs a newGraph
from the values which have been supplied to thisGraph.Builder
.Constructs a newEdge.Builder
.edges
(Collection<Edge> edges) protected Node
findOrCreateNode
(Object key) Retrieves the node already created by a builder for the given key, or creates a new one via the respectiveNode.Builder
.node()
Constructs a new (anonymous)Node.Builder
.Constructs a new (identifiable)Node.Builder
.nodes
(Collection<Node> nodes)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
attr
Uses the given setter to set the attribute value.- Type Parameters:
T
- The type of the attribute.- Parameters:
setter
- The setter to apply.value
- The value to apply.- Returns:
this
for convenience.
-
attr
Puts the given key-value-pair into theattributes map
of theGraph
which is constructed by thisGraph.Builder
.- Parameters:
key
- The attribute name which is inserted.value
- The attribute value which is inserted.- Returns:
this
for convenience.
-
build
Constructs a newGraph
from the values which have been supplied to thisGraph.Builder
.- Returns:
- A new
Graph
from the values which have been supplied to thisGraph.Builder
.
-
edge
Constructs a newEdge.Builder
.- Parameters:
sourceNodeOrKey
- The sourceNode
or a key to identify the sourceNode
(or itsNode.Builder
).targetNodeOrKey
- The targetNode
or a key to identify the targetNode
(or itsNode.Builder
).- Returns:
- A new
Edge.Builder
.
-
edges
- Parameters:
edges
- TheEdge
s which are added to theGraph
which is constructed by thisGraph.Builder
.- Returns:
this
for convenience.
-
edges
- Parameters:
edges
- TheEdge
s which are added to theGraph
which is constructed by thisGraph.Builder
.- Returns:
this
for convenience.
-
findOrCreateNode
Retrieves the node already created by a builder for the given key, or creates a new one via the respectiveNode.Builder
.- Parameters:
key
- The key to identify theNode
orNode.Builder
.- Returns:
- An existing or newly created
Node
.
-
node
Constructs a new (anonymous)Node.Builder
.- Returns:
- A new
Node.Builder
.
-
node
Constructs a new (identifiable)Node.Builder
.- Parameters:
key
- The key that can be used to identify theNode.Builder
- Returns:
- A new
Node.Builder
.
-
nodes
- Parameters:
nodes
- TheNode
s which are added to theGraph
which is constructed by thisGraph.Builder
.- Returns:
this
for convenience.
-
nodes
- Parameters:
nodes
- TheNode
s which are added to theGraph
which is constructed by thisGraph.Builder
.- Returns:
this
for convenience.
-