/* Direction.java */ /** This class implements compass directions. */ public class Direction { // constants public static final int NORTH = 0; public static final int EAST = 1; public static final int WEST = 2; public static final int SOUTH = 3; public static final int MAXDIR = 4; /** * Assumes: dir == one of { NORTH, EAST, WEST, SOUTH } * Returns a direction based on the following table: * * dir returns * --- ------- * NORTH EAST * EAST WEST * WEST SOUTH * SOUTH MAXDIR */ public static int nextDir(int dir) { return dir+1; } }