bookExamples.ch05ControlStructs
Class SwitchTest

java.lang.Object
  extended by bookExamples.ch05ControlStructs.SwitchTest

public class SwitchTest
extends java.lang.Object


Field Summary
static int APPLE_QUICKTIME_MOVIE
           
static int BTOAD
           
static int BZIP
           
static int CMU_WINDOW_MANAGER_BITMAP
           
 int DEBUG
           
 int DIR
           
static int FLI
           
 int FWD
           
static int GIF87a
           
static int GIF89a
           
static int GZIP
           
static int HUFFMAN
           
static int IFF_DATA
           
static int IFF_ILBM
           
static int JPEG
           
static int JPG
           
static int MGR_BITMAP
           
static int MICROSOFT_RIFF
           
static int MPEG
           
static int NIFF_IMAGE
           
static int PBM
           
static int PBM_RAWBITS
           
static int PC_BITMAP
           
static int PDF_DOCUMENT
           
static int PGM
           
static int PGM_RAWBITS
           
static int PNG_IMAGE
           
static int POSTSCRIPT_DOCUMENT
           
static int PPM
           
static int PPM_RAWBITS
           
static int PSHOP8
           
 int QUIT
           
static int REV
           
 int RUN
           
static int SGI_IMAGE
           
static int SILICON_GRAPHICS_MOVIE
           
static int STANDARD_MIDI
           
 int STOP
           
static int SUN
           
static int SUN_NEXT_AUDIO
           
static int SUNRASTER
           
static int TIFF_BIG_ENDIAN
           
static int TIFF_LITTLE_ENDIAN
           
static int TYPENOTFOUND
           
static int UNIX_COMPRESS
           
static int UUENCODED
           
static int ZIP
           
static int ZIP_ARCHIVE
           
 
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
 

Field Detail

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
Constructor Detail

SwitchTest

public SwitchTest()
Creates a new instance of SwitchTest

Method Detail

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)