01: package org.enhydra.jawe.components.graph;
02:
03: import java.util.ArrayList;
04: import java.util.Iterator;
05: import java.util.List;
06:
07: import org.enhydra.shark.xpdl.elements.Activity;
08: import org.enhydra.shark.xpdl.elements.Participant;
09:
10: /**
11: * Info structure for Participants.
12: *
13: * @author Sasa Bojanic
14: */
15: public final class ParticipantInfo {
16:
17: private Participant participant;
18: private List activities = new ArrayList();
19:
20: public ParticipantInfo(Participant p) {
21: this .participant = p;
22: }
23:
24: public Participant getParticipant() {
25: return this .participant;
26: }
27:
28: public void setParticipant(Participant participant) {
29: this .participant = participant;
30: }
31:
32: public void addActivity(Activity act) {
33: activities.add(act);
34: }
35:
36: public void removeActivity(Activity act) {
37: activities.remove(act);
38: }
39:
40: public List getActivities() {
41: return activities;
42: }
43:
44: public void setActivities(List activities) {
45: this .activities = activities;
46: }
47:
48: public String toString() {
49: String name = participant.getName();
50: if (name.equals("")) {
51: name = participant.getId();
52: }
53: String ret = "p=" + name + ", acts=";
54: Iterator it = activities.iterator();
55: while (it.hasNext()) {
56: Activity act = (Activity) it.next();
57: name = act.getName();
58: if (name.equals("")) {
59: name = act.getId();
60: }
61: ret += name + "-pId="
62: + GraphUtilities.getParticipantId(act) + ";";
63: }
64: ret += "\n";
65: return ret;
66: }
67: }
|