G
- the type of the (root node of a) graphN
- the type of nodesC
- the type of node classesP
- the type of node portspublic interface GraphStructure<G,N,C,P>
operations
on it.Modifier and Type | Method and Description |
---|---|
C |
classForNode(N node)
Finds a node class for
node . |
boolean |
edgeDirect(P port,
int index)
Checks whether an edge is direct.
|
String |
edgeName(P port,
int index)
The name of an edge.
|
Collection<? extends N> |
edgeNodes(G graph,
N node,
P port,
int index)
Nodes where the edges for a port lead to/from.
|
Object |
edgeType(P port,
int index)
Type of an edge.
|
G |
graph(G currentGraph,
Object obj)
Casts
obj to graph, if possible. |
String |
nameTemplate(C nodeClass)
The template used to build the name of nodes of this class.
|
N |
node(Object obj)
Finds a node for
obj , if possible. |
C |
nodeClass(Object obj)
Finds a node class for
obj , if possible. |
Object |
nodeClassType(C nodeClass)
Java class for a node class.
|
boolean |
nodeHasPredecessor(N node)
Checks if there is a predecessor for a node.
|
int |
nodeId(N node)
Id of
node . |
void |
nodeProperties(G graph,
N node,
Map<String,? super Object> properties)
Collects node properties.
|
Iterable<? extends N> |
nodes(G graph)
Nodes of a graph.
|
int |
nodesCount(G graph)
Number of nodes in a graph.
|
P |
portInputs(C nodeClass)
Input ports of a node class.
|
P |
portOutputs(C nodeClass)
Output ports of a node class.
|
int |
portSize(P port)
The number of edges in a port.
|
G graph(G currentGraph, Object obj)
obj
to graph, if possible. If the given object obj
can be seen as
a graph or sub-graph of a graph, then return the properly typed instance. Otherwise return
null
currentGraph
- the currently processed graphobj
- an object to check and view as a graphnull
if the object doesn't represent a graphIterable<? extends N> nodes(G graph)
GraphStructure.nodesCount(java.lang.Object)
method.graph
- the graph to query for nodesGraphStructure.nodesCount(java.lang.Object)
int nodesCount(G graph)
GraphStructure.nodes(java.lang.Object)
method.graph
- the graph to queryGraphStructure.nodes(java.lang.Object)
int nodeId(N node)
node
. Each node in the graph is uniquely identified by an integer value. If two
nodes have the same id, then they shall be ==
to each other.node
- the node to query for an idboolean nodeHasPredecessor(N node)
node
- the node to checktrue
if it has a predecessor, false
otherwisevoid nodeProperties(G graph, N node, Map<String,? super Object> properties)
graph
- the current graphnode
- the node to collect properties forproperties
- the map to put the properties toN node(Object obj)
obj
, if possible. If the given object obj
can be seen
as an instance of node return the properly typed instance of the node class. Otherwise return
null
.obj
- an object to find node fornull
if the object doesn't represent a nodeC nodeClass(Object obj)
obj
, if possible. If the given object obj
can be
seen as an instance of node class return the properly typed instance of the node class.
Otherwise return null
.obj
- an object to find node class fornull
if the object doesn't represent a node
classC classForNode(N node)
node
.node
- an instance of node in this graphnull
String nameTemplate(C nodeClass)
nodeClass
- the node class to find name template forObject nodeClassType(C nodeClass)
nodeClass
- the node classClass
or other type representation of the node classP portInputs(C nodeClass)
nodeClass
- the node classP portOutputs(C nodeClass)
nodeClass
- the node classint portSize(P port)
GraphStructure.edgeDirect(java.lang.Object, int)
, GraphStructure.edgeName(java.lang.Object, int)
,
GraphStructure.edgeType(java.lang.Object, int)
and
GraphStructure.edgeNodes(java.lang.Object, java.lang.Object, java.lang.Object, int)
for indexes
from 0
to portSize - 1
port
- the portboolean edgeDirect(P port, int index)
port
- the portindex
- index from 0
to GraphStructure.portSize(java.lang.Object)
minus
1
true
if only one node can be returned from
GraphStructure.edgeNodes(java.lang.Object, java.lang.Object, java.lang.Object, int)
methodString edgeName(P port, int index)
port
- the portindex
- index from 0
to GraphStructure.portSize(java.lang.Object)
minus
1
Object edgeType(P port, int index)
enum- e.g. either real instance of
Enum
subclass, or something that the
GraphOutput.Builder
can recognize as
enum.
port
- index
- index from 0
to GraphStructure.portSize(java.lang.Object)
minus
1
Enum
representing type of the edgeCollection<? extends N> edgeNodes(G graph, N node, P port, int index)
direct/non-direct edges
. In case of a direct edge
the returned collection must have exactly one element.graph
- the graphnode
- the node in the graphport
- port of the node classindex
- index from 0
to GraphStructure.portSize(java.lang.Object)
minus
1
null
if there are no edges associated with given port or collection of
nodes where to/from the edges lead to