I\'m programming a game in java which is made up of a grid of tiles. I wan\'t to be able to inuitively define the edges of the tiles and how they relate to each other, e.g.
public enum Edge { TOP, BOTTOM(Edge.TOP), LEFT, RIGHT(Edge.LEFT); private Edge opposite; private Edge() { } private Edge(Edge opp) { this.opposite = opp; opp.opposite = this; } public Edge opposite() { return this.opposite; } }