/**
*
* Plane object.
*
* @author Sean Handley, 320097@swan.ac.uk
* @version May 2007
*/
public class Plane implements Comparable<Plane> {
protected final int length;
protected final String serial;
protected final String manufacturer;
/**
*
* Constructor for plane.
*
* @param length
* @param manufacturer
* @param serial
*/
public Plane(int length, String manufacturer, String serial)
{
this.length = length;
this.serial = serial;
this.manufacturer = manufacturer;
}
/**
* Compare this plane to another.
*/
public int compareTo(Plane that)
{
if(this.length > that.length)
{
return 1;
}
else if(this.length == that.length)
{
return 0;
}
else
{
return -1;
}
}
/**
* Print out the contents of this plane.
*
* Overrides the toString method in Object.
*/
public String toString()
{
return "[" + length + ", " + serial + ", " + manufacturer + "]";
}
}