Coverage details for net.sf.tourviewer.Tour

LineHitsSource
1 package net.sf.tourviewer;
2  
3 import java.util.ArrayList;
4 import java.util.Date;
5 import java.util.List;
6  
7 public class Tour implements Comparable {
8  
9     public enum Type { BIKE, JOGGING, SKI, SKI_BIKE };
10     
11     private long distance;
12     private Date endTime;
13     private Date startTime;
140    private List<TourRecord> records = new ArrayList<TourRecord>();
150    private List<Marker> markers = new ArrayList<Marker>();
16     private Bike bike;
17     private Type type;
18     private long travelTime;
19     
200    public Tour()
21     {
220    }
23  
24     @Override
25     public String toString()
26     {
270        return getClass().getName() + String.format("[type=%s,distance=%d,startTime=%tF %tT,endTime=%tF %tT]",
280                type, distance, startTime, startTime, endTime, endTime);
29     }
30  
31     public void addMarker(Marker marker)
32     {
330        markers.add(marker);
340    }
35  
36     public void addRecord(TourRecord record)
37     {
380        if (!records.isEmpty()) {
390            TourRecord previous = records.get(records.size() - 1);
400            previous.setNext(record);
410            record.setPrevious(previous);
42             
430            if (record.getDistance() != 0) {
440                travelTime += (record.getTime().getTime() - previous.getTime().getTime()) / 1000;
45             }
46         }
470        records.add(record);
480    }
49     
50     public long getDistance()
51     {
520        return distance;
53     }
54     
55     public Date getEndTime()
56     {
570        return endTime;
58     }
59     
60     public Date getStartTime()
61     {
620        return startTime;
63     }
64     
65     public TourRecord[] getRecords() {
660        return records.toArray(new TourRecord[0]);
67     }
68  
69     public void setDistance(long distance)
70     {
710        this.distance = distance;
720    }
73  
74     
75     public void setEndTime(Date endTime)
76     {
770        this.endTime = endTime;
780    }
79  
80     public void setStartTime(Date startTime)
81     {
820        this.startTime = startTime;
830    }
84  
85     
86     public Bike getBike()
87     {
880        return bike;
89     }
90  
91     
92     public Type getType()
93     {
940        return type;
95     }
96  
97     
98     public void setBike(Bike bike)
99     {
1000        this.bike = bike;
1010    }
102  
103     
104     public void setType(Type type)
105     {
1060        this.type = type;
1070    }
108  
109     public int compareTo(Object o)
110     {
1110        return getStartTime().compareTo(((Tour)o).getStartTime());
112     }
113  
114     
115     public long getTravelTime()
116     {
1170        return travelTime;
118     }
119  
120     
121     public void setTravelTime(long travelTime)
122     {
1230        this.travelTime = travelTime;
1240    }
125  
126 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.