--- /dev/null
+package compbio.stat.servlet.util;\r
+\r
+import java.util.Date;\r
+import java.util.Map;\r
+\r
+import compbio.stat.collector.StatProcessor;\r
+import compbio.ws.client.Services;\r
+\r
+public class Totals {\r
+ int total;\r
+ int incomplete;\r
+ int abandoned;\r
+ int cancelled;\r
+ int failed;\r
+\r
+ public int getTotal() {\r
+ return total;\r
+ }\r
+\r
+ public int getIncomplete() {\r
+ return incomplete;\r
+ }\r
+\r
+ public int getAbandoned() {\r
+ return abandoned;\r
+ }\r
+\r
+ public int getCancelled() {\r
+ return cancelled;\r
+ }\r
+\r
+ public int getFailed() {\r
+ return failed;\r
+ }\r
+\r
+ public static Totals sumOfTotals(Map<Date, Totals> stat) {\r
+ Totals total = new Totals();\r
+ for (Map.Entry<Date, Totals> entry : stat.entrySet()) {\r
+ Totals mtotal = entry.getValue();\r
+ total.total += mtotal.getTotal();\r
+ total.incomplete += mtotal.getIncomplete();\r
+ total.abandoned += mtotal.getAbandoned();\r
+ total.cancelled += mtotal.getCancelled();\r
+ total.failed += mtotal.getFailed();\r
+ }\r
+ return total;\r
+ }\r
+\r
+ public static Totals sumStats(Map<Services, StatProcessor> stat) {\r
+ Totals total = new Totals();\r
+ for (Map.Entry<Services, StatProcessor> serv : stat.entrySet()) {\r
+ total.total += serv.getValue().getJobNumber();\r
+ total.incomplete += serv.getValue().getIncompleteJobs().size();\r
+ total.abandoned += serv.getValue().getAbandonedJobs().size();\r
+ total.cancelled += serv.getValue().getCancelledJobs().size();\r
+ total.failed += serv.getValue().getFailedJobs().size();\r
+ }\r
+ return total;\r
+ }\r
+}
\ No newline at end of file