Fork of the Fernflower decompiler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fernflower/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionPair.java

49 lines
1.2 KiB

// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.java.decompiler.modules.decompiler.vars;
import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent;
public class VarVersionPair {
public final int var;
public final int version;
private int hashCode = -1;
public VarVersionPair(int var, int version) {
this.var = var;
this.version = version;
}
public VarVersionPair(Integer var, Integer version) {
this.var = var;
this.version = version;
}
public VarVersionPair(VarExprent var) {
this.var = var.getIndex();
this.version = var.getVersion();
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof VarVersionPair)) return false;
VarVersionPair paar = (VarVersionPair)o;
return var == paar.var && version == paar.version;
}
@Override
public int hashCode() {
if (hashCode == -1) {
hashCode = this.var * 3 + this.version;
}
return hashCode;
}
@Override
public String toString() {
return "(" + var + "," + version + ")";
}
}