package collections.sortable;

import java.text.Collator;
import java.util.Locale;

public class ComparableString implements
        Comparable2 {
  String str = null;
  Collator collator =
      Collator.getInstance(
          Locale.ENGLISH);

  ComparableString(String _s) {
    str = _s;
  }

  public boolean equals(Object other) {
    String s = (String) other;
    return s.equals(str);
  }

  public boolean isLess(Object other) {
    String s = (String) other;
    return (collator.compare(str, s) < 0);

  }

  public boolean isGreater(Object other) {
    String s = (String) other;
    return (collator.compare(str, s) > 0);
  }

  public int hashCode() {
    return str.hashCode();
  }
}