File: end.java

package info (click to toggle)
pilot-link 0.8.7-2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,256 kB
  • ctags: 3,233
  • sloc: ansic: 24,039; java: 2,162; cpp: 1,641; sh: 1,585; makefile: 1,363; perl: 723; yacc: 660; python: 239; tcl: 14
file content (49 lines) | stat: -rw-r--r-- 982 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

package Pdapilot;

public class end {
	private int idx;
	
	static private String[] names = null;
	static private end[] objs = null;

	public static end Normal = new end(0, "Normal");
	public static end OutOfMemory =  new end(1, "OutOfMemory");
	public static end UserCancelled =  new end(2, "UserCancelled");
	public static end Other =  new end(3, "Other");
	
	private end(int value, String name) {
		if (objs == null)
			objs = new end[4];
		if (names == null)
			names = new String[4];
		this.idx = value;
		objs[value] = this;
		names[value] = name;
	}
	
	public static end get(int value) {
		return objs[value];
	}
	public static end get(String value) {
		int i;
		for(i=0;i<names.length;i++)
			if (names[i].equals(value))
				return objs[i];
		return null;
	}
	public static String[] getNames() {
		return names;
	}
	
	public String toString() {
		return "end."+names[idx];
	}
		
	public int getValue() {
		return idx;
	}
	public String getName() {
		return names[idx];
	}
};