001/*
002 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.
008 *
009 * This code is distributed in the hope that it will be useful, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
012 * version 2 for more details (a copy is included in the LICENSE file that
013 * accompanied this code).
014 *
015 * You should have received a copy of the GNU General Public License version
016 * 2 along with this work; if not, write to the Free Software Foundation,
017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
018 *
019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
020 * or visit www.oracle.com if you need additional information or have any
021 * questions.
022 */
023package jdk.internal.jvmci.meta;
024
025public class LocalImpl implements Local {
026
027    private final String name;
028    private final int startBci;
029    private final int endBci;
030    private final int slot;
031    private final JavaType type;
032
033    public LocalImpl(String name, JavaType type, int startBci, int endBci, int slot) {
034        this.name = name;
035        this.startBci = startBci;
036        this.endBci = endBci;
037        this.slot = slot;
038        this.type = type;
039    }
040
041    @Override
042    public int getStartBCI() {
043        return startBci;
044    }
045
046    @Override
047    public int getEndBCI() {
048        return endBci;
049    }
050
051    @Override
052    public String getName() {
053        return name;
054    }
055
056    @Override
057    public JavaType getType() {
058        return type;
059    }
060
061    @Override
062    public int getSlot() {
063        return slot;
064    }
065
066    @Override
067    public boolean equals(Object obj) {
068        if (!(obj instanceof LocalImpl)) {
069            return false;
070        }
071        LocalImpl that = (LocalImpl) obj;
072        return this.name.equals(that.name) && this.startBci == that.startBci && this.endBci == that.endBci && this.slot == that.slot && this.type.equals(that.type);
073    }
074
075    @Override
076    public int hashCode() {
077        return super.hashCode();
078    }
079
080    @Override
081    public String toString() {
082        return "LocalImpl<name=" + name + ", type=" + type + ", startBci=" + startBci + ", endBci=" + endBci + ", slot=" + slot + ">";
083    }
084}