The type CompassDir represents the cardinal compass directions in a grid-like coordinate system. There are exactly four instances of this type: North, East, South and West, which are also defined in this package.
All the CompassDir objects are immutable.
This type and its instances have aliases in the top-level package o1, so they are accessible to students simply via import o1.*.
Parameters
xStep
the change in x coordinate if one moves one step in this direction. For instance, West has an xStep of -1 and North has an xStep of 0.
yStep
the change in y coordinate if one moves one step in this direction. For instance, North has an yStep of -1 and West has an yStep of 0.
This immutable singleton object represents the eastwardly compass direction. It’s one of the four predefined instances of CompassDir. It has an alias in the top-level package o1, so it’s accessible to students simply via import o1.*.
This immutable singleton object represents the eastwardly compass direction. It’s one of the four predefined instances of CompassDir. It has an alias in the top-level package o1, so it’s accessible to students simply via import o1.*.
This immutable singleton object represents the northwardly compass direction. It’s one of the four predefined instances of CompassDir. It has an alias in the top-level package o1, so it’s accessible to students simply via import o1.*.
This immutable singleton object represents the northwardly compass direction. It’s one of the four predefined instances of CompassDir. It has an alias in the top-level package o1, so it’s accessible to students simply via import o1.*.
This immutable singleton object represents the southwardly compass direction. It’s one of the four predefined instances of CompassDir. It has an alias in the top-level package o1, so it’s accessible to students simply via import o1.*.
This immutable singleton object represents the southwardly compass direction. It’s one of the four predefined instances of CompassDir. It has an alias in the top-level package o1, so it’s accessible to students simply via import o1.*.
This immutable singleton object represents the westwardly compass direction. It’s one of the four predefined instances of CompassDir. It has an alias in the top-level package o1, so it’s accessible to students simply via import o1.*.
This immutable singleton object represents the westwardly compass direction. It’s one of the four predefined instances of CompassDir. It has an alias in the top-level package o1, so it’s accessible to students simply via import o1.*.