13514
|
1 /*
|
|
2 * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. This
|
|
3 * code is released under a tri EPL/GPL/LGPL license. You can use it,
|
|
4 * redistribute it and/or modify it under the terms of the:
|
|
5 *
|
|
6 * Eclipse Public License version 1.0
|
|
7 * GNU General Public License version 2
|
|
8 * GNU Lesser General Public License version 2.1
|
|
9 */
|
|
10 package com.oracle.truffle.ruby.runtime.debug;
|
|
11
|
|
12 import com.oracle.truffle.ruby.runtime.methods.*;
|
|
13
|
|
14 /**
|
|
15 * A method and local variable identifier tuple.
|
|
16 */
|
|
17 public class MethodLocal {
|
|
18
|
|
19 private final UniqueMethodIdentifier method;
|
|
20 private final String local;
|
|
21
|
|
22 public MethodLocal(UniqueMethodIdentifier method, String local) {
|
|
23 super();
|
|
24 this.method = method;
|
|
25 this.local = local;
|
|
26 }
|
|
27
|
|
28 @Override
|
|
29 public String toString() {
|
|
30 return "MethodLocal [method=" + method + ", local=" + local + "]";
|
|
31 }
|
|
32
|
|
33 @Override
|
|
34 public int hashCode() {
|
|
35 final int prime = 31;
|
|
36 int result = 1;
|
|
37 result = prime * result + ((local == null) ? 0 : local.hashCode());
|
|
38 result = prime * result + ((method == null) ? 0 : method.hashCode());
|
|
39 return result;
|
|
40 }
|
|
41
|
|
42 @Override
|
|
43 public boolean equals(Object obj) {
|
|
44 if (this == obj) {
|
|
45 return true;
|
|
46 }
|
|
47 if (obj == null) {
|
|
48 return false;
|
|
49 }
|
|
50 if (!(obj instanceof MethodLocal)) {
|
|
51 return false;
|
|
52 }
|
|
53 MethodLocal other = (MethodLocal) obj;
|
|
54 if (local == null) {
|
|
55 if (other.local != null) {
|
|
56 return false;
|
|
57 }
|
|
58 } else if (!local.equals(other.local)) {
|
|
59 return false;
|
|
60 }
|
|
61 if (method == null) {
|
|
62 if (other.method != null) {
|
|
63 return false;
|
|
64 }
|
|
65 } else if (!method.equals(other.method)) {
|
|
66 return false;
|
|
67 }
|
|
68 return true;
|
|
69 }
|
|
70
|
|
71 }
|