00001 /* 00002 * This file is part of JXClient, the Fullscreen Java Crossfire Client. 00003 * 00004 * JXClient is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * JXClient is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with JXClient; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 * 00018 * Copyright (C) 2011 Nicolas Weeger. 00019 */ 00020 00021 package com.realtime.crossfire.jxclient.quests; 00022 00023 import java.io.Serializable; 00024 import java.util.Comparator; 00025 import org.jetbrains.annotations.NotNull; 00026 00031 public class QuestComparator implements Comparator<Quest>, Serializable { 00032 00036 private static final long serialVersionUID = 1; 00037 00041 @Override 00042 public int compare(@NotNull final Quest o1, @NotNull final Quest o2) { 00043 final int cmp = String.CASE_INSENSITIVE_ORDER.compare(o1.getTitle(), o2.getTitle()); 00044 if (cmp != 0) 00045 return cmp; 00046 00047 return (o1.getCode() < o2.getCode()) ? -1 : (o1.getCode() > o2.getCode() ? 1 : 0); 00048 } 00049 }