01: /*
02: * Copyright (C) 2007, 2008 XStream Committers.
03: * All rights reserved.
04: *
05: * The software in this package is published under the terms of the BSD
06: * style license a copy of which has been included with this distribution in
07: * the LICENSE.txt file.
08: *
09: * Created on 14. September 2007 by Joerg Schaible
10: */
11: package com.thoughtworks.xstream.tools.benchmark.reporters;
12:
13: import com.thoughtworks.xstream.tools.benchmark.Metric;
14: import com.thoughtworks.xstream.tools.benchmark.Product;
15: import com.thoughtworks.xstream.tools.benchmark.Reporter;
16: import com.thoughtworks.xstream.tools.benchmark.Target;
17:
18: /**
19: * A reporter multiplexing the results to other Reporters.
20: *
21: * @author Jörg Schaible
22: * @since 1.3
23: */
24: public class MultiReporter implements Reporter {
25:
26: private final Reporter[] reporter;
27:
28: public MultiReporter(Reporter[] reporter) {
29: this .reporter = reporter;
30: }
31:
32: public void endBenchmark() {
33: for (int i = 0; i < reporter.length; i++) {
34: reporter[i].endBenchmark();
35: }
36: }
37:
38: public void endMetric(Metric metric) {
39: for (int i = 0; i < reporter.length; i++) {
40: reporter[i].endMetric(metric);
41: }
42: }
43:
44: public void endTarget(Target target) {
45: for (int i = 0; i < reporter.length; i++) {
46: reporter[i].endTarget(target);
47: }
48: }
49:
50: public void metricFailed(Product product, Exception e) {
51: for (int i = 0; i < reporter.length; i++) {
52: reporter[i].metricFailed(product, e);
53: }
54: }
55:
56: public void metricRecorded(Product product, double result) {
57: for (int i = 0; i < reporter.length; i++) {
58: reporter[i].metricRecorded(product, result);
59: }
60: }
61:
62: public void startBenchmark() {
63: for (int i = 0; i < reporter.length; i++) {
64: reporter[i].startBenchmark();
65: }
66: }
67:
68: public void startMetric(Metric metric) {
69: for (int i = 0; i < reporter.length; i++) {
70: reporter[i].startMetric(metric);
71: }
72: }
73:
74: public void startTarget(Target target) {
75: for (int i = 0; i < reporter.length; i++) {
76: reporter[i].startTarget(target);
77: }
78: }
79:
80: }
|