jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r161912 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: NodeId.java PropertyId.java state/NodeReferencesId.java
Date Tue, 19 Apr 2005 16:12:30 GMT
Author: stefan
Date: Tue Apr 19 09:12:29 2005
New Revision: 161912

URL: http://svn.apache.org/viewcvs?view=rev&rev=161912
Log:
reverting change introduced in r161308: do not internalize uuid field of NodeId and PropertyId
as uuid's are inherently random and the performance gain is questionable once the overhead
of String.intern() is taken into account also. 

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeId.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyId.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeReferencesId.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeId.java?view=diff&r1=161911&r2=161912
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeId.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeId.java Tue Apr 19
09:12:29 2005
@@ -29,11 +29,13 @@
         if (uuid == null) {
             throw new IllegalArgumentException("uuid can not be null");
         }
-        this.uuid = uuid.intern();
+        this.uuid = uuid;
     }
 
     /**
-     * @see ItemId#denotesNode
+     * {@inheritDoc}
+     *
+     * @return always <code>true</code>
      */
     public boolean denotesNode() {
         return true;
@@ -43,17 +45,6 @@
         return uuid;
     }
 
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof NodeId) {
-            NodeId other = (NodeId) obj;
-            return uuid == other.uuid;
-        }
-        return false;
-    }
-
     /**
      * Returns a <code>NodeId</code> holding the value of the specified
      * string. The string must be in the format returned by the
@@ -71,6 +62,19 @@
             throw new IllegalArgumentException("invalid NodeId literal");
         }
         return new NodeId(s);
+    }
+
+    //-------------------------------------------< java.lang.Object overrides >
+
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof NodeId) {
+            NodeId other = (NodeId) obj;
+            return uuid.equals(other.uuid);
+        }
+        return false;
     }
 
     public String toString() {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyId.java?view=diff&r1=161911&r2=161912
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyId.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyId.java Tue Apr
19 09:12:29 2005
@@ -33,12 +33,14 @@
         if (propName == null) {
             throw new IllegalArgumentException("propName can not be null");
         }
-        this.parentUUID = parentUUID.intern();
+        this.parentUUID = parentUUID;
         this.propName = propName;
     }
 
     /**
      * {@inheritDoc}
+     *
+     * @return always <code>false</code>
      */
     public boolean denotesNode() {
         return false;
@@ -52,18 +54,6 @@
         return propName;
     }
 
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof PropertyId) {
-            PropertyId other = (PropertyId) obj;
-            return parentUUID == other.parentUUID
-                    && propName.equals(other.propName);
-        }
-        return false;
-    }
-
     /**
      * Returns a <code>PropertyId</code> holding the value of the specified
      * string. The string must be in the format returned by the
@@ -88,6 +78,20 @@
         QName name = QName.valueOf(s.substring(i + 1));
 
         return new PropertyId(uuid, name);
+    }
+
+    //-------------------------------------------< java.lang.Object overrides >
+
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof PropertyId) {
+            PropertyId other = (PropertyId) obj;
+            return parentUUID.equals(other.parentUUID)
+                    && propName.equals(other.propName);
+        }
+        return false;
     }
 
     public String toString() {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeReferencesId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeReferencesId.java?view=diff&r1=161911&r2=161912
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeReferencesId.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeReferencesId.java
Tue Apr 19 09:12:29 2005
@@ -26,27 +26,12 @@
     /**
      * Create a new instance of this class. Takes a UUID as parameter.
      *
-     * @param uuid uuid of node
+     * @param uuid uuid of target node
      */
     public NodeReferencesId(String uuid) {
         super(uuid);
     }
 
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof NodeReferencesId) {
-            NodeReferencesId other = (NodeReferencesId) obj;
-            return uuid == other.uuid;
-        }
-        return false;
-    }
-
     /**
      * Returns a <code>NodeReferencesId</code> holding the value of the specified
      * string. The string must be in the format returned by the
@@ -54,9 +39,9 @@
      *
      * @param s a <code>String</code> containing the <code>NodeReferencesId</code>
      *          representation to be parsed.
-     * @return the <code>NodeId</code> represented by the argument
+     * @return the <code>NodeReferencesId</code> represented by the argument
      * @throws IllegalArgumentException if the specified string can not be parsed
-     *                                  as a <code>NodeId</code>.
+     *                                  as a <code>NodeReferencesId</code>.
      * @see #toString()
      */
     public static NodeId valueOf(String s) {
@@ -64,5 +49,24 @@
             throw new IllegalArgumentException("invalid NodeReferencesId literal");
         }
         return new NodeReferencesId(s);
+    }
+
+    //-------------------------------------------< java.lang.Object overrides >
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof NodeReferencesId) {
+            return super.equals(obj);
+        }
+        return false;
+    }
+
+    public String toString() {
+        return uuid;
     }
 }



Mime
View raw message