public class EdgeHandler
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Integer,Edge> |
edges |
private static int |
INITIAL_CAPACITY |
private static long |
serialVersionUID |
private static int |
Y_SHIFT |
Constructor and Description |
---|
EdgeHandler()
Creates a EdgeHandler object.
|
Modifier and Type | Method and Description |
---|---|
void |
AddRoad(Coordinate p1,
Coordinate p2,
CatanColor color)
Adds a road to the map.
|
void |
ClearRoad(Coordinate p1,
Coordinate p2)
Removes a road from the map.
|
private int |
ComputeKey(Coordinate p1,
Coordinate p2) |
java.lang.Boolean |
ContainsEdge(Coordinate p1,
Coordinate p2)
Determines if an edge exists.
|
boolean |
equals(java.lang.Object obj) |
java.util.Iterator<Edge> |
GetAllEdges()
Returns all the edges
|
Edge |
GetEdge(Coordinate p1,
Coordinate p2)
Returns the edge between the provided end points.
|
private int |
GetKey(Coordinate p1,
Coordinate p2) |
int |
hashCode() |
private boolean |
ReverseOrder(Coordinate p1,
Coordinate p2) |
private static final long serialVersionUID
private static final int INITIAL_CAPACITY
private static final int Y_SHIFT
private java.util.Map<java.lang.Integer,Edge> edges
public java.lang.Boolean ContainsEdge(Coordinate p1, Coordinate p2)
p1
- The coordinate of the first end point.p2
- The coordinate of the second end point.public Edge GetEdge(Coordinate p1, Coordinate p2) throws MapException
p1
- The coordinate of the first end point.p2
- The coordinate of the second end point.MapException
- Thrown if the edge isn't foundpublic java.util.Iterator<Edge> GetAllEdges()
public void AddRoad(Coordinate p1, Coordinate p2, CatanColor color) throws MapException
p1
- The start of the road.p2
- The end of the road.color
- The color of the road.MapException
- Why the road couldn't be built.public void ClearRoad(Coordinate p1, Coordinate p2) throws MapException
p1
- The start of the road.p2
- The end of the road.MapException
- Why the road couldn't be removed.private int GetKey(Coordinate p1, Coordinate p2)
private boolean ReverseOrder(Coordinate p1, Coordinate p2)
private int ComputeKey(Coordinate p1, Coordinate p2)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object