1 /* 2 * Copyright (c) 2011, 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 jdk.vm.ci.meta; 24 25 public class LocalImpl implements Local { 26 27 private final String name; 28 private final int startBci; 29 private final int endBci; 30 private final int slot; 31 private final JavaType type; 32 33 public LocalImpl(String name, JavaType type, int startBci, int endBci, int slot) { 34 this.name = name; 35 this.startBci = startBci; 36 this.endBci = endBci; 37 this.slot = slot; 38 this.type = type; 39 } 40 41 @Override 42 public int getStartBCI() { 43 return startBci; 44 } 45 46 @Override 47 public int getEndBCI() { 48 return endBci; 49 } 50 51 @Override 52 public String getName() { 53 return name; 54 } 55 56 @Override 57 public JavaType getType() { 58 return type; 59 } 60 61 @Override 62 public int getSlot() { 63 return slot; 64 } 65 66 @Override 67 public boolean equals(Object obj) { 68 if (!(obj instanceof LocalImpl)) { 69 return false; 70 } 71 LocalImpl that = (LocalImpl) obj; 72 return this.name.equals(that.name) && this.startBci == that.startBci && this.endBci == that.endBci && this.slot == that.slot && this.type.equals(that.type); 73 } 74 75 @Override 76 public int hashCode() { 77 return super.hashCode(); 78 } 79 80 @Override 81 public String toString() { 82 return "LocalImpl<name=" + name + ", type=" + type + ", startBci=" + startBci + ", endBci=" + endBci + ", slot=" + slot + ">"; 83 } 84 }