oo
Class Mattress3

java.lang.Object
  extended by oo.Mattress3
All Implemented Interfaces:
HasHLT, PRYable

public class Mattress3
extends java.lang.Object
implements PRYable

A mattress and its orientations;  state implemented as a single object of an inner class.


Constructor Summary
Mattress3()
          Constructs a mattress with red-end at top, blue-end at left, and green-surface at top.
 
Method Summary
 boolean headRed()
          True iff the red end is at the top.
 boolean leftBlue()
          True iff the blue side is at the left.
 Orientation orientation()
          The mattress's orientation.
 PRYable pitch()
          Pitches the thing a half-turn (180 degrees).
 PRYable roll()
          Rolls the thing a half-turn (180 degrees).
 boolean topGreen()
          True iff the green surface is on the top.
 java.lang.String toString()
          A string representing the orientation, matching [HF][LR][TB].  The string contains H if headRed() and F otherwise; L if leftBlue() and R otherwise; and T if topGreen() and B otherwise.
 PRYable 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
 

Constructor Detail

Mattress3

public Mattress3()
Constructs a mattress with red-end at top, blue-end at left, and green-surface at top.

Method Detail

toString

public java.lang.String toString()
Description copied from interface: HasHLT
A string representing the orientation, matching [HF][LR][TB].  The string contains H if headRed() and F otherwise; L if leftBlue() and R otherwise; and T if topGreen() and B otherwise.

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

orientation

public Orientation orientation()
The mattress's orientation.


pitch

public PRYable 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.

roll

public PRYable 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.

yaw

public PRYable 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.