[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Fri Feb 9 07:52:42 EST 2007
User: msurtani
Date: 07/02/09 07:52:42
Modified: src/org/jboss/cache Fqn.java
Log:
Added jcip annotations
Revision Changes Path
1.49 +32 -4 JBossCache/src/org/jboss/cache/Fqn.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Fqn.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Fqn.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- Fqn.java 19 Jan 2007 14:47:40 -0000 1.48
+++ Fqn.java 9 Feb 2007 12:52:42 -0000 1.49
@@ -7,6 +7,7 @@
package org.jboss.cache;
+import net.jcip.annotations.Immutable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -60,8 +61,9 @@
* Another way to look at it is that the "/" separarator is only parsed when it forms
* part of a String passed in to Fqn.fromString() and not otherwise.
*
- * @version $Revision: 1.48 $
+ * @version $Revision: 1.49 $
*/
+ at Immutable
public class Fqn implements Cloneable, Externalizable, Comparable<Fqn>
{
@@ -145,10 +147,14 @@
public Fqn(List names)
{
if (names != null)
+ {
elements = Arrays.asList(names.toArray());
+ }
else
+ {
elements = Collections.EMPTY_LIST;
}
+ }
/**
* Constructs a FQN from an array of names.
@@ -156,7 +162,9 @@
public Fqn(Object[] names)
{
if (names == null)
+ {
elements = Collections.EMPTY_LIST;
+ }
else
{
elements = Arrays.asList(names);
@@ -247,7 +255,9 @@
public static Fqn fromString(String fqn)
{
if (fqn == null)
+ {
return ROOT;
+ }
return createFqn(parse(fqn));
}
@@ -348,9 +358,13 @@
public boolean equals(Object obj)
{
if (this == obj)
+ {
return true;
+ }
if (!(obj instanceof Fqn))
+ {
return false;
+ }
Fqn other = (Fqn) obj;
return elements.equals(other.elements);
}
@@ -442,7 +456,9 @@
public boolean isChildOf(Fqn parentFqn)
{
if (parentFqn.elements.size() == elements.size())
+ {
return false;
+ }
return isChildOrEquals(parentFqn);
}
@@ -461,12 +477,16 @@
{
List parentList = parentFqn.elements;
if (parentList.size() > elements.size())
+ {
return false;
+ }
for (int i = parentList.size() - 1; i >= 0; i--)
{
if (!parentList.get(i).equals(elements.get(i)))
+ {
return false;
}
+ }
return true;
}
@@ -483,8 +503,10 @@
o = it.next();
hashCode += (o == null) ? 0 : o.hashCode() * count++;
}
- if (hashCode == 0) // fix degenerate case
+ if (hashCode == 0)// fix degenerate case
+ {
hashCode = 0xFEED;
+ }
return hashCode;
}
@@ -526,8 +548,14 @@
*/
public String getLastElementAsString()
{
- if (isRoot()) return SEPARATOR;
- else return String.valueOf(getLastElement());
+ if (isRoot())
+ {
+ return SEPARATOR;
+ }
+ else
+ {
+ return String.valueOf(getLastElement());
+ }
}
/**
More information about the jboss-cvs-commits
mailing list