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
Nested ClassesModifier and TypeClassDescriptionprotected classA context object passed to nested builders when creating a builder chain. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPuts the given key-value-pair into theattributes mapof theGraphwhich is constructed by thisGraph.Builder.<T> Graph.Builderattr(BiConsumer<Graph, T> setter, T value) Uses the given setter to set the attribute value.build()Constructs a newGraphfrom the values which have been supplied to thisGraph.Builder.Constructs a newEdge.Builder.edges(Collection<Edge> edges) protected NodefindOrCreateNode(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:
thisfor convenience.
-
attr
Puts the given key-value-pair into theattributes mapof theGraphwhich is constructed by thisGraph.Builder.- Parameters:
key- The attribute name which is inserted.value- The attribute value which is inserted.- Returns:
thisfor convenience.
-
build
Constructs a newGraphfrom the values which have been supplied to thisGraph.Builder.- Returns:
- A new
Graphfrom the values which have been supplied to thisGraph.Builder.
-
edge
Constructs a newEdge.Builder.- Parameters:
sourceNodeOrKey- The sourceNodeor a key to identify the sourceNode(or itsNode.Builder).targetNodeOrKey- The targetNodeor a key to identify the targetNode(or itsNode.Builder).- Returns:
- A new
Edge.Builder.
-
edges
- Parameters:
edges- TheEdges which are added to theGraphwhich is constructed by thisGraph.Builder.- Returns:
thisfor convenience.
-
edges
- Parameters:
edges- TheEdges which are added to theGraphwhich is constructed by thisGraph.Builder.- Returns:
thisfor 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 theNodeorNode.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- TheNodes which are added to theGraphwhich is constructed by thisGraph.Builder.- Returns:
thisfor convenience.
-
nodes
- Parameters:
nodes- TheNodes which are added to theGraphwhich is constructed by thisGraph.Builder.- Returns:
thisfor convenience.
-