| Line | |
|---|
| 1 | package tmcsim.highwaymodel.trafficeventseditor; |
|---|
| 2 | |
|---|
| 3 | import java.util.ArrayList; |
|---|
| 4 | import java.util.List; |
|---|
| 5 | |
|---|
| 6 | /** |
|---|
| 7 | * A list of TrafficLaneEvents |
|---|
| 8 | * @author jtorres |
|---|
| 9 | */ |
|---|
| 10 | public class TimeFrame |
|---|
| 11 | { |
|---|
| 12 | final public String time; |
|---|
| 13 | public List<TrafficLaneEvent> events; |
|---|
| 14 | |
|---|
| 15 | public TimeFrame(String time) |
|---|
| 16 | { |
|---|
| 17 | this.time = time; |
|---|
| 18 | this.events = new ArrayList<>(); |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | public void addEvent(TrafficLaneEvent newEvent) |
|---|
| 22 | { |
|---|
| 23 | for(TrafficLaneEvent event : events) |
|---|
| 24 | { |
|---|
| 25 | if(event.equals(newEvent)) |
|---|
| 26 | { |
|---|
| 27 | events.remove(event); |
|---|
| 28 | } |
|---|
| 29 | } |
|---|
| 30 | events.add(newEvent); |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | @Override |
|---|
| 34 | public String toString() |
|---|
| 35 | { |
|---|
| 36 | return time; |
|---|
| 37 | } |
|---|
| 38 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.