1 | /* |
2 | * Copyright (c) 2001-2009, Jean Tessier |
3 | * All rights reserved. |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
8 | * |
9 | * * Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * |
12 | * * Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. |
15 | * |
16 | * * Neither the name of Jean Tessier nor the names of his contributors |
17 | * may be used to endorse or promote products derived from this software |
18 | * without specific prior written permission. |
19 | * |
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR |
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 | */ |
32 | |
33 | package com.jeantessier.metrics; |
34 | |
35 | import java.util.*; |
36 | |
37 | import com.jeantessier.classreader.*; |
38 | |
39 | public class MetricsEvent extends EventObject { |
40 | private Classfile classfile; |
41 | private Method_info method; |
42 | private Metrics metrics; |
43 | private int size; |
44 | |
45 | public MetricsEvent(Object source) { |
46 | this(source, null, null, null, 0); |
47 | } |
48 | |
49 | public MetricsEvent(Object source, Classfile classfile) { |
50 | this(source, classfile, null, null, 0); |
51 | } |
52 | |
53 | public MetricsEvent(Object source, Classfile classfile, Metrics metrics) { |
54 | this(source, classfile, null, metrics, 0); |
55 | } |
56 | |
57 | public MetricsEvent(Object source, Method_info method) { |
58 | this(source, method.getClassfile(), method, null, 0); |
59 | } |
60 | |
61 | public MetricsEvent(Object source, Method_info method, Metrics metrics) { |
62 | this(source, method.getClassfile(), method, metrics, 0); |
63 | } |
64 | |
65 | public MetricsEvent(Object source, int size) { |
66 | this(source, null, null, null, size); |
67 | } |
68 | |
69 | public MetricsEvent(Object source, Classfile classfile, Method_info method, Metrics metrics, int size) { |
70 | super(source); |
71 | |
72 | this.classfile = classfile; |
73 | this.method = method; |
74 | this.metrics = metrics; |
75 | this.size = size; |
76 | } |
77 | |
78 | public Classfile getClassfile() { |
79 | return classfile; |
80 | } |
81 | |
82 | public Method_info getMethod() { |
83 | return method; |
84 | } |
85 | |
86 | public Metrics getMetrics() { |
87 | return metrics; |
88 | } |
89 | |
90 | public int getSize() { |
91 | return size; |
92 | } |
93 | } |