01: package process;
02:
03: public class ActivityNameAnalyser {
04: private String name;
05: private String number;
06: private String def;
07:
08: private int finishmode;
09: private int startmode;
10: private int type;
11:
12: public static final int MANUAL = 0;
13: public static final int AUTOMATIC = 1;
14: public static final int TOOL = 0;
15: public static final int NO = 1;
16: public static final int SUBPROCESS = 2;
17:
18: public ActivityNameAnalyser(String name) {
19: this .name = name;
20: def = getActivityType(name);
21: number = getActivityNumber(name);
22: startmode = (def.charAt(1) == 'M') ? MANUAL : AUTOMATIC;
23: finishmode = (def.charAt(2) == 'M') ? MANUAL : AUTOMATIC;
24: switch (def.charAt(0)) {
25: case 'N':
26: type = NO;
27: break;
28: case 'T':
29: type = TOOL;
30: break;
31: case 'S':
32: type = SUBPROCESS;
33: break;
34: }
35: }
36:
37: public static String getActivityType(String activityName) {
38: int nameLength = activityName.length();
39: return activityName.substring(nameLength - 3, nameLength);
40: }
41:
42: public static String getActivityNumber(String activityName) {
43: int nameLength = activityName.length();
44: return activityName.substring(1, nameLength - 3);
45: }
46:
47: public int finishMode() {
48: return finishmode;
49: }
50:
51: public int startMode() {
52: return startmode;
53: }
54:
55: public int type() {
56: return type;
57: }
58:
59: public String number() {
60: return number;
61: }
62: }
|