Пример #1
0
  /*
   * Sort the values, so that the default strategy is first
   * and the remaining strategies are sorted by name
   */
  public static List<SearchType> getSortedValues() {
    List<SearchType> list = new ArrayList<SearchType>();

    for (SearchType t : SearchType.values()) list.add(t);

    Collections.sort(
        list,
        new Comparator<SearchType>() {

          @Override
          public int compare(SearchType o1, SearchType o2) {
            if (o1.isDefault()) return -1;
            else if (o2.isDefault()) return 1;
            else return o1.humanReadableName.compareTo(o2.humanReadableName);
          }
        });

    return list;
  }
Пример #2
0
  public static SearchType getDefaultSearchType() {
    for (SearchType t : SearchType.values()) if (t.isDefaultSearchType) return t;

    return null;
  }