cdx
Class Aircraft

java.lang.Object
  extended by cdx.Aircraft
All Implemented Interfaces:
java.lang.Comparable

public class Aircraft
extends java.lang.Object
implements java.lang.Comparable

The object of Aircraft where callsign is the only attribute


Constructor Summary
Aircraft()
          The default constructor.
Aircraft(Aircraft _aircraft)
          Constructor with an aircraft.
Aircraft(byte[] _callsign)
          Constructor with a callsign.
 
Method Summary
 int compareTo(java.lang.Object _other)
          Performs comparison with ordering taken into account.
 boolean equals(java.lang.Object other)
          Performs a comparison between this object and another.
 byte[] getCallsign()
          Return the callsign of the Aircraft.
 int hashCode()
          Return a valid hash code for this object.
 java.lang.String toString()
          Returns a helpful description of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Aircraft

public Aircraft()
The default constructor. The length of callsign depends on the constant LENGTH_OF_CALLSIGN in the class Constants.


Aircraft

public Aircraft(byte[] _callsign)
Constructor with a callsign.

Parameters:
_callsign - a callsign object
Throws:
IllegalArgumentException() - an exception is thrown if the length of _callsign is different from the constant LENGTH_OF_CALLSIGN.

Aircraft

public Aircraft(Aircraft _aircraft)
Constructor with an aircraft.

Parameters:
_aircraft -
Method Detail

getCallsign

public byte[] getCallsign()
Return the callsign of the Aircraft.

Returns:
the callsign

hashCode

public int hashCode()
Return a valid hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode

equals

public boolean equals(java.lang.Object other)
Performs a comparison between this object and another.

Overrides:
equals in class java.lang.Object
Parameters:
other - the target object
Returns:
true if they are equal, otherwise false

compareTo

public int compareTo(java.lang.Object _other)
              throws java.lang.ClassCastException
Performs comparison with ordering taken into account.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
_other - the target object
Returns:
0 if euqal, -1 if the length of callsign of this object is less than the target one, or the value of callsign of this object is less than the target one; otherwise +1
Throws:
java.lang.ClassCastException

toString

public java.lang.String toString()
Returns a helpful description of this object.

Overrides:
toString in class java.lang.Object
Returns:
convert byte[] to a string