1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package zeus.concepts;
25
26 import java.util.*;
27 import zeus.util.*;
28
29
30 public class GoalSummary extends Summary {
31 public static String DISCRETE = "Discrete";
32 public static String CONTINUOUS = "Continuous";
33 public static String ENACTMENT = "Enactment";
34
35 public static String RUNNING = "Running";
36 public static String SUSPENDED = "Suspended";
37 public static String CANCELLED = "Cancelled";
38 public static String FAILED = "Failed";
39 public static String COMPLETED = "Completed";
40
41 protected String id;
42 protected String type;
43 protected String owner;
44 protected String item;
45
46 public GoalSummary(String id, String type, String status,
47 String owner, String item) {
48 setId(id);
49 setType(type);
50 setStatus(status);
51 setOwner(owner);
52 setItem(item);
53 }
54
55 public GoalSummary(GoalSummary g) {
56 id = g.getId();
57 type = g.getType();
58 status = g.getStatus();
59 owner = g.getOwner();
60 item = g.getItem();
61 }
62
63 public String getId() { return id; }
64 public String getType() { return type; }
65 public String getOwner() { return owner; }
66 public String getItem() { return item; }
67
68 public String[] summarize() {
69 String[] data = { item, owner, id, type, status };
70 return data;
71 }
72 public void setId(String id) {
73 Assert.notNull(id);
74 this.id = id;
75 }
76 public void setType(String type) {
77 Assert.notNull(type);
78 Assert.notFalse( type.equals(DISCRETE) || type.equals(CONTINUOUS) ||
79 type.equals(ENACTMENT) );
80 this.type = type;
81 }
82 public void setStatus(String status) {
83 Assert.notNull(status);
84 Assert.notFalse( status.equals(RUNNING) || status.equals(SUSPENDED) ||
85 status.equals(CANCELLED) || status.equals(FAILED) ||
86 status.equals(COMPLETED) || status.equals(UNKNOWN) );
87 this.status = status;
88 }
89 public void setOwner(String owner) {
90 Assert.notNull(owner);
91 this.owner = owner;
92 }
93 public void setItem(String item) {
94 Assert.notNull(item);
95 this.item = item;
96 }
97
98 public boolean equals(GoalSummary g ) {
99 return id.equals(g.getId()) && type.equals(g.getType()) &&
100 status.equals(g.getStatus()) && owner.equals(g.getOwner()) &&
101 item.equals(g.getItem());
102 }
103
104 public String toString() {
105 return( "(" +
106 ":id " + id + " " +
107 ":type " + type + " " +
108 ":status " + status +
109 ":owner " + owner +
110 ":item " + item +
111 ")"
112 );
113 }
114 }