package org.ufcspa.simdecs.diagram.elements; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; import java.util.ListIterator; import java.util.Locale; public abstract class SwimLane extends Element { private String name; private Integer age; private String sex; private Float weight; private Float height; private LinkedList nodes; public SwimLane(String messageBundle, Locale locale) { super(messageBundle, locale); nodes = new LinkedList(); } public Node getNode(String id) { for(Node node : nodes) { if (node.equals(node)) return node; } return null; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public Float getHeight() { return height; } public void setHeight(Float height) { this.height = height; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public Float getWeight() { return weight; } public void setWeight(Float weight) { this.weight = weight; } private void updateImages() { ListIterator it = nodes.listIterator(); while(it.hasNext()) { Node node = (Node) it.next(); if (it.hasNext()) { node.setCurrentImage(node.getImageWithLink()); } else { node.setCurrentImage(node.getImage()); } } } public void addNode(Node node) { if (!nodes.contains(node)) { node.setPosition(nodes.size()+1); nodes.addLast(node); } updateImages(); } public LinkedList getNodes() { return nodes; } public abstract String getImage(); public abstract String getType(); public Collection getGrantedNextNodes() { Collection list = new ArrayList(); if (nodes.size()==0) { list.add(new Begin(getMessageBundle(), getLocale())); return list; } return null; } }