bookExamples.ch05ControlStructs
Class SwitchTest
java.lang.Object
bookExamples.ch05ControlStructs.SwitchTest
public class SwitchTest
- extends java.lang.Object
Constructor Summary |
SwitchTest()
Creates a new instance of SwitchTest |
Method Summary |
int |
getIdForString(java.lang.String s)
Retrieves a value from the hashmap give the key. |
java.lang.String |
getStringForId(int id)
|
int |
ifTest(java.lang.String s)
|
static void |
main(java.lang.String[] args)
Tests StringSwitch |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QUIT
public final int QUIT
- See Also:
- Constant Field Values
DIR
public final int DIR
- See Also:
- Constant Field Values
RUN
public final int RUN
- See Also:
- Constant Field Values
STOP
public final int STOP
- See Also:
- Constant Field Values
DEBUG
public final int DEBUG
- See Also:
- Constant Field Values
FWD
public final int FWD
- See Also:
- Constant Field Values
REV
public static final int REV
- See Also:
- Constant Field Values
TYPENOTFOUND
public static final int TYPENOTFOUND
- See Also:
- Constant Field Values
UUENCODED
public static final int UUENCODED
- See Also:
- Constant Field Values
BTOAD
public static final int BTOAD
- See Also:
- Constant Field Values
PBM
public static final int PBM
- See Also:
- Constant Field Values
PGM
public static final int PGM
- See Also:
- Constant Field Values
PPM
public static final int PPM
- See Also:
- Constant Field Values
PBM_RAWBITS
public static final int PBM_RAWBITS
- See Also:
- Constant Field Values
PGM_RAWBITS
public static final int PGM_RAWBITS
- See Also:
- Constant Field Values
PPM_RAWBITS
public static final int PPM_RAWBITS
- See Also:
- Constant Field Values
MGR_BITMAP
public static final int MGR_BITMAP
- See Also:
- Constant Field Values
GIF87a
public static final int GIF87a
- See Also:
- Constant Field Values
GIF89a
public static final int GIF89a
- See Also:
- Constant Field Values
IFF_ILBM
public static final int IFF_ILBM
- See Also:
- Constant Field Values
SUNRASTER
public static final int SUNRASTER
- See Also:
- Constant Field Values
SGI_IMAGE
public static final int SGI_IMAGE
- See Also:
- Constant Field Values
CMU_WINDOW_MANAGER_BITMAP
public static final int CMU_WINDOW_MANAGER_BITMAP
- See Also:
- Constant Field Values
SUN
public static final int SUN
- See Also:
- Constant Field Values
TIFF_BIG_ENDIAN
public static final int TIFF_BIG_ENDIAN
- See Also:
- Constant Field Values
TIFF_LITTLE_ENDIAN
public static final int TIFF_LITTLE_ENDIAN
- See Also:
- Constant Field Values
FLI
public static final int FLI
- See Also:
- Constant Field Values
MPEG
public static final int MPEG
- See Also:
- Constant Field Values
SUN_NEXT_AUDIO
public static final int SUN_NEXT_AUDIO
- See Also:
- Constant Field Values
STANDARD_MIDI
public static final int STANDARD_MIDI
- See Also:
- Constant Field Values
MICROSOFT_RIFF
public static final int MICROSOFT_RIFF
- See Also:
- Constant Field Values
BZIP
public static final int BZIP
- See Also:
- Constant Field Values
IFF_DATA
public static final int IFF_DATA
- See Also:
- Constant Field Values
NIFF_IMAGE
public static final int NIFF_IMAGE
- See Also:
- Constant Field Values
PC_BITMAP
public static final int PC_BITMAP
- See Also:
- Constant Field Values
PDF_DOCUMENT
public static final int PDF_DOCUMENT
- See Also:
- Constant Field Values
POSTSCRIPT_DOCUMENT
public static final int POSTSCRIPT_DOCUMENT
- See Also:
- Constant Field Values
SILICON_GRAPHICS_MOVIE
public static final int SILICON_GRAPHICS_MOVIE
- See Also:
- Constant Field Values
APPLE_QUICKTIME_MOVIE
public static final int APPLE_QUICKTIME_MOVIE
- See Also:
- Constant Field Values
ZIP_ARCHIVE
public static final int ZIP_ARCHIVE
- See Also:
- Constant Field Values
UNIX_COMPRESS
public static final int UNIX_COMPRESS
- See Also:
- Constant Field Values
GZIP
public static final int GZIP
- See Also:
- Constant Field Values
HUFFMAN
public static final int HUFFMAN
- See Also:
- Constant Field Values
PNG_IMAGE
public static final int PNG_IMAGE
- See Also:
- Constant Field Values
JPEG
public static final int JPEG
- See Also:
- Constant Field Values
JPG
public static final int JPG
- See Also:
- Constant Field Values
PSHOP8
public static final int PSHOP8
- See Also:
- Constant Field Values
ZIP
public static final int ZIP
- See Also:
- Constant Field Values
SwitchTest
public SwitchTest()
- Creates a new instance of SwitchTest
main
public static void main(java.lang.String[] args)
- Tests StringSwitch
getStringForId
public java.lang.String getStringForId(int id)
getIdForString
public int getIdForString(java.lang.String s)
- Retrieves a value from the hashmap give the key.
Map.put provides constant-time performance.
- Parameters:
s
- the key object, which is a String
- Returns:
- the value to which the key is mapped
ifTest
public int ifTest(java.lang.String s)