source: tmcsimulator/trunk/src/tmcsim/common/CCTVDirections.java @ 2

Revision 2, 972 bytes checked in by jdalbey, 10 years ago (diff)

Initial Import of project files

Line 
1package tmcsim.common;
2
3
4/**
5 * Enumberation containing possible CCTV camera directions.
6 *
7 * @author
8 * @version
9 */
10public enum CCTVDirections {
11   
12    NORTH, SOUTH, EAST, WEST; 
13
14    /**
15     * Returns the CCTVDirections enumeration value which has a direction
16     * value that matches the parameter value.
17     * @param dir
18     * @return CCTVDirections for the parameter value.
19     * @throws ScriptException if the parameter value is invalid.
20     */
21    public static CCTVDirections fromChar(char dir) throws ScriptException {
22        switch(dir){
23            case 'S':
24            case 's':
25                return SOUTH;
26            case 'N':
27            case 'n': 
28                return NORTH;
29            case 'E':
30            case 'e':
31                return EAST;
32            case 'W':
33            case 'w':
34                return WEST;
35            default:
36                throw new ScriptException(ScriptException.INVALID_ENUM, dir);
37        }
38    }
39}
Note: See TracBrowser for help on using the repository browser.