public static class Graph.Builder
extends java.lang.Object
Graph.Builder
can be used to construct a new Graph
little
by little.Modifier and Type | Class and Description |
---|---|
protected class |
Graph.Builder.Context
A context object passed to nested builders when creating a builder
chain.
|
Constructor and Description |
---|
Builder()
|
Modifier and Type | Method and Description |
---|---|
Graph.Builder |
attr(java.lang.String key,
java.lang.Object value)
Puts the given key-value-pair into the
attributes map of the
Graph which is constructed by this Graph.Builder . |
Graph |
build()
Constructs a new
Graph from the values which have been
supplied to this Graph.Builder . |
Edge.Builder |
edge(java.lang.Object sourceNodeOrKey,
java.lang.Object targetNodeOrKey)
Constructs a new
Edge.Builder . |
Graph.Builder |
edges(Edge... edges)
|
protected Node |
findOrCreateNode(java.lang.Object key)
Retrieves the node already created by a builder for the given key, or
creates a new one via the respective
Node.Builder . |
Node.Builder |
node()
Constructs a new (anonymous)
Node.Builder . |
Node.Builder |
node(java.lang.Object key)
Constructs a new (identifiable)
Node.Builder . |
Graph.Builder |
nodes(Node... nodes)
|
public Graph.Builder attr(java.lang.String key, java.lang.Object value)
attributes map
of the
Graph
which is constructed by this Graph.Builder
.key
- The attribute name which is inserted.value
- The attribute value which is inserted.this
for convenience.public Graph build()
Graph
from the values which have been
supplied to this Graph.Builder
.Graph
from the values which have been supplied
to this Graph.Builder
.public Edge.Builder edge(java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)
Edge.Builder
.sourceNodeOrKey
- The source Node
or a key to identify the source
Node
(or its Node.Builder
).targetNodeOrKey
- The target Node
or a key to identify the target
Node
(or its Node.Builder
).Edge.Builder
.public Graph.Builder edges(Edge... edges)
edges
- The Edge
s which are added to the Graph
which is constructed by this Graph.Builder
.this
for convenience.protected Node findOrCreateNode(java.lang.Object key)
Node.Builder
.key
- The key to identify the Node
or
Node.Builder
.Node
.public Node.Builder node()
Node.Builder
.Node.Builder
.public Node.Builder node(java.lang.Object key)
Node.Builder
.key
- The key that can be used to identify the
Node.Builder
Node.Builder
.public Graph.Builder nodes(Node... nodes)
nodes
- The Node
s which are added to the Graph
which is constructed by this Graph.Builder
.this
for convenience.Copyright (c) 2014 itemis AG and others. All rights reserved.