package uk.co.patrickhaston.mars;

public class MarsPlan extends MarsData 
{
  // variables
  private int planType;
  private int step;
  private int constructionType;
  private int x;
  private int y;
  private int orientation;
  private String description;
  
  /**
   * Constructor
   * @param id - the unique identifier for this item
   */
  public MarsPlan(int id)
  {
    super(id);
    planType = 0;
    step = 0;
    constructionType = 0;
    x = 0;
    y = 0;
    orientation = 0;
    description = "";
  }

  /**
   * Constructor
   * @param line - create the class by reading the data from file
   */
  public MarsPlan(String line)
  {
    super(line);
    planType = readInteger(line, 0);
    step = readInteger(line, 1);
    constructionType = readInteger(line, 2);
    x = readInteger(line, 3);
    y = readInteger(line, 4);
    orientation = readInteger(line, 5);
    description = readString(line, 6);
  }
  
  /**
   * toString()
   * @return - a textual description of this instance for display/debug 
   */
  public String toString()
  {
    String s = new String();
    
    s = s + "Plan type: " + planType;
    s = s + " step: " + step;
    s = s + " construction type: " + constructionType;
    s = s + " (x,y): (" + x + "," + y + ")";
    s = s + " orientation: " + MarsView.getOrientationName(orientation);
    s = s + " description: " + description;
    
    return s;
  }

  public String toFile()
  {
    String s = super.toFile();
    
    s = s + new Integer(planType).toString() + ",";
    s = s + new Integer(step).toString() + ",";
    s = s + new Integer(constructionType).toString() + ",";
    s = s + x + "," + y + ",";
    s = s + orientation + ",";
    s = s + description;

    return s;
  }


  // Accessor functions - get and set
  public int getPlanType()
  {
    return planType;
  }
  public void setPlanType(int t)
  {
    planType = t;
  }
  public int getStep()
  {
    return step;
  }
  public void setStep(int s)
  {
    step = s;
  }
  public int getConstructionType()
  {
    return constructionType;
  }
  public void setConstructionType(int t)
  {
    constructionType = t;
  }
  public int getX()
  {
    return x;
  }
  public void setX(int x1)
  {
    x = x1;
  }
  public int getY()
  {
    return y;
  }
  public void setY(int y1)
  {
    y = y1;
  }
  public int getOrientation()
  {
    return orientation;
  }
  public void setOrientation(int o)
  {
    orientation = o;
  }


}
