oo
Class Mattress1

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

public class Mattress1
extends java.lang.Object
implements PRYable

A mattress and its orientations;  the mattress's state (its orientation) is implemented with three booleans.

To, after a ...
From pitch roll yaw
FLB HLT FRT HRB
FRT HRB FLB HLT
HLT FLB HRB FRT
HRB FRT HLT FLB

The FLB, FRT, etc. codes in the table above are interpreted as follows:

Code Meaning
B Bottom is green
F Foot is red
H Head is red
L Left is blue
R Right is blue
T Top is green


Constructor Summary
Mattress1()
          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.
 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

Mattress1

public Mattress1()
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

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.