/[projects]/android/TrainInfoCommon/src/dk/thoerup/android/traininfo/common/DepartureEntry.java
ViewVC logotype

Annotation of /android/TrainInfoCommon/src/dk/thoerup/android/traininfo/common/DepartureEntry.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1336 - (hide annotations) (download)
Wed Apr 20 06:44:18 2011 UTC (13 years, 1 month ago) by torben
File size: 2484 byte(s)
origin is not used anywhere so no need to have it as a required field
1 torben 1065 package dk.thoerup.android.traininfo.common;
2    
3     import java.io.Serializable;
4    
5     import org.simpleframework.xml.Element;
6     import org.simpleframework.xml.Root;
7    
8 torben 1070 @Root(name="train", strict=false)
9 torben 1065 public class DepartureEntry implements Comparable<DepartureEntry>, Serializable {
10    
11     @Element
12     private String time;
13    
14     @Element
15     private int updated;
16    
17     @Element(name="trainnumber")
18     private String trainNumber;
19    
20     @Element
21     private String destination;
22    
23 torben 1336 @Element(required=false)
24 torben 1065 private String origin;
25    
26     @Element(required=false)
27     private String location;
28    
29     @Element(required=false)
30     private String status;
31    
32     @Element(required=false)
33     private String note;
34    
35     @Element
36     private String type;
37    
38    
39     public String getTime() {
40     return time;
41     }
42     public void setTime(String time) {
43     this.time = time;
44     }
45     public int getUpdated() {
46     return updated;
47     }
48     public void setUpdated(int updated) {
49     this.updated = updated;
50     }
51     public String getTrainNumber() {
52     return trainNumber;
53     }
54     public void setTrainNumber(String trainNumber) {
55     this.trainNumber = trainNumber;
56     }
57     public String getDestination() {
58     return destination;
59     }
60     public void setDestination(String destination) {
61     this.destination = destination;
62     }
63     public String getOrigin() {
64     return origin;
65     }
66     public void setOrigin(String origin) {
67     this.origin = origin;
68     }
69     public String getLocation() {
70     return location;
71     }
72     public void setLocation(String location) {
73     this.location = location;
74     }
75     public String getStatus() {
76     return status;
77     }
78     public void setStatus(String status) {
79     this.status = status;
80     }
81     public String getNote() {
82     return note;
83     }
84     public void setNote(String note) {
85     this.note = note;
86     }
87    
88     public String getType() {
89     return type;
90     }
91    
92     public void setType(String type) {
93     this.type = type;
94     }
95    
96     @Override
97     public int compareTo(DepartureEntry otherBean) {
98     String timeStr1 = time.replace(":","").trim();
99     String timeStr2 = otherBean.time.replace(":","").trim();
100    
101     int time1 = 0;
102     int time2 = 0;
103    
104     if (timeStr1.length() > 0)
105     time1 = Integer.parseInt(timeStr1);
106    
107     if (timeStr2.length() > 0)
108     time2 = Integer.parseInt(timeStr2);
109    
110     //work correctly when clock wraps around at midnight
111     if (Math.abs(time1-time2) < 1200) {
112     if (time1 > time2)
113     return 1;
114     else
115     return -1;
116     } else {
117     if (time1 < time2)
118     return 1;
119     else
120     return -1;
121    
122     }
123    
124     }
125     }

  ViewVC Help
Powered by ViewVC 1.1.20