File: repeat.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 (57 lines) | stat: -rw-r--r-- 1,208 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
50
51
52
53
54
55
56
57

package Pdapilot.appointment;

public class repeat {
	private int idx;
	
	final static private String[] names = 
		{ "None", "Daily", "Weekly", "MonthlyByDay", "MonthlyByDate", "Yearly" };

	public static repeat None = new repeat(0);
	public static repeat Daily = new repeat(1);
	public static repeat Weekly = new repeat(2);
	public static repeat MonthlyByDay = new repeat(3);
	public static repeat MonthlyByDate = new repeat(4);
	public static repeat Yearly = new repeat(5);
	
	private static repeat[] objs;
	
	private repeat(int value) {
		this.idx = value;
	}
	
	public static repeat get(int value) {
		return objs[value];
	}
	public static repeat 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 "repeat."+names[idx];
	}
		
	public int getValue() {
		return idx;
	}
	public String getName() {
		return names[idx];
	}

	static {
		objs = new repeat[6];
		objs[0] = repeat.None;
		objs[1] = repeat.Daily;
		objs[2] = repeat.Weekly;
		objs[3] = repeat.MonthlyByDay;
		objs[4] = repeat.MonthlyByDate;
		objs[5] = repeat.Yearly;
	}
};