faa.tg.aircraft
Class Acid

java.lang.Object
  extended by faa.tg.aircraft.Acid
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Acid>

public class Acid
extends java.lang.Object
implements java.lang.Comparable<Acid>, java.io.Serializable

 Defines an Acid (aircraft ID) type.
 
See the source Acid.java

Version:
$Id: Acid.java,v 3.4 2008/10/20 20:50:05 lykensj Exp $
Author:
Dana N. Whicker, FAA/ACT-510, Mon May 22 2000
See Also:
HasAcid, Serialized Form

Field Summary
protected  java.lang.String acid
           
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
(package private) static long serialVersionUID
           
 
Constructor Summary
Acid(java.lang.String acid)
          Constructor for an Acid (converts text to standard format).
 
Method Summary
 int compareTo(Acid otherAcid)
           
 boolean equals(java.lang.Object other)
          Acids are equal if there acid member strings are the equal.
 java.lang.String getLetterPart()
           
 int hashCode()
          Careful, even though Acid will return the same hashcode as a String you cannot retrieve an Acid from a hashed collection using a String, because the hash retrieve will use String's equals to see if the right key was retrieve and it fails the "if (anObject instanceof String)" HOWEVER if we were to make Acid a sub class of String then retrieval would work.
static void main(java.lang.String[] args)
           
static java.lang.String stdFormat(java.lang.String acid)
          Converts the aircraft ID text specified to standard format: a string with only numerics is accepted as valid.
 java.lang.String toString()
          Returns the ACID (aircraft ID) as a String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID

See Also:
Constant Field Values

acid

protected java.lang.String acid
Constructor Detail

Acid

public Acid(java.lang.String acid)
Constructor for an Acid (converts text to standard format).

Parameters:
acid - The ACID (aircraft ID).
Method Detail

stdFormat

public static java.lang.String stdFormat(java.lang.String acid)
Converts the aircraft ID text specified to standard format: a string with only numerics is accepted as valid.

(Tries to get something that works: characters that are not alphanumerics will be removed from the text.)

Parameters:
acid - The ACID (aircraft ID) to format.
Returns:
Returns the aircraft ID as a trimmed, upper-case string.

compareTo

public int compareTo(Acid otherAcid)
Specified by:
compareTo in interface java.lang.Comparable<Acid>
Parameters:
otherAcid - The ACID to compare against for determining order.
Returns:
Returns whether the other aircraft ID is the same as this Acid.
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this Object.

equals

public boolean equals(java.lang.Object other)
Acids are equal if there acid member strings are the equal. An Acid can be equal to a string object. An Acid is equal to itself.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object), hashCode()

hashCode

public int hashCode()
Careful, even though Acid will return the same hashcode as a String you cannot retrieve an Acid from a hashed collection using a String, because the hash retrieve will use String's equals to see if the right key was retrieve and it fails the "if (anObject instanceof String)" HOWEVER if we were to make Acid a sub class of String then retrieval would work.

Overrides:
hashCode in class java.lang.Object

getLetterPart

public java.lang.String getLetterPart()

toString

public java.lang.String toString()
Returns the ACID (aircraft ID) as a String.

Overrides:
toString in class java.lang.Object
Returns:
Returns the Acid (aircraft ID) in string format.

main

public static void main(java.lang.String[] args)