Android: Convert SkylanderPair to Kotlin
This commit is contained in:
parent
85b30f198b
commit
71e82d76b5
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue