package org.cass; import java.io.*; /** A class containing the default attributes of the three SMEI cameras, as well as a set of utilities specific to cameras. @author Zachary Vaughan @version 1.0, 06/30/2006 @see Mode Mode */ public final class Camera implements Serializable { /** The unique instance representing Camera 1. */ public static final Camera C1 = new Camera(1, Mode.M2); /** The unique instance representing Camera 2. */ public static final Camera C2 = new Camera(2, Mode.M2); /** The unique instance representing Camera 3. */ public static final Camera C3 = new Camera(3, Mode.M1); /** Gets the Camera instance represented by the given integer. The integer can only be one of 1, 2 or 3. Any other value will result in an IllegalArgumentException. @param i the integer to interpret. @throws IllegalArgumentException if the integer is not one of 1, 2 or 3. @return the corresponding Camera instance of the given number. */ public static Camera getCamera(int i) { if(i == 1) return C1; if(i == 2) return C2; if(i == 3) return C3; throw new IllegalArgumentException("Invalid camera number."); } /** Gets the Camera instance represented by the given string argument. The string argument can be any string beginning with optional whitespace followed by at least two characters, the first of which must be either an uppercase or lowercase "C" and followed by the number representing the desired camera ID. The only possible allowed values for these initial two characters, therefore, are as follows: