|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.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 ArrayList<E>[][] |
edges
|
protected 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 |
ArrayList<E> |
getEdges(N node)
get all Edges connected with the given node |
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 |
int |
size()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ArrayList<N> nodes
protected 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 ArrayList<E> getEdges(N node)
node -
public boolean existsDirectEdge(N n1,
N n2)
n1 - startnoden2 - endnode
public List<E> getEdges(N n1,
N n2)
n1 - start noden2 - end note
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 | ||||||||