public class Graph
extends java.lang.Object
Constructor and Description |
---|
Graph(boolean isCityGraph,
float xOffset,
float yOffset,
float width,
float height,
int id)
Constructs a graph instance
|
Modifier and Type | Method and Description |
---|---|
void |
generateGraph(java.lang.String filename,
playn.core.GroupLayer graphLayer,
int player_id)
Constructs a graph instance
|
java.util.Map<java.lang.Integer,Edge> |
getEdges() |
int |
getId() |
Node |
getNode1(Edge edge)
return the Node instance of the node1 of the given edge
|
Node |
getNode2(Edge edge)
return the Node instance of the node2 of the given edge
|
java.util.Map<java.lang.Integer,Node> |
getNodes() |
boolean |
isCityGraph() |
void |
paintAll()
paints all the imageLayers in this graph instance
|
java.lang.String |
toString() |
void |
updateAll()
updates all the positions of the nodes and edges in the graph
|
public Graph(boolean isCityGraph, float xOffset, float yOffset, float width, float height, int id)
isCityGraph
- - defines if it is a graph of cities or campsxOffset
- - float value representing the top left origin of the graph on the x axisyOffset
- - float value representing the top left origin of the graph in the y axiswidht
- - float value is the width of the graphheight
- - float value is the height of the graphid
- - the unique integer value assigned to this instancepublic void generateGraph(java.lang.String filename, playn.core.GroupLayer graphLayer, int player_id)
filename
- - the path to the database file containing the graph raw datagraphLayer
- - the GroupLayer that all the imageLayers in this graph instance are added toplayer_id
- - the unique integer value of the player assigned to this graphpublic int getId()
public java.util.Map<java.lang.Integer,Node> getNodes()
public java.util.Map<java.lang.Integer,Edge> getEdges()
public void updateAll()
public void paintAll()
public Node getNode1(Edge edge)
edge
- - a given Edge instancepublic Node getNode2(Edge edge)
edge
- - a given Edge instancepublic boolean isCityGraph()
public java.lang.String toString()
toString
in class java.lang.Object