1 /*
2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 package utils;
24 
25 import java.util.LinkedList;
26 
27 /**
28  *
29  * Represents method info string
30  *
31  */
32 public class MethodInfo {
33 
34     private String name;
35     private String compilationUnit;
36     private String args;
37     private String bci;
38     private String line;
39     private String frameType;
40 
41     private LinkedList<MonitorInfo> locks = new LinkedList<MonitorInfo>();
42 
getName()43     public String getName() {
44         return name;
45     }
46 
setName(String name)47     public void setName(String name) {
48         this.name = name;
49     }
50 
getCompilationUnit()51     public String getCompilationUnit() {
52         return compilationUnit;
53     }
54 
setCompilationUnit(String compilationUnit)55     public void setCompilationUnit(String compilationUnit) {
56         this.compilationUnit = compilationUnit;
57     }
58 
getArgs()59     public String getArgs() {
60         return args;
61     }
62 
setArgs(String args)63     public void setArgs(String args) {
64         this.args = args;
65     }
66 
getBci()67     public String getBci() {
68         return bci;
69     }
70 
setBci(String bci)71     public void setBci(String bci) {
72         this.bci = bci;
73     }
74 
getLine()75     public String getLine() {
76         return line;
77     }
78 
setLine(String line)79     public void setLine(String line) {
80         this.line = line;
81     }
82 
getFrameType()83     public String getFrameType() {
84         return frameType;
85     }
86 
setFrameType(String frameType)87     public void setFrameType(String frameType) {
88         this.frameType = frameType;
89     }
90 
getLocks()91     public LinkedList<MonitorInfo> getLocks() {
92         return locks;
93     }
94 
setLocks(LinkedList<MonitorInfo> locks)95     public void setLocks(LinkedList<MonitorInfo> locks) {
96         this.locks = locks;
97     }
98 
equals(MethodInfo another)99     public boolean equals(MethodInfo another) {
100 
101         boolean result = true;
102 
103         if (!Utils.compareStrings(name, another.name)) {
104             Utils.log("name", name, another.name);
105             result = false;
106         }
107 
108         if (!Utils.compareStrings(compilationUnit, another.compilationUnit)) {
109             Utils.log("compilationUnit", compilationUnit, another.compilationUnit);
110             result = false;
111         }
112 
113         /*
114          if (!Utils.compareStrings(args, another.args)) {
115          Utils.log("args", args, another.args);
116          result = false;
117          }
118 
119          if (!Utils.compareStrings(bci, another.bci)) {
120          Utils.log("bci", bci, another.bci);
121          result = false;
122          }
123 
124          if (!Utils.compareStrings(frameType, another.frameType)) {
125          Utils.log("frameType", frameType, another.frameType);
126          result = false;
127          }
128          */
129         if (!Utils.compareStrings(line, another.line)) {
130             Utils.log("line", line, another.line);
131             result = false;
132         }
133 
134         return result;
135     }
136 
137 }
138