public class Direction {public static final Direction East = new Direction ( "East"); public static final Direction West = new Direction ( "West"); public static final Direction North = new Direction ( "North"); public static final Direction South = New Direction ("South");
Private final string dirstring; private direction (string name) {dirstring = name;}
Public string toString () {return Dirstring;
Public static direction parse (String DS) {Try {Direction Ret = NULL; Field [] fs = Direction.class.Getfields (); for (int i = 0; i
} Return Ret;} catch (exception ex) {throw new runtimeException (DS "is a invalid direction enum string.");}}}