CS111 Direction Contract

Instances of the Direction class represent one of the four compass points: north, east, south, west.

Constants

The following constant directions specify the four compass points:
public static final Direction NORTH
public static final Direction EAST
public static final Direction SOUTH
public static final Direction WEST

Instance Methods

public Direction left ()
Returns the compass point to the left of this direction.

public Direction right ()
Returns the compass point to the right of this direction.

public Direction opposite ()
Returns the compass point opposite to this direction.

public boolean equals (Direction d)
Returns true if this direction equals d, and false otherwise.

public String toString ()
Returns a string representation of this direction.