oo
Class Orientation

java.lang.Object
  extended by oo.Orientation
All Implemented Interfaces:
HasHLT, PRYable
Direct Known Subclasses:
OrientationFLB, OrientationFRT, OrientationHLT, OrientationHRB

public abstract class Orientation
extends java.lang.Object
implements PRYable

An orientation of a mattress.   There are four possible orientations (HLT, HRB, FLB, and FRT);  no others can be constructed. 

This class ensures that the only orientations are the four physically-possible orientations.  Each orientation is embodied by a singleton object of a subclass of Orientation.


Field Summary
static Orientation FLB
          The singleton FLB orientation.
static Orientation FRT
          The singleton FRT orientation.
static Orientation HLT
          The singleton HLT orientation.
static Orientation HRB
          The singleton HRB orientation.
 
Constructor Summary
protected Orientation(java.lang.String _toString)
          Protected constructor for orientations.
 
Method Summary
 Orientation FLB()
          The FLB orientation (foot, left, bottom).
 Orientation FRT()
          The FRT orientation (foot, right, top).
 boolean headRed()
          True iff the red end is at the top.
 Orientation HLT()
          The HLT orientation (head, left, top).
 Orientation HRB()
          The HRB orientation (head, right, bottom).
 boolean leftBlue()
          True iff the blue side is at the left.
abstract  Orientation pitch()
          Pitches the thing a half-turn (180 degrees).
abstract  Orientation roll()
          Rolls the thing a half-turn (180 degrees).
 boolean topGreen()
          True iff the green surface is on the top.
 java.lang.String toString()
          "HLT", "HRB", "FLB", or "FRT", whichever describes this orientation.
abstract  Orientation yaw()
          Yaws the thing a half-turn (180 degrees).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HLT

public static final Orientation HLT
The singleton HLT orientation.


HRB

public static final Orientation HRB
The singleton HRB orientation.


FLB

public static final Orientation FLB
The singleton FLB orientation.


FRT

public static final Orientation FRT
The singleton FRT orientation.

Constructor Detail

Orientation

protected Orientation(java.lang.String _toString)
Protected constructor for orientations.

Parameters:
_toString - "HLT", "HRB", "FLB", or "FRT".
Method Detail

toString

public java.lang.String toString()
"HLT", "HRB", "FLB", or "FRT", whichever describes this orientation.

Specified by:
toString in interface HasHLT
Overrides:
toString in class java.lang.Object

headRed

public boolean headRed()
Description copied from interface: HasHLT
True iff the red end is at the top.

Specified by:
headRed in interface HasHLT

leftBlue

public boolean leftBlue()
Description copied from interface: HasHLT
True iff the blue side is at the left.

Specified by:
leftBlue in interface HasHLT

topGreen

public boolean topGreen()
Description copied from interface: HasHLT
True iff the green surface is on the top.

Specified by:
topGreen in interface HasHLT

roll

public abstract Orientation roll()
Description copied from interface: PRYable
Rolls the thing a half-turn (180 degrees).

Specified by:
roll in interface PRYable
Returns:
The result of the roll.

pitch

public abstract Orientation pitch()
Description copied from interface: PRYable
Pitches the thing a half-turn (180 degrees).

Specified by:
pitch in interface PRYable
Returns:
The result of the pitch.

yaw

public abstract Orientation yaw()
Description copied from interface: PRYable
Yaws the thing a half-turn (180 degrees).

Specified by:
yaw in interface PRYable
Returns:
The result of the yaw.

HLT

public Orientation HLT()
The HLT orientation (head, left, top).


HRB

public Orientation HRB()
The HRB orientation (head, right, bottom).


FLB

public Orientation FLB()
The FLB orientation (foot, left, bottom).


FRT

public Orientation FRT()
The FRT orientation (foot, right, top).