[jboss-cvs] JBossCache/src/org/jboss/cache/optimistic ...
Manik Surtani
msurtani at jboss.com
Fri Dec 29 09:46:59 EST 2006
User: msurtani
Date: 06/12/29 09:46:59
Modified: src/org/jboss/cache/optimistic FqnComparator.java
Log:
Removed serializable
Revision Changes Path
1.6 +66 -58 JBossCache/src/org/jboss/cache/optimistic/FqnComparator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FqnComparator.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/optimistic/FqnComparator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- FqnComparator.java 8 Dec 2006 19:03:56 -0000 1.5
+++ FqnComparator.java 29 Dec 2006 14:46:59 -0000 1.6
@@ -7,52 +7,55 @@
package org.jboss.cache.optimistic;
import org.jboss.cache.Fqn;
-import java.io.Serializable;
+
import java.util.Comparator;
/**
* Compares the order of two FQN.
* Sorts by name, then by depth, e.g.
- <pre>
- aaa/bbb
- xxx
- xxx/ccc
- </pre>
+ * <pre>
+ * aaa/bbb
+ * xxx
+ * xxx/ccc
+ * </pre>
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @author Steve Woodcock (<a href="mailto:stevew at jofti.com">stevew at jofti.com</a>)
*/
-public class FqnComparator implements Comparator<Fqn>, Serializable {
-
- static final long serialVersionUID = -102183636437493134L;
-
+public class FqnComparator implements Comparator<Fqn>
+{
public static final FqnComparator INSTANCE = new FqnComparator();
/**
* Sorts by name, then depth.
*/
- public FqnComparator() {
+ public FqnComparator()
+ {
}
/**
* Returns -1 if the first comes before; 0 if they are the same; 1 if the
* second Fqn comes before. <code>null</code> always comes first.
*/
- public int compare(Fqn fqn1, Fqn fqn2) {
+ public int compare(Fqn fqn1, Fqn fqn2)
+ {
int s1 = fqn1.size();
int s2 = fqn2.size();
- if (s1 == 0) {
+ if (s1 == 0)
+ {
return (s2 == 0) ? 0 : -1;
}
- if (s2 == 0) {
+ if (s2 == 0)
+ {
return 1;
}
int size = Math.min(s1, s2);
- for (int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++)
+ {
Object e1 = fqn1.get(i);
Object e2 = fqn2.get(i);
if (e1 == e2)
@@ -61,7 +64,8 @@
return 0;
if (e2 == null)
return 1;
- if (!e1.equals(e2)) {
+ if (!e1.equals(e2))
+ {
int c = compareElements(e1, e2);
if (c != 0)
return c;
@@ -77,10 +81,14 @@
* returns e1.compareTo(e2).
* Otherwise, returns e1.toString().compareTo(e2.toString()).
*/
- protected int compareElements(Object e1, Object e2) {
- if (e1.getClass() == e2.getClass() && e1 instanceof Comparable) {
- return ((Comparable)e1).compareTo(e2);
- } else {
+ protected int compareElements(Object e1, Object e2)
+ {
+ if (e1.getClass() == e2.getClass() && e1 instanceof Comparable)
+ {
+ return ((Comparable) e1).compareTo(e2);
+ }
+ else
+ {
return e1.toString().compareTo(e2.toString());
}
}
More information about the jboss-cvs-commits
mailing list