01: //$Header$
02: /*
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: *
18: */
19: package org.apache.jmeter.report.writers;
20:
21: import java.util.ArrayList;
22: import java.util.Iterator;
23:
24: /**
25: * @author Peter Lin
26: *
27: * The default implementation of ReportSummary just contains the stats
28: * and basic information. It doesn't contain the actual report. In the
29: * future we may want to implement a version with all the details to
30: * display in a Swing GUI.
31: */
32: public class DefaultReportSummary implements ReportSummary {
33:
34: protected ArrayList pages = new ArrayList();
35:
36: /**
37: *
38: */
39: public DefaultReportSummary() {
40: super ();
41: }
42:
43: /**
44: * Add a PageSummary to the report
45: */
46: public void addPageSummary(PageSummary summary) {
47: this .pages.add(summary);
48: }
49:
50: /**
51: * current implementation simply iterates over the Page summaries
52: * and adds the times.
53: */
54: public long getElapsedTime() {
55: long elpasedTime = 0;
56: Iterator itr = this .pages.iterator();
57: while (itr.hasNext()) {
58: elpasedTime += ((PageSummary) itr.next()).getElapsedTime();
59: }
60: return elpasedTime;
61: }
62:
63: /**
64: * The current implementation calls ArrayList.toArray(Object[])
65: */
66: public PageSummary[] getPagesSummaries() {
67: PageSummary[] ps = new PageSummary[this .pages.size()];
68: return (PageSummary[]) this .pages.toArray(ps);
69: }
70:
71: /**
72: * remove a PageSummary
73: */
74: public void removePageSummary(PageSummary summary) {
75: this.pages.remove(summary);
76: }
77:
78: }
|