/**
* Comparable Mini-Lab: Bird
*
* Bird objects implement the Comparable interface.
*
* @author Alyce Brady
* @version 11 February 2016
*/
public class Bird
{
// State: class variables (shared by all instances of the class)
private static int nextAvailableID = 100;
// State: instance variables (each instance has its own copy
private int id;
private String species;
// Constructors
/**
* Constructs a new object of this class (unknown species).
* @param name object's name
*/
public Bird(int bandNumber)
{
// initialise instance variables
this.id = bandNumber; // set ID from parameter
this.species = "unknown species";
}
/**
* Constructs a new object of this class.
* @param name object's name
*/
public Bird(String species)
{
// initialise instance variables
this.id = this.nextAvailableID; // set ID from next available ID
this.species = species;
this.nextAvailableID++; // increment next available ID
}
// Methods
// CODE MISSING: Accessor and toString methods MISSING
// /**
// * Compares this string to the specified object.
// *
// * @param anObject object to be compared
// * @return true if objects are equivalent,
// * false otherwise
// */
// public boolean equals(Object anObject)
// {
// if ( ! (anObject instanceof Bird) )
// return false;
//
// Bird other = (Bird) anObject;
// return this.id == other.getBandNumber();
// }
// /**
// * Compares objects for order based on band numbers.
// *
// * @param other object to be compared
// * @return negative integer, zero, or positive integer
// * based on name comparison
// */
// public int compareTo(Bird other)
// {
// // CODE MISSING to compare based on ids.
// }
}