db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From olegn...@apache.org
Subject cvs commit: jakarta-ojb/src/java/org/apache/ojb/broker Identity.java
Date Wed, 01 Jan 2003 19:21:44 GMT
olegnitz    2003/01/01 11:21:44

  Modified:    src/java/org/apache/ojb/broker Identity.java
  Log:
  Minor performance improvements
  
  Revision  Changes    Path
  1.11      +5 -13     jakarta-ojb/src/java/org/apache/ojb/broker/Identity.java
  
  Index: Identity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/Identity.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Identity.java	28 Dec 2002 11:46:41 -0000	1.10
  +++ Identity.java	1 Jan 2003 19:21:44 -0000	1.11
  @@ -291,13 +291,14 @@
           if (stringRepresentation == null)
           {
               StringBuffer buf = new StringBuffer();
  +	    buf.append(objectsClass.getName());
               for (int i = 0; i < pkValues.length; i++)
               {
  -                buf.append((buf.length() == 0) ? "{" : ",");
  +                buf.append((i == 0) ? "{" : ",");
                   buf.append(pkValues[i]);
               }
               buf.append("}");
  -            stringRepresentation = objectsClass.getName() + buf.toString();
  +            stringRepresentation = buf.toString();
           }
           return stringRepresentation;
       }
  @@ -369,15 +370,6 @@
        */
       public int hashCode()
       {
  -        int hash = getObjectsClass().hashCode();
  -        for (int i = 0; i < pkValues.length; i++)
  -        {
  -            if (pkValues[i] != null
  -                && (this.pkValues[i] instanceof String || this.pkValues[i] instanceof
Number))
  -            {
  -                hash = 31 * hash + this.pkValues[i].hashCode();
  -            }
  -        }
  -        return hash;
  +        return toString().hashCode();
       }
   }
  
  
  

Mime
View raw message