use TextUtils.equals in new equals() overrides

This commit is contained in:
Eric House 2017-08-02 07:00:34 -07:00
parent 4ec930d53c
commit 455b6e79f0
4 changed files with 20 additions and 34 deletions

View file

@ -25,6 +25,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import java.io.InputStream; import java.io.InputStream;
import java.io.Serializable; import java.io.Serializable;
@ -328,24 +329,17 @@ public class NetLaunchInfo implements Serializable {
boolean result = null != obj && obj instanceof NetLaunchInfo; boolean result = null != obj && obj instanceof NetLaunchInfo;
if ( result ) { if ( result ) {
other = (NetLaunchInfo)obj; other = (NetLaunchInfo)obj;
result = ((null == gameName) ? (null == other.gameName) result = TextUtils.equals( gameName, other.gameName )
: gameName.equals(other.gameName)) && TextUtils.equals( dict, other.dict )
&& ((null == dict) ? (null == other.dict)
: dict.equals(other.dict))
&& lang == other.lang && lang == other.lang
&& forceChannel == other.forceChannel && forceChannel == other.forceChannel
&& nPlayersT == other.nPlayersT && nPlayersT == other.nPlayersT
&& nPlayersH == other.nPlayersH && nPlayersH == other.nPlayersH
&& ((null == room) ? (null == other.room) && TextUtils.equals( room, other.room )
: room.equals(other.room)) && TextUtils.equals( btName, other.btName )
&& ((null == btName) ? (null == other.btName) && TextUtils.equals( btAddress, other.btAddress )
: btName.equals(other.btName)) && TextUtils.equals( p2pMacAddress, other.p2pMacAddress )
&& ((null == btAddress) ? (null == other.btAddress) && TextUtils.equals( phone, other.phone )
: btAddress.equals(other.btAddress))
&& ((null == p2pMacAddress) ? (null == other.p2pMacAddress)
: p2pMacAddress.equals(other.p2pMacAddress))
&& ((null == phone) ? (null == other.phone)
: phone.equals(other.phone))
&& isGSM == other. isGSM && isGSM == other. isGSM
&& osVers == other.osVers && osVers == other.osVers
&& _conTypes == other._conTypes && _conTypes == other._conTypes
@ -353,8 +347,7 @@ public class NetLaunchInfo implements Serializable {
&& ((null == m_addrs ? (null == other.m_addrs) && ((null == m_addrs ? (null == other.m_addrs)
: m_addrs.equals(other.m_addrs))) : m_addrs.equals(other.m_addrs)))
&& m_valid == other.m_valid && m_valid == other.m_valid
&& ((null == inviteID ? (null == other.inviteID) && TextUtils.equals( inviteID, other.inviteID )
: inviteID.equals(other.inviteID)))
; ;
} }
return result; return result;

View file

@ -21,6 +21,7 @@
package org.eehouse.android.xw4.jni; package org.eehouse.android.xw4.jni;
import android.content.Context; import android.content.Context;
import android.text.TextUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;
@ -294,14 +295,12 @@ public class CurGameInfo implements Serializable {
&& allowHintRect == other.allowHintRect && allowHintRect == other.allowHintRect
&& m_smartness == other.m_smartness && m_smartness == other.m_smartness
&& Arrays.deepEquals( players, other.players ) && Arrays.deepEquals( players, other.players )
&& ((null == dictName) ? (null == other.dictName) && TextUtils.equals( dictName, other.dictName )
: dictName.equals(other.dictName))
&& ((null == serverRole) ? (null == other.serverRole) && ((null == serverRole) ? (null == other.serverRole)
: serverRole.equals(other.serverRole)) : serverRole.equals(other.serverRole))
&& ((null == phoniesAction) ? (null == other.phoniesAction) && ((null == phoniesAction) ? (null == other.phoniesAction)
: phoniesAction.equals(other.phoniesAction)) : phoniesAction.equals(other.phoniesAction))
&& ((null == m_name) ? (null == other.m_name) && TextUtils.equals( m_name, other.m_name )
: m_name.equals(other.m_name))
; ;
} }
} else { } else {

View file

@ -125,22 +125,18 @@ public class GameSummary implements Serializable {
&& Arrays.equals( m_players, other.m_players ) && Arrays.equals( m_players, other.m_players )
&& ((null == conTypes) ? (null == other.conTypes) && ((null == conTypes) ? (null == other.conTypes)
: conTypes.equals(other.conTypes)) : conTypes.equals(other.conTypes))
&& ((null == roomName) ? (null == other.roomName) && TextUtils.equals( roomName, other.roomName )
: roomName.equals(other.roomName)) && TextUtils.equals( relayID, other.relayID )
&& ((null == relayID) ? (null == other.relayID)
: relayID.equals(other.relayID))
&& Arrays.equals( remoteDevs, other.remoteDevs ) && Arrays.equals( remoteDevs, other.remoteDevs )
&& ((null == serverRole) ? (null == other.serverRole) && ((null == serverRole) ? (null == other.serverRole)
: serverRole.equals(other.serverRole)) : serverRole.equals(other.serverRole))
&& ((null == m_giFlags) ? (null == other.m_giFlags) && ((null == m_giFlags) ? (null == other.m_giFlags)
: m_giFlags.equals(other.m_giFlags)) : m_giFlags.equals(other.m_giFlags))
&& ((null == m_playersSummary) ? (null == other.m_playersSummary) && TextUtils.equals( m_playersSummary, other.m_playersSummary )
: m_playersSummary.equals(other.m_playersSummary))
&& ((null == m_gi) ? (null == other.m_gi) && ((null == m_gi) ? (null == other.m_gi)
: m_gi.equals(other.m_gi)) : m_gi.equals(other.m_gi))
&& Arrays.equals( m_remotePhones, other.m_remotePhones ) && Arrays.equals( m_remotePhones, other.m_remotePhones )
&& ((null == m_extras) ? (null == other.m_extras) && TextUtils.equals( m_extras, other.m_extras )
: m_extras.equals(other.m_extras))
; ;
} }
} else { } else {

View file

@ -21,6 +21,7 @@
package org.eehouse.android.xw4.jni; package org.eehouse.android.xw4.jni;
import android.content.Context; import android.content.Context;
import android.text.TextUtils;
import java.io.Serializable; import java.io.Serializable;
@ -73,12 +74,9 @@ public class LocalPlayer implements Serializable {
result = secondsUsed == other.secondsUsed result = secondsUsed == other.secondsUsed
&& robotIQ == other.robotIQ && robotIQ == other.robotIQ
&& isLocal == other.isLocal && isLocal == other.isLocal
&& ((null == name) ? (null == other.name) && TextUtils.equals( name, other.name )
: name.equals(other.name)) && TextUtils.equals( password, other.password )
&& ((null == password) ? (null == other.password) && TextUtils.equals( dictName, other.dictName )
: password.equals(other.password))
&& ((null == dictName) ? (null == other.dictName)
: dictName.equals(other.dictName))
; ;
} }
} else { } else {