diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java')
-rw-r--r-- | jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java deleted file mode 100644 index 1696c7c81..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Sybase, Inc. and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.pagedesigner.meta.internal; - -import java.util.Comparator; -import java.util.HashSet; - -import org.eclipse.jst.pagedesigner.properties.ITabbedPropertiesConstants; - -/** - * @author mengbo - */ -public class CategoryNameComparator implements Comparator { - static HashSet _pairs = new HashSet(); - - private static CategoryNameComparator _instance = new CategoryNameComparator(); - - static class Pair { - String s1; - - String s2; - - Pair(String a, String b) { - s1 = a; - s2 = b; - } - - public int hashCode() { - return s1.hashCode() + s2.hashCode(); - } - - public boolean equals(Object o) { - if (o instanceof Pair) { - Pair p = (Pair) o; - return s1.equals(p.s1) && s2.equals(p.s2); - } - return false; - } - } - - public static void addPair(String s1, String s2) { - _pairs.add(new Pair(s1, s2)); - } - - /* - * (non-Javadoc) - * - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(Object o1, Object o2) { - if (o1.equals(o2)) - return 0; - - if (ITabbedPropertiesConstants.OTHER_CATEGORY.equals(o1)) - return 1; - if (ITabbedPropertiesConstants.OTHER_CATEGORY.equals(o2)) - return -1; - - Pair p = new Pair((String) o1, (String) o2); - if (_pairs.contains(p)) - return -1; - return 1; - } - - public static CategoryNameComparator getInstance() { - return _instance; - } -} |