1 /* Copyright (c) 2011 Peter Troshin
\r
3 * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0
\r
5 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
6 * Apache License version 2 as published by the Apache Software Foundation
\r
8 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
10 * License for more details.
\r
12 * A copy of the license is in apache_license.txt. It is also available here:
\r
13 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
15 * Any republication or derived work distributed in source code form
\r
16 * must include this copyright and license notice.
\r
18 package compbio.stat.servlet.util;
\r
20 import java.util.Date;
\r
21 import java.util.Map;
\r
23 import compbio.stat.collector.StatProcessor;
\r
24 import compbio.ws.client.Services;
\r
26 public class Totals {
\r
33 public int getTotal() {
\r
37 public int getIncomplete() {
\r
41 public int getAbandoned() {
\r
45 public int getCancelled() {
\r
49 public int getFailed() {
\r
53 public static Totals sumOfTotals(Map<Date, Totals> stat) {
\r
54 Totals total = new Totals();
\r
55 for (Map.Entry<Date, Totals> entry : stat.entrySet()) {
\r
56 Totals mtotal = entry.getValue();
\r
57 total.total += mtotal.getTotal();
\r
58 total.incomplete += mtotal.getIncomplete();
\r
59 total.abandoned += mtotal.getAbandoned();
\r
60 total.cancelled += mtotal.getCancelled();
\r
61 total.failed += mtotal.getFailed();
\r
66 public static Totals sumStats(Map<Services, StatProcessor> stat) {
\r
67 Totals total = new Totals();
\r
68 for (Map.Entry<Services, StatProcessor> serv : stat.entrySet()) {
\r
69 total.total += serv.getValue().getJobNumber();
\r
70 total.incomplete += serv.getValue().getIncompleteJobs().size();
\r
71 total.abandoned += serv.getValue().getAbandonedJobs().size();
\r
72 total.cancelled += serv.getValue().getCancelledJobs().size();
\r
73 total.failed += serv.getValue().getFailedJobs().size();
\r