//  (c) 2010 Thomas A. Alspaugh.  All rights reserved.
package oo;


/**
  A mattress and its orientations;&nbsp;
  state implemented as a single object of an inner class.
*/
public class Mattress2 implements PRYable {

  /**
    The mattress's orientation,
    represented as a single object.
  */
  private PRYable orientation;

  /**
    Constructs a mattress
    with red-end at top,
    blue-end at left,
    and green-surface at top.
  */
  public Mattress2() {
    orientation = Orientation.HLT;
  }

  public String toString() {
    return orientation.toString();
  }

  public boolean       headRed() {
    return orientation.headRed();
  }

  public boolean       leftBlue() {
    return orientation.leftBlue();
  }

  public boolean       topGreen() {
    return orientation.topGreen();
  }

  /**
    The mattress's orientation.
  */
  public Orientation orientation() {
    return (Orientation) orientation;
  }

  public PRYable   pitch() {
    orientation = orientation.pitch();
    return orientation;
  }

  public PRYable   roll() {
    orientation = orientation.roll();
    return orientation;
  }

  public PRYable   yaw() {
    orientation = orientation.yaw();
    return orientation;
  }

}
