Adicionado classificaĆ§Ć£o do log conforme exemplo
[simdecs.git] / src / java / org / ufcspa / simdecs / diagram / elements / SwimLane.java
CommitLineData
d076ae96 1package org.ufcspa.simdecs.diagram.elements;\r
2\r
3import java.util.ArrayList;\r
4import java.util.Collection;\r
5import java.util.LinkedList;\r
6import java.util.ListIterator;\r
7import java.util.Locale;\r
8\r
9\r
10public abstract class SwimLane extends Element {\r
11 \r
12 private String name;\r
13 private Integer age;\r
14 private String sex;\r
15 private Float weight;\r
16 private Float height;\r
17 private LinkedList<Node> nodes;\r
18 \r
19 public SwimLane(String messageBundle, Locale locale) {\r
20 super(messageBundle, locale);\r
21 nodes = new LinkedList<Node>();\r
22 }\r
23 \r
24 public Node getNode(String id) {\r
25 for(Node node : nodes) {\r
26 if (node.equals(node))\r
27 return node;\r
28 }\r
29 return null;\r
30 }\r
31 \r
32 public Integer getAge() {\r
33 return age;\r
34 }\r
35\r
36 public void setAge(Integer age) {\r
37 this.age = age;\r
38 }\r
39\r
40 public Float getHeight() {\r
41 return height;\r
42 }\r
43\r
44 public void setHeight(Float height) {\r
45 this.height = height;\r
46 }\r
47\r
48 public String getName() {\r
49 return name;\r
50 }\r
51\r
52 public void setName(String name) {\r
53 this.name = name;\r
54 }\r
55\r
56 public String getSex() {\r
57 return sex;\r
58 }\r
59\r
60 public void setSex(String sex) {\r
61 this.sex = sex;\r
62 }\r
63\r
64 public Float getWeight() {\r
65 return weight;\r
66 }\r
67\r
68 public void setWeight(Float weight) {\r
69 this.weight = weight;\r
70 }\r
71\r
72 \r
73 private void updateImages() {\r
74 ListIterator it = nodes.listIterator();\r
75 while(it.hasNext()) {\r
76 Node node = (Node) it.next();\r
77 if (it.hasNext()) {\r
78 node.setCurrentImage(node.getImageWithLink());\r
79 \r
80 }\r
81 else {\r
82 node.setCurrentImage(node.getImage());\r
83 }\r
84 }\r
85 }\r
86 \r
87 public void addNode(Node node) {\r
1c6214fc 88 if (!nodes.contains(node)) {\r
89 node.setPosition(nodes.size()+1);\r
d076ae96 90 nodes.addLast(node);\r
1c6214fc 91 }\r
d076ae96 92 \r
93 updateImages();\r
94 }\r
95 \r
96 public LinkedList<Node> getNodes() {\r
97 return nodes;\r
98 }\r
99\r
100 public abstract String getImage();\r
101 public abstract String getType();\r
102 \r
103 public Collection<Node> getGrantedNextNodes() {\r
104 Collection<Node> list = new ArrayList<Node>();\r
105 \r
106 if (nodes.size()==0) {\r
107 list.add(new Begin(getMessageBundle(), getLocale()));\r
108 return list;\r
109 }\r
110 \r
111 return null;\r
112 }\r
113 \r
114}\r