OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.content.browser.input; |
| 6 |
| 7 /** |
| 8 * Date/time suggestion container used to store information for each suggestion
that will be shown |
| 9 * in the suggestion list dialog. Keep in sync with date_time_suggestion.h. |
| 10 */ |
| 11 class DateTimeSuggestion { |
| 12 private final double mValue; |
| 13 private final String mLocalizedValue; |
| 14 private final String mLabel; |
| 15 |
| 16 /** |
| 17 * Constructs a color suggestion container. |
| 18 * @param value The suggested date/time value. |
| 19 * @param localizedValue The suggested value localized. |
| 20 * @param label The label for the suggestion. |
| 21 */ |
| 22 DateTimeSuggestion(double value, String localizedValue, String label) { |
| 23 mValue = value; |
| 24 mLocalizedValue = localizedValue; |
| 25 mLabel = label; |
| 26 } |
| 27 |
| 28 double value() { |
| 29 return mValue; |
| 30 } |
| 31 |
| 32 String localizedValue() { |
| 33 return mLocalizedValue; |
| 34 } |
| 35 |
| 36 String label() { |
| 37 return mLabel; |
| 38 } |
| 39 |
| 40 @Override |
| 41 public boolean equals(Object object) { |
| 42 if (!(object instanceof DateTimeSuggestion)) { |
| 43 return false; |
| 44 } |
| 45 final DateTimeSuggestion other = (DateTimeSuggestion) object; |
| 46 return mValue == other.mValue && |
| 47 mLocalizedValue == other.mLocalizedValue && |
| 48 mLabel == other.mLabel; |
| 49 } |
| 50 |
| 51 @Override |
| 52 public int hashCode() { |
| 53 int hash = 31; |
| 54 hash = 37 * hash + (int) mValue; |
| 55 hash = 37 * hash + mLocalizedValue.hashCode(); |
| 56 hash = 37 * hash + mLabel.hashCode(); |
| 57 return hash; |
| 58 } |
| 59 } |
OLD | NEW |