PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/v3.2/nimbits-android/src/com/nimbits/android/DisplayType.java

http://nimbits-server.googlecode.com/
Java | 53 lines | 25 code | 10 blank | 18 comment | 1 complexity | 5c51d97f4b1ca171f793c621b3dbf16d MD5 | raw file
 1/*
 2 * Copyright (c) 2010 Tonic Solutions LLC.
 3 *
 4 * http://www.nimbits.com
 5 *
 6 *
 7 * Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
 8 *
 9 * http://www.gnu.org/licenses/gpl.html
10 *
11 * Unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
12 */
13
14package com.nimbits.android;
15
16import java.util.EnumSet;
17import java.util.HashMap;
18import java.util.Map;
19
20/**
21 * Created by bsautner
22 * User: benjamin
23 * Date: 7/12/11
24 * Time: 5:39 PM
25 */
26public enum DisplayType {
27    Category(1),
28     Point(2),
29     HighAlarm(3),
30     LowAlarm(4),
31    IdleAlarm(5),
32     Diagram(6);
33
34     private static final Map<Integer,DisplayType> lookup  = new HashMap<Integer,DisplayType>();
35
36     static {
37          for(DisplayType s : EnumSet.allOf(DisplayType.class))
38               lookup.put(s.getCode(), s);
39     }
40
41     private final int code;
42
43     private DisplayType(int code) {
44          this.code = code;
45     }
46
47     public int getCode() { return code; }
48
49     public static DisplayType get(int code) {
50          return lookup.get(code);
51     }
52
53}