X-Git-Url: http://jaekl.net/gitweb/?p=frank.git;a=blobdiff_plain;f=report%2Fnet%2Fjaekl%2Ffrank%2Foctranspo%2FTrip.html;fp=report%2Fnet%2Fjaekl%2Ffrank%2Foctranspo%2FTrip.html;h=0000000000000000000000000000000000000000;hp=c2e39edeaa0d691967c0f2aeb3044fd8ae6c3f87;hb=c35af9e511e8390a66ca76331c3af43d0f0f7464;hpb=24f097b0fe78fa44f99b9f6f2e51a8e689d86a4a diff --git a/report/net/jaekl/frank/octranspo/Trip.html b/report/net/jaekl/frank/octranspo/Trip.html deleted file mode 100644 index c2e39ed..0000000 --- a/report/net/jaekl/frank/octranspo/Trip.html +++ /dev/null @@ -1,890 +0,0 @@ - - -tests coverage - - - - - - - - - -
-Frames -No Frames -
-

- - - - - - - - - - - - - - - -
 %method%block%branch%line
net.jaekl.frank.octranspo.Trip
94%(15/16)
94%(34/36)
94%(17/18)
95%(58/61)
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
hit countmethod namemethod modifiersmethod signature
1<clinit>[static]void <clinit>()
13<init>[public]void <init>()
8<init>[public]void <init>(net.jaekl.frank.octranspo.Trip)
81endContents[public]void endContents(java.lang.String,java.lang.String,java.lang.String,java.lang.String)
0endExternal[public]void endExternal(java.lang.String,java.lang.String,java.lang.String)
12getAdjAge[public]double getAdjAge()
12getAdjTime[public]int getAdjTime()
4getBusType[public]java.lang.String getBusType()
8getDest[public]java.lang.String getDest()
4getETA[public]java.util.Date getETA()
4getGPSTime[public]java.util.Date getGPSTime()
8getLatitude[public]double getLatitude()
8getLongitude[public]double getLongitude()
4getSpeed[public]double getSpeed()
4getStart[public]java.util.Date getStart()
4isLastTrip[public]boolean isLastTrip()
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 1 
 package net.jaekl.frank.octranspo;
 2 
 
 3 
 import java.text.DateFormat;
 4 
 import java.text.ParseException;
 5 
 import java.text.SimpleDateFormat;
 6 
 import java.util.Date;
 7 
 
 8 
 import net.jaekl.qd.util.ParseUtils;
 9 
 import net.jaekl.qd.xml.ParseResult;
 10 
 import net.jaekl.qd.xml.XmlParseException;
 11 
 
 12 
 public class Trip extends ParseResult {
 13 
 	static final String TRIP = "Trip";
 14 
 	
 15 
 	static final String TRIP_DESTINATION = "TripDestination";
 16 
 	static final String TRIP_START_TIME = "TripStartTime";
 17 
 	static final String ADJUSTED_SCHEDULE_TIME = "AdjustedScheduleTime";
 18 
 	static final String ADJUSTMENT_AGE = "AdjustmentAge";
 19 
 	static final String LAST_TRIP_OF_SCHEDULE = "LastTripOfSchedule";
 20 
 	static final String BUS_TYPE = "BusType";
 21 
 	static final String GPS_SPEED = "GPSSpeed";
 22 
 	static final String LATITUDE = "Latitude";
 23 
 	static final String LONGITUDE = "Longitude";
 24 
 	
 25 Block: 1/1 
 	static final String[] INTERNAL = { TRIP_DESTINATION,
 26 
 		                               TRIP_START_TIME,
 27 
 		                               ADJUSTED_SCHEDULE_TIME,
 28 
 		                               ADJUSTMENT_AGE,
 29 
 		                               LAST_TRIP_OF_SCHEDULE,
 30 
 		                               BUS_TYPE,
 31 
 		                               GPS_SPEED,
 32 
 		                               LATITUDE,
 33 
 		                               LONGITUDE };
 34 
 	static final Object[][] EXTERNAL = {};
 35 
 	
 36 
     String  m_dest;      // destination
 37 
     Date    m_start;     // time at which the trip started / is scheduled to start
 38 
     int     m_adjTime;   // minutes until bus is predicted to arrive
 39 
     double  m_adjAge;    // time since the last GPS data was received, in minutes (possibly fractional)
 40 
     boolean m_lastTrip;  // is this the last scheduled trip of the day?
 41 
     String  m_busType;   // type of bus
 42 
     double  m_speed;     // speed (km/h) when last polled
 43 
     double  m_long;      // longitude
 44 
     double  m_lat;       // latitude
 45 
     
 46 
     DateFormat m_dateFormat;
 47 
     Date       m_constructed;	// DateTime when this object was constructed
 48 
 
 49 
     public Trip() {
 50 Block: 1/1 
     	super(TRIP, INTERNAL, EXTERNAL);
 51 
     	m_dest = "";
 52 
     	m_start = new Date();
 53 
     	m_adjTime = 0;
 54 
     	m_adjAge = 0.0;
 55 
     	m_lastTrip = false;
 56 
     	m_busType = "";
 57 
     	m_speed = 0.0;
 58 
     	m_long = 0.0;
 59 
     	m_lat = 0.0;
 60 
     	
 61 
     	m_dateFormat = new SimpleDateFormat("hh:mm");
 62 
     	m_constructed = new Date();
 63 
     }
 64 
     
 65 
     public Trip(Trip other) {
 66 Block: 1/1 
     	super(TRIP, INTERNAL, EXTERNAL);
 67 
     	m_dest = other.m_dest;
 68 
     	m_start = other.m_start;
 69 
     	m_adjTime = other.m_adjTime;
 70 
     	m_adjAge = other.m_adjAge;
 71 
     	m_lastTrip = other.m_lastTrip;
 72 
     	m_busType = other.m_busType;
 73 
     	m_speed = other.m_speed;
 74 
     	m_long = other.m_long;
 75 
     	m_lat = other.m_lat;
 76 
     	m_constructed = other.m_constructed;
 77 
 	}
 78 
 
 79 Block: 1/1 
 	public String getDest() { return m_dest; }
 80 Block: 1/1 
     public Date getStart() { return m_start; }
 81 Block: 1/1 
     public int getAdjTime() { return m_adjTime; }
 82 Block: 1/1 
     public double getAdjAge() { return m_adjAge; }
 83 Block: 1/1 
     public boolean isLastTrip() { return m_lastTrip; }
 84 Block: 1/1 
     public String getBusType() { return m_busType; }
 85 Block: 1/1 
     public double getSpeed() { return m_speed; }
 86 Block: 1/1 
     public double getLongitude() { return m_long; }
 87 Block: 1/1 
     public double getLatitude() { return m_lat; }
 88 
     
 89 
     // Estimated (Date)Time of Arrival of this trip at the stop 
 90 Block: 1/1 
     public Date getETA() { return new Date(m_constructed.getTime() + (long)(1000 * 60 * m_adjTime)); }
 91 
     
 92 
     // (Date)Time when the GPS for this bus was last read
 93 Block: 1/1 
     public Date getGPSTime() { return new Date(m_constructed.getTime() - (long)(1000 * 60 * m_adjAge)); } 
 94 
 
 95 
     // ---------------------------
 96 
     // ParseResult implementation:
 97 
     
 98 
 	@Override
 99 
 	public void endContents(String uri, String localName, String qName,	String chars) throws XmlParseException 
 100 
 	{
 101 
 		try {
 102 Block: 1/1 
 			if (TRIP_DESTINATION.equals(localName)) {
 103 Block: 1/1 Branch: 1/1 
 				m_dest = chars;
 104 
 			}
 105 Block: 1/1 Branch: 1/1 
 			else if (TRIP_START_TIME.equals(localName)) {
 106 Block: 1/1 Branch: 1/1 
 				m_start = m_dateFormat.parse(chars);
 107 
 			}
 108 Block: 1/1 Branch: 1/1 
 			else if (ADJUSTED_SCHEDULE_TIME.equals(localName)) {
 109 Block: 1/1 Branch: 1/1 
 				m_adjTime = ParseUtils.parseInt(chars);
 110 
 			}
 111 Block: 1/1 Branch: 1/1 
 			else if (ADJUSTMENT_AGE.equals(localName)) {
 112 Block: 1/1 Branch: 1/1 
 				m_adjAge = ParseUtils.parseDouble(chars);
 113 
 			}
 114 Block: 1/1 Branch: 1/1 
 			else if (LAST_TRIP_OF_SCHEDULE.equals(localName)) {
 115 Block: 1/1 Branch: 1/1 
 				m_lastTrip = Boolean.parseBoolean(chars);
 116 
 			}
 117 Block: 1/1 Branch: 1/1 
 			else if (BUS_TYPE.equals(localName)) {
 118 Block: 1/1 Branch: 1/1 
 				m_busType = chars;
 119 
 			}
 120 Block: 1/1 Branch: 1/1 
 			else if (GPS_SPEED.equals(localName)) {
 121 Block: 1/1 Branch: 1/1 
 				m_speed = ParseUtils.parseDouble(chars);
 122 
 			}
 123 Block: 1/1 Branch: 1/1 
 			else if (LONGITUDE.equals(localName)) {
 124 Block: 1/1 Branch: 1/1 
 				m_long = ParseUtils.parseDouble(chars);
 125 
 			}
 126 Block: 1/1 Branch: 1/1 
 			else if (LATITUDE.equals(localName)) {
 127 Block: 1/1 Branch: 1/1 
 				m_lat = ParseUtils.parseDouble(chars);
 128 
 			}
 129 Block: 0/1 
 		} catch (ParseException pe) {
 130 
 			throw new XmlParseException(pe);
 131 Block: 1/1 Branch: 0/1 
 		}
 132 Block: 1/1 
 	}
 133 
 	
 134 
 	@Override
 135 
 	public void endExternal(String uri, String localName, String qName) throws XmlParseException
 136 
 	{
 137 
 		// no externally-parsed children
 138 Block: 0/1 
 	}
 139 
 }
 140 
 
-

-

Report generated 11/12/14 11:31 PM
- -