|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.groiss.reporting.data.ReportingGraph<N,E>
N
- the class of the nodesE
- the class of the edgespublic class ReportingGraph<N,E>
Simple graph implementation with nodes and edges which may handle n edges connecting 2 nodes.
Field Summary | |
---|---|
protected java.util.ArrayList<E>[][] |
edges
|
protected java.util.ArrayList<N> |
nodes
|
Constructor Summary | |
---|---|
ReportingGraph()
|
Method Summary | |
---|---|
void |
addEdge(N node1,
N node2,
E edge)
Connect 2 nodes with the given edge |
int |
addNode(N node)
|
boolean |
existsDirectEdge(N n1,
N n2)
check if 2 Nodes are connected by 1 (and only one) edge |
java.util.ArrayList<E> |
getEdges(N node)
get all Edges connected with the given node |
java.util.List<E> |
getEdges(N n1,
N n2)
get All Edges connecting the start and end node directly |
N |
getEndNode(N startNode,
E edge)
return the endnode of an egde |
N |
getNodeWithMostEdges()
returns the node with the most edges connected, can be used as center of the graph |
N |
getNodeWithMostEdges(java.util.List<N> oneOfThisnodes)
returns the node with the most edges connected, can be used as center of the graph |
int |
size()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.ArrayList<N> nodes
protected java.util.ArrayList<E>[][] edges
Constructor Detail |
---|
public ReportingGraph()
Method Detail |
---|
public int size()
public int addNode(N node)
public void addEdge(N node1, N node2, E edge)
node1
- node2
- edge
- public java.util.ArrayList<E> getEdges(N node)
node
-
public boolean existsDirectEdge(N n1, N n2)
n1
- startnoden2
- endnode
public java.util.List<E> getEdges(N n1, N n2)
n1
- start noden2
- end note
public N getNodeWithMostEdges(java.util.List<N> oneOfThisnodes)
nodes
- only nodes in this list will be handled and returned.
public N getNodeWithMostEdges()
public N getEndNode(N startNode, E edge)
startNode
- edge
- - the edge to follow
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |