Android: Convert SkylanderPair to Kotlin

This commit is contained in:
Charles Lombardo 2023-03-01 17:13:42 -05:00
parent 85b30f198b
commit 71e82d76b5
2 changed files with 15 additions and 54 deletions

View File

@ -1,54 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.skylanders.model;
import androidx.annotation.Nullable;
public class SkylanderPair
{
private int mId;
private int mVar;
public SkylanderPair(int id, int var)
{
mId = id;
mVar = var;
}
public int getId()
{
return mId;
}
public void setId(int mId)
{
this.mId = mId;
}
public int getVar()
{
return mVar;
}
public void setVar(int mVar)
{
this.mVar = mVar;
}
@Override public int hashCode()
{
return (mId << 16) + mVar;
}
@Override public boolean equals(@Nullable Object obj)
{
if (!(obj instanceof SkylanderPair))
return false;
SkylanderPair pairObj = (SkylanderPair) obj;
if (pairObj.getId() != mId)
return false;
if (pairObj.getVar() != mVar)
return false;
return true;
}
}

View File

@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.skylanders.model
class SkylanderPair(var id: Int, var variant: Int) {
override fun hashCode(): Int {
return (id shl 16) + variant
}
override fun equals(other: Any?): Boolean {
if (other !is SkylanderPair) return false
if (other.id != id) return false
return other.variant == variant
}
}