001package gwt.material.design.client.base;
002
003/*
004 * #%L GwtMaterial %% Copyright (C) 2015 GwtMaterialDesign %% Licensed under the Apache License,
005 * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
006 * may obtain a copy of the License at
007 * 
008 * http://www.apache.org/licenses/LICENSE-2.0
009 * 
010 * Unless required by applicable law or agreed to in writing, software distributed under the License
011 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012 * or implied. See the License for the specific language governing permissions and limitations under
013 * the License. #L%
014 */
015
016import com.google.gwt.user.client.ui.MultiWordSuggestOracle.MultiWordSuggestion;
017
018public class Suggestion extends MultiWordSuggestion {
019  private String suggestion;
020  private String display;
021
022  public Suggestion() {
023  }
024
025  public Suggestion(String display, String suggestion) {
026    this.display = display;
027    this.setSuggestion(suggestion);
028  }
029
030  @Override
031  public String getDisplayString() {
032    return (display);
033  }
034
035  @Override
036  public String getReplacementString() {
037    return display;
038  }
039
040  /**
041   * @return the display
042   */
043  public String getDisplay() {
044    return display;
045  }
046
047  /**
048   * @param display the display to set
049   */
050  public void setDisplay(String display) {
051    this.display = display;
052  }
053
054  /**
055   * @return the suggestion
056   */
057  public String getSuggestion() {
058    return suggestion;
059  }
060
061  /**
062   * @param suggestion the suggestion to set
063   */
064  public void setSuggestion(String suggestion) {
065    this.suggestion = suggestion;
066  }
067
068  @Override
069  public boolean equals(Object obj) {
070    if (obj == this) {
071      return true;
072    }
073    if (obj instanceof Suggestion) {
074      Suggestion that = (Suggestion) obj;
075      if (this.display != null && this.suggestion != null) {
076        return this.display.equals(that.display) && this.suggestion.equals(that.suggestion);
077      }
078    }
079    return false;
080  }
081
082  @Override
083  public int hashCode() {
084    return String.valueOf(display).hashCode() + String.valueOf(suggestion).hashCode();
085  }
086}