1 |
package dk.thoerup.traininfoservice.banedk; |
package dk.thoerup.traininfoservice.banedk; |
2 |
|
|
3 |
public class DepartureBean implements Comparable<DepartureBean> { |
import java.util.ArrayList; |
4 |
private String time; |
import java.util.HashSet; |
5 |
private int updated; |
import java.util.List; |
6 |
private String trainNumber; |
import java.util.Set; |
7 |
private String destination; |
|
8 |
private String origin; |
public class DepartureBean { |
9 |
private String location; |
|
10 |
private String status; |
Set<String> notifications = new HashSet<String>(); |
11 |
private String note; |
List<DepartureEntry> departureEntries = new ArrayList<DepartureEntry>(); |
12 |
|
|
13 |
|
|
14 |
public String getTime() { |
} |
|
return time; |
|
|
} |
|
|
public void setTime(String time) { |
|
|
this.time = time; |
|
|
} |
|
|
public int getUpdated() { |
|
|
return updated; |
|
|
} |
|
|
public void setUpdated(int updated) { |
|
|
this.updated = updated; |
|
|
} |
|
|
public String getTrainNumber() { |
|
|
return trainNumber; |
|
|
} |
|
|
public void setTrainNumber(String trainNumber) { |
|
|
this.trainNumber = trainNumber; |
|
|
} |
|
|
public String getDestination() { |
|
|
return destination; |
|
|
} |
|
|
public void setDestination(String destination) { |
|
|
this.destination = destination; |
|
|
} |
|
|
public String getOrigin() { |
|
|
return origin; |
|
|
} |
|
|
public void setOrigin(String origin) { |
|
|
this.origin = origin; |
|
|
} |
|
|
public String getLocation() { |
|
|
return location; |
|
|
} |
|
|
public void setLocation(String location) { |
|
|
this.location = location; |
|
|
} |
|
|
public String getStatus() { |
|
|
return status; |
|
|
} |
|
|
public void setStatus(String status) { |
|
|
this.status = status; |
|
|
} |
|
|
public String getNote() { |
|
|
return note; |
|
|
} |
|
|
public void setNote(String note) { |
|
|
this.note = note; |
|
|
} |
|
|
|
|
|
@Override |
|
|
public int compareTo(DepartureBean otherBean) { |
|
|
|
|
|
int time1 = Integer.parseInt(time.replace(":", "")); |
|
|
int time2 = Integer.parseInt(otherBean.time.replace(":", "")); |
|
|
if (time1 > time2) |
|
|
return 1; |
|
|
else |
|
|
return -1; |
|
|
|
|
|
} |
|
|
|
|
|
public String getUpdatedString() { |
|
|
String updStr; |
|
|
|
|
|
switch (updated) { |
|
|
case 1: |
|
|
updStr = "< 3 min"; |
|
|
break; |
|
|
case 2: |
|
|
updStr = "< 3 min"; |
|
|
break; |
|
|
case 3: |
|
|
updStr = "> 10 min"; |
|
|
break; |
|
|
case 4: |
|
|
updStr = "No info"; |
|
|
break; |
|
|
default: |
|
|
updStr = "Unknown:" + updated; |
|
|
} |
|
|
|
|
|
return updStr; |
|
|
} |
|
|
|
|
|
} |
|