am 13e2b053: am 64c65ce6: Add missing MoreKeySpec.hashCode

* commit '13e2b0539517aff08d23f5f8af1e833c7b7af18e':
  Add missing MoreKeySpec.hashCode
main
Tadashi G. Takaoka 2012-09-12 15:35:59 -07:00 committed by Android Git Automerger
commit 856834d2d3
1 changed files with 26 additions and 1 deletions

View File

@ -16,12 +16,14 @@
package com.android.inputmethod.keyboard.internal; package com.android.inputmethod.keyboard.internal;
import android.text.TextUtils;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.latin.StringUtils; import com.android.inputmethod.latin.StringUtils;
import java.util.Locale; import java.util.Locale;
public class MoreKeySpec { public final class MoreKeySpec {
public final int mCode; public final int mCode;
public final String mLabel; public final String mLabel;
public final String mOutputText; public final String mOutputText;
@ -46,6 +48,29 @@ public class MoreKeySpec {
mIconId = KeySpecParser.getIconId(moreKeySpec); mIconId = KeySpecParser.getIconId(moreKeySpec);
} }
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 + mCode;
hashCode = hashCode * 31 + mIconId;
hashCode = hashCode * 31 + (mLabel == null ? 0 : mLabel.hashCode());
hashCode = hashCode * 31 + (mOutputText == null ? 0 : mOutputText.hashCode());
return hashCode;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o instanceof MoreKeySpec) {
final MoreKeySpec other = (MoreKeySpec)o;
return mCode == other.mCode
&& mIconId == other.mIconId
&& TextUtils.equals(mLabel, other.mLabel)
&& TextUtils.equals(mOutputText, other.mOutputText);
}
return false;
}
@Override @Override
public String toString() { public String toString() {
final String label = (mIconId == KeyboardIconsSet.ICON_UNDEFINED ? mLabel final String label = (mIconId == KeyboardIconsSet.ICON_UNDEFINED ? mLabel