X-Git-Url: http://jaekl.net/gitweb/?p=frank.git;a=blobdiff_plain;f=report%2Fnet%2Fjaekl%2Ffrank%2FSchedule.html;fp=report%2Fnet%2Fjaekl%2Ffrank%2FSchedule.html;h=0000000000000000000000000000000000000000;hp=3e971d1288f45c3e5f30766dcab57dde42508b55;hb=c35af9e511e8390a66ca76331c3af43d0f0f7464;hpb=24f097b0fe78fa44f99b9f6f2e51a8e689d86a4a
diff --git a/report/net/jaekl/frank/Schedule.html b/report/net/jaekl/frank/Schedule.html
deleted file mode 100644
index 3e971d1..0000000
--- a/report/net/jaekl/frank/Schedule.html
+++ /dev/null
@@ -1,876 +0,0 @@
-
-
-
-
- 1 |
- |
- package net.jaekl.frank; |
-
-
- 2 |
- |
- |
-
-
- 3 |
- |
- import java.io.PrintWriter; |
-
-
- 4 |
- |
- import java.text.DateFormat; |
-
-
- 5 |
- |
- import java.text.MessageFormat; |
-
-
- 6 |
- |
- import java.text.SimpleDateFormat; |
-
-
- 7 |
- |
- import java.util.Date; |
-
-
- 8 |
- |
- import java.util.Locale; |
-
-
- 9 |
- |
- |
-
-
- 10 |
- |
- import net.jaekl.frank.octranspo.Route; |
-
-
- 11 |
- |
- import net.jaekl.frank.octranspo.StopInfo; |
-
-
- 12 |
- |
- import net.jaekl.frank.octranspo.Trip; |
-
-
- 13 |
- |
- |
-
-
- 14 |
- |
- public class Schedule { |
-
-
- 15 |
- |
- Locale m_locale; |
-
-
- 16 |
- |
- FrankBundle m_bundle; |
-
-
- 17 |
- |
- DateFormat m_hourMinFmt; |
-
-
- 18 |
- |
- DateFormat m_hourMinSecFmt; |
-
-
- 19 |
- |
- |
-
-
- 20 |
- Block: 1/1 |
- public Schedule(Locale locale) { |
-
-
- 21 |
- |
- m_locale = locale; |
-
-
- 22 |
- |
- m_bundle = FrankBundle.getInst(locale); |
-
-
- 23 |
- |
- m_hourMinFmt = new SimpleDateFormat("hh:mma", locale); |
-
-
- 24 |
- |
- m_hourMinSecFmt = new SimpleDateFormat("hh:mm:ssa", locale); |
-
-
- 25 |
- |
- } |
-
-
- 26 |
- |
- |
-
-
- 27 |
- |
- String trans(String key) { |
-
-
- 28 |
- Block: 1/1 |
- return m_bundle.get(key); |
-
-
- 29 |
- |
- } |
-
-
- 30 |
- |
- |
-
-
- 31 |
- |
- String mapUrl(double latitude, double longitude) { |
-
-
- 32 |
- Block: 1/1 |
- return "http://www.openstreetmap.org/?mlat=" + latitude + "&mlon=" + longitude + "&zoom=15"; |
-
-
- 33 |
- |
- } |
-
-
- 34 |
- |
- |
-
-
- 35 |
- |
- void writeStyle(PrintWriter pw) { |
-
-
- 36 |
- Block: 1/1 |
- pw.println("<STYLE>"); |
-
-
- 37 |
- |
- pw.println(" body {background-color: #F0F0C0; font-size: 1.5em; }"); |
-
-
- 38 |
- |
- pw.println(" #trips {border-collapse: collapse; font-size: 1.5em; }"); |
-
-
- 39 |
- |
- pw.println(" #trips td, #trips th {border: 1px solid #600000; padding: 3px 3px 3px 3px; text-align: center;}"); |
-
-
- 40 |
- |
- pw.println(" #trips th {background-color: #800000; color: #FFFFFF; }"); |
-
-
- 41 |
- |
- pw.println(" #trips tr.ghost td {background-color: #C0C0C0;}"); |
-
-
- 42 |
- |
- pw.println("</STYLE>"); |
-
-
- 43 |
- |
- } |
-
-
- 44 |
- |
- |
-
-
- 45 |
- |
- |
-
-
- 46 |
- |
- void writeScript(PrintWriter pw, String remainArray, int remainCount) { |
-
-
- 47 |
- Block: 1/1 |
- String min = trans(FrankBundle.MINUTES); |
-
-
- 48 |
- |
- String sec = trans(FrankBundle.SECONDS); |
-
-
- 49 |
- |
- |
-
-
- 50 |
- |
- pw.println("<SCRIPT>"); |
-
-
- 51 |
- |
- pw.println("var start; var interval; var remain;"); |
-
-
- 52 |
- |
- pw.println("window.onload = function() { start = new Date(); interval = setInterval(\"Tick()\", 1000); remain = " + remainArray + "; }"); |
-
-
- 53 |
- |
- pw.println("function Tick() { "); |
-
-
- 54 |
- |
- pw.println(" var now = new Date(); var delta = Math.floor((now.getTime() - start.getTime()) / 1000); "); |
-
-
- 55 |
- |
- pw.println(" var secs = delta % 60; var mins = Math.floor(delta / 60);"); |
-
-
- 56 |
- |
- pw.println(" document.getElementById(\"elapsed\").innerHTML = mins + \"" + min + " \" + secs + \"" + sec + "\""); |
-
-
- 57 |
- |
- pw.println(" for (var i = 0; i < " + remainCount + "; ++i) {"); |
-
-
- 58 |
- |
- pw.println(" var id = \"in_\" + i;"); |
-
-
- 59 |
- |
- pw.println(" var element = document.getElementById(id);"); |
-
-
- 60 |
- |
- pw.println(" var remain_delta = (remain[i] * 60) + 30 - delta;"); |
-
-
- 61 |
- |
- pw.println(" if (remain_delta <= 0) {"); |
-
-
- 62 |
- |
- pw.println(" element.innerHTML = \"----\""); |
-
-
- 63 |
- |
- pw.println(" } else {"); |
-
-
- 64 |
- |
- pw.println(" element.innerHTML = (Math.floor(remain_delta / 60)) + \"" + trans(min) + "\""); |
-
-
- 65 |
- |
- pw.println(" }"); |
-
-
- 66 |
- |
- pw.println(" }"); |
-
-
- 67 |
- |
- pw.println("}"); |
-
-
- 68 |
- |
- pw.println("</SCRIPT>"); |
-
-
- 69 |
- |
- |
-
-
- 70 |
- |
- } |
-
-
- 71 |
- |
- |
-
-
- 72 |
- |
- void writeHeader(PrintWriter pw, String title) { |
-
-
- 73 |
- Block: 1/1 |
- pw.println("<HTML>"); |
-
-
- 74 |
- |
- pw.println("<HEAD>"); |
-
-
- 75 |
- |
- pw.println("<TITLE>" + title + "</TITLE>"); |
-
-
- 76 |
- |
- writeStyle(pw); |
-
-
- 77 |
- |
- pw.println("</HEAD>"); |
-
-
- 78 |
- |
- } |
-
-
- 79 |
- |
- |
-
-
- 80 |
- |
- void writePage(PrintWriter pw, StopInfo stopInfo) |
-
-
- 81 |
- |
- { |
-
-
- 82 |
- Block: 1/1 |
- StringBuilder remainArray = new StringBuilder("[ "); |
-
-
- 83 |
- |
- int remainCount = 0; |
-
-
- 84 |
- |
- |
-
-
- 85 |
- |
- String title = stopInfo.getDescr() + " (" + stopInfo.getStopNo() + ")"; |
-
-
- 86 |
- |
- String min = trans(FrankBundle.MINUTES); |
-
-
- 87 |
- |
- |
-
-
- 88 |
- |
- writeHeader(pw, trans(FrankBundle.FRANK) + ": " + title); |
-
-
- 89 |
- |
- |
-
-
- 90 |
- |
- pw.println("<BODY>"); |
-
-
- 91 |
- |
- pw.println(" <TABLE ID=\"trips\">"); |
-
-
- 92 |
- |
- pw.println(" <TR><TH COLSPAN=\ř\">" + title + "</TH></TR>"); |
-
-
- 93 |
- |
- pw.println(" <TR><TH>" + |
-
-
- 94 |
- |
- trans(FrankBundle.ROUTE) + |
-
-
- 95 |
- |
- "</TH><TH>" + |
-
-
- 96 |
- |
- trans(FrankBundle.DESTINATION) + |
-
-
- 97 |
- |
- "</TH><TH>" + |
-
-
- 98 |
- |
- trans(FrankBundle.ETA) + |
-
-
- 99 |
- |
- "</TH><TH>" + |
-
-
- 100 |
- |
- trans(FrankBundle.REMAIN) + |
-
-
- 101 |
- |
- "</TH><TH>" + |
-
-
- 102 |
- |
- trans(FrankBundle.GPS_READ) + |
-
-
- 103 |
- |
- "</TH>"); |
-
-
- 104 |
- |
- |
-
-
- 105 |
- Block: 1/1 Branch: 1/1 |
- for (int routeIdx = 0; routeIdx < stopInfo.getNumRoutes(); ++routeIdx) { |
-
-
- 106 |
- Block: 1/1 Branch: 1/1 |
- Route route = stopInfo.getRoute(routeIdx); |
-
-
- 107 |
- |
- for (int tripIdx = 0; tripIdx < route.getNumTrips(); ++tripIdx) { |
-
-
- 108 |
- Block: 1/1 Branch: 1/1 |
- Trip trip = route.getTrip(tripIdx); |
-
-
- 109 |
- |
- boolean isGhost = ((-1) == trip.getAdjAge()); |
-
-
- 110 |
- Block: 1/1 |
- if (isGhost) { |
-
-
- 111 |
- |
- |
-
-
- 112 |
- Block: 0/1 Branch: 0/1 |
- pw.println(" <TR CLASS=\"ghost\">"); |
-
-
- 113 |
- |
- } else { |
-
-
- 114 |
- Block: 1/1 Branch: 1/1 |
- pw.println(" <TR>"); |
-
-
- 115 |
- |
- } |
-
-
- 116 |
- Block: 1/1 |
- pw.println(" <TD>" + route.getRouteNo() + "</TD>"); |
-
-
- 117 |
- |
- pw.println(" <TD>" + trip.getDest() + "</TD>"); |
-
-
- 118 |
- |
- pw.println(" <TD>" + m_hourMinFmt.format(trip.getETA()) + "</TD>"); |
-
-
- 119 |
- |
- |
-
-
- 120 |
- |
- pw.println(" <TD><SPAN ID=\"in_" + remainCount + "\">"+ trip.getAdjTime()+min+"</SPAN></TD>"); |
-
-
- 121 |
- |
- if (remainCount > 0) { |
-
-
- 122 |
- Block: 1/1 Branch: 1/1 |
- remainArray.append(", "); |
-
-
- 123 |
- |
- } |
-
-
- 124 |
- Block: 1/1 Branch: 1/1 |
- remainArray.append(trip.getAdjTime()); |
-
-
- 125 |
- |
- remainCount++; |
-
-
- 126 |
- |
- |
-
-
- 127 |
- |
- if (trip.getAdjAge() < 0) { |
-
-
- 128 |
- Block: 0/1 Branch: 0/1 |
- pw.println(" <TD>" + trans(FrankBundle.GPS_OFF) + "</TD>"); |
-
-
- 129 |
- |
- } |
-
-
- 130 |
- |
- else { |
-
-
- 131 |
- Block: 1/1 Branch: 1/1 |
- pw.println(" <TD><A HREF=\"" + mapUrl(trip.getLatitude(), trip.getLongitude()) + |
-
-
- 132 |
- |
- "\">" + m_hourMinSecFmt.format(trip.getGPSTime()) + "</A></TD>"); |
-
-
- 133 |
- |
- } |
-
-
- 134 |
- Block: 1/1 |
- pw.println(" </TR>"); |
-
-
- 135 |
- |
- } |
-
-
- 136 |
- |
- } |
-
-
- 137 |
- |
- |
-
-
- 138 |
- Block: 1/1 Branch: 1/1 |
- pw.println(" </TABLE>"); |
-
-
- 139 |
- |
- |
-
-
- 140 |
- |
- String dataCollectedFormat = trans(FrankBundle.DATA_COLLECTED); |
-
-
- 141 |
- |
- String dataCollected = MessageFormat.format(dataCollectedFormat, m_hourMinSecFmt.format(new Date())); |
-
-
- 142 |
- |
- pw.println(" <P>" + dataCollected + "</P>"); |
-
-
- 143 |
- |
- |
-
-
- 144 |
- |
- remainArray.append(" ]"); |
-
-
- 145 |
- |
- writeScript(pw, remainArray.toString(), remainCount); |
-
-
- 146 |
- |
- pw.println("</BODY></HTML>"); |
-
-
- 147 |
- |
- } |
-
-
- 148 |
- |
- } |
-
-
-