/* File: ReceiverStatefield.java CVS Info: $Id$ Compiler: jdk 1.2.2 */ package mil.navy.nps.disEnumerations; import mil.navy.nps.dis.*; import mil.navy.nps.util.*; /** * Receiver State field -- This field shall indicate the state of the receiver, which shall either be idle or active. This field shall be represented by a 16-bit enumeration (see Section 9 in EBV-DOC). *@version 1.1 *@author Ronan Fauglas *@author Don Brutzman * *
* This is effectively a C-style enumeration. Java doesn't do enumerations * like C, so you have to wrap a class around it. It's a bit more typing, * but pretty simple-minded. * Note that the variables are declared public. The default for access * is package-wide, but these variables might need to be accessed from * outside the package. Since all the variables are final (i.e. constant), nobody can * change anything anyway, so this is no biggie.
* To use these enumerations in your Java code, import the package first:
* import mil.navy.nps.disEnumerations.*;
* You access this via something like ReceiverStatefield.ONANDRECEIVING
, i.e. combine
* the class name, a period, and a class variable (enumeration) name.
* *
ReceiverStatefield.toString (0)
returns the string "OFF
"
*/
public static String toString(int idNumber)
{
switch (idNumber) {
case 0: return "Off";
case 1: return "On but not receiving";
case 2: return "On and receiving";
default : return "";
}
}//end of toString
}//End of class