You can subscribe to this list here.
2002 |
Jan
(14) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(3) |
Aug
(6) |
Sep
(14) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(1) |
Feb
|
Mar
(7) |
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
(2) |
Sep
(3) |
Oct
|
Nov
(7) |
Dec
(3) |
2004 |
Jan
|
Feb
(3) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
|
2005 |
Jan
|
Feb
|
Mar
(11) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(7) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(29) |
Dec
(16) |
2007 |
Jan
(11) |
Feb
(6) |
Mar
(12) |
Apr
(2) |
May
|
Jun
(16) |
Jul
(9) |
Aug
(5) |
Sep
|
Oct
(4) |
Nov
(8) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
(23) |
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(11) |
Nov
(2) |
Dec
(3) |
2009 |
Jan
|
Feb
(2) |
Mar
(15) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(65) |
Sep
(180) |
Oct
(52) |
Nov
(33) |
Dec
|
2010 |
Jan
(5) |
Feb
(3) |
Mar
(24) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(49) |
Oct
|
Nov
|
Dec
|
From: Eric F. <er...@us...> - 2004-02-25 14:14:29
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25954 Modified Files: build.xml Log Message: moved to 1.1b2 Index: build.xml =================================================================== RCS file: /cvsroot/trove4j/trove/build.xml,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** build.xml 19 Dec 2003 19:40:23 -0000 1.30 --- build.xml 25 Feb 2004 14:07:12 -0000 1.31 *************** *** 10,14 **** <property name="Name" value="GNU Trove for Java"/> <property name="name" value="trove"/> ! <property name="version" value="1.1b1"/> <property name="year" value="2001-2003"/> --- 10,14 ---- <property name="Name" value="GNU Trove for Java"/> <property name="name" value="trove"/> ! <property name="version" value="1.1b2"/> <property name="year" value="2001-2003"/> |
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25598/src/gnu/trove Modified Files: TDoubleHash.java TFloatHash.java TIntHash.java TIntIntHashMapTests.java TLongHash.java TObjectHash.java gen_primitive_base.pl Log Message: fix for 901135: insertionIndex does not reuse first REMOVED slot found Index: TDoubleHash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleHash.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TDoubleHash.java 19 Mar 2003 04:17:03 -0000 1.13 --- TDoubleHash.java 25 Feb 2004 14:05:29 -0000 1.14 *************** *** 232,243 **** // compute the double hash probe = 1 + (hash % (length - 2)); ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != val); // if the index we found was removed: continue probing until we --- 232,258 ---- // compute the double hash probe = 1 + (hash % (length - 2)); ! ! // if the slot we landed on is FULL (but not removed), probe ! // until we find an empty slot, a REMOVED slot, or an element ! // equal to the one we are trying to insert. ! // finding an empty slot means that the value is not present ! // and that we should use that slot as the insertion point; ! // finding a REMOVED slot means that we need to keep searching, ! // however we want to remember the offset of that REMOVED slot ! // so we can reuse it in case a "new" insertion (i.e. not an update) ! // is possible. ! // finding a matching value means that we've found that our desired ! // key is already in the table ! ! if (states[index] != REMOVED) { ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != val); ! } // if the index we found was removed: continue probing until we Index: TFloatHash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatHash.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TFloatHash.java 19 Mar 2003 04:17:03 -0000 1.13 --- TFloatHash.java 25 Feb 2004 14:05:29 -0000 1.14 *************** *** 232,243 **** // compute the double hash probe = 1 + (hash % (length - 2)); ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != val); // if the index we found was removed: continue probing until we --- 232,258 ---- // compute the double hash probe = 1 + (hash % (length - 2)); ! ! // if the slot we landed on is FULL (but not removed), probe ! // until we find an empty slot, a REMOVED slot, or an element ! // equal to the one we are trying to insert. ! // finding an empty slot means that the value is not present ! // and that we should use that slot as the insertion point; ! // finding a REMOVED slot means that we need to keep searching, ! // however we want to remember the offset of that REMOVED slot ! // so we can reuse it in case a "new" insertion (i.e. not an update) ! // is possible. ! // finding a matching value means that we've found that our desired ! // key is already in the table ! ! if (states[index] != REMOVED) { ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != val); ! } // if the index we found was removed: continue probing until we Index: TIntHash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntHash.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TIntHash.java 19 Mar 2003 04:17:04 -0000 1.13 --- TIntHash.java 25 Feb 2004 14:05:29 -0000 1.14 *************** *** 232,243 **** // compute the double hash probe = 1 + (hash % (length - 2)); ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != val); // if the index we found was removed: continue probing until we --- 232,258 ---- // compute the double hash probe = 1 + (hash % (length - 2)); ! ! // if the slot we landed on is FULL (but not removed), probe ! // until we find an empty slot, a REMOVED slot, or an element ! // equal to the one we are trying to insert. ! // finding an empty slot means that the value is not present ! // and that we should use that slot as the insertion point; ! // finding a REMOVED slot means that we need to keep searching, ! // however we want to remember the offset of that REMOVED slot ! // so we can reuse it in case a "new" insertion (i.e. not an update) ! // is possible. ! // finding a matching value means that we've found that our desired ! // key is already in the table ! ! if (states[index] != REMOVED) { ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != val); ! } // if the index we found was removed: continue probing until we Index: TIntIntHashMapTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntIntHashMapTests.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TIntIntHashMapTests.java 22 Sep 2002 21:53:41 -0000 1.5 --- TIntIntHashMapTests.java 25 Feb 2004 14:05:29 -0000 1.6 *************** *** 148,150 **** --- 148,161 ---- assertEquals(map1, result); } + + // do we reuse the *first* removed slot on a re-insertion? + public void testRecycleRemovedSlot() throws Exception { + TIntIntHashMap mm = new TIntIntHashMap(); + mm.put(1,2); + int idx = mm.index(1); + mm.remove(1); + mm.put(1,2); + assertEquals(idx, mm.index(1)); + } + } // TIntIntHashMapTests Index: TLongHash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongHash.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TLongHash.java 19 Mar 2003 04:17:04 -0000 1.13 --- TLongHash.java 25 Feb 2004 14:05:29 -0000 1.14 *************** *** 232,243 **** // compute the double hash probe = 1 + (hash % (length - 2)); ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != val); // if the index we found was removed: continue probing until we --- 232,258 ---- // compute the double hash probe = 1 + (hash % (length - 2)); ! ! // if the slot we landed on is FULL (but not removed), probe ! // until we find an empty slot, a REMOVED slot, or an element ! // equal to the one we are trying to insert. ! // finding an empty slot means that the value is not present ! // and that we should use that slot as the insertion point; ! // finding a REMOVED slot means that we need to keep searching, ! // however we want to remember the offset of that REMOVED slot ! // so we can reuse it in case a "new" insertion (i.e. not an update) ! // is possible. ! // finding a matching value means that we've found that our desired ! // key is already in the table ! ! if (states[index] != REMOVED) { ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != val); ! } // if the index we found was removed: continue probing until we Index: TObjectHash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TObjectHash.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TObjectHash.java 23 Mar 2003 04:06:59 -0000 1.15 --- TObjectHash.java 25 Feb 2004 14:05:29 -0000 1.16 *************** *** 240,254 **** // compute the double hash probe = 1 + (hash % (length - 2)); ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! cur = set[index]; ! } while (cur != null ! && cur != REMOVED ! && ! _hashingStrategy.equals(cur, obj)); // if the index we found was removed: continue probing until we --- 240,268 ---- // compute the double hash probe = 1 + (hash % (length - 2)); ! ! // if the slot we landed on is FULL (but not removed), probe ! // until we find an empty slot, a REMOVED slot, or an element ! // equal to the one we are trying to insert. ! // finding an empty slot means that the value is not present ! // and that we should use that slot as the insertion point; ! // finding a REMOVED slot means that we need to keep searching, ! // however we want to remember the offset of that REMOVED slot ! // so we can reuse it in case a "new" insertion (i.e. not an update) ! // is possible. ! // finding a matching value means that we've found that our desired ! // key is already in the table ! if (cur != REMOVED) { ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! cur = set[index]; ! } while (cur != null ! && cur != REMOVED ! && ! _hashingStrategy.equals(cur, obj)); ! } // if the index we found was removed: continue probing until we *************** *** 269,274 **** } // if it's full, the key is already stored ! return (cur != null ! && cur != REMOVED) ? -index -1 : index; } } --- 283,288 ---- } // if it's full, the key is already stored ! return (cur != null ! && cur != REMOVED) ? -index -1 : index; } } Index: gen_primitive_base.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/gen_primitive_base.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gen_primitive_base.pl 19 Mar 2003 04:17:04 -0000 1.11 --- gen_primitive_base.pl 25 Feb 2004 14:05:29 -0000 1.12 *************** *** 254,265 **** // compute the double hash probe = 1 + (hash % (length - 2)); ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != <instance>); // if the index we found was removed: continue probing until we --- 254,280 ---- // compute the double hash probe = 1 + (hash % (length - 2)); ! ! // if the slot we landed on is FULL (but not removed), probe ! // until we find an empty slot, a REMOVED slot, or an element ! // equal to the one we are trying to insert. ! // finding an empty slot means that the value is not present ! // and that we should use that slot as the insertion point; ! // finding a REMOVED slot means that we need to keep searching, ! // however we want to remember the offset of that REMOVED slot ! // so we can reuse it in case a "new" insertion (i.e. not an update) ! // is possible. ! // finding a matching value means that we've found that our desired ! // key is already in the table ! ! if (states[index] != REMOVED) { ! // starting at the natural offset, probe until we find an ! // offset that isn't full. ! do { ! index -= probe; ! if (index < 0) { ! index += length; ! } ! } while (states[index] == FULL && set[index] != <instance>); ! } // if the index we found was removed: continue probing until we |
From: Eric F. <er...@us...> - 2004-02-25 14:12:41
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25598 Modified Files: ChangeLog Log Message: fix for 901135: insertionIndex does not reuse first REMOVED slot found Index: ChangeLog =================================================================== RCS file: /cvsroot/trove4j/trove/ChangeLog,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ChangeLog 19 Dec 2003 19:38:29 -0000 1.24 --- ChangeLog 25 Feb 2004 14:05:28 -0000 1.25 *************** *** 1,2 **** --- 1,11 ---- + v 1.1b2 + + Fixed 901135 -- bug in T*Hash.insertionIndex() methods that prevented + us from reclaiming the very first REMOVED slot if that's what the + first hash landed upon. In applications that do lots of adds/removes, + this would have led to unnecessary rehashing. With this fix, you + can add(1), remove(1), and then re add(1) and the same slot will be + used. Thanks to matlun for reporting the problem. + v 1.1b1 |
From: Eric F. <er...@us...> - 2003-12-19 20:03:54
|
Update of /cvsroot/trove4j/trove_web In directory sc8-pr-cvs1:/tmp/cvs-serv26974 Modified Files: index.shtml Log Message: Index: index.shtml =================================================================== RCS file: /cvsroot/trove4j/trove_web/index.shtml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** index.shtml 15 Jun 2002 15:47:34 -0000 1.4 --- index.shtml 19 Dec 2003 20:03:51 -0000 1.5 *************** *** 10,13 **** --- 10,17 ---- <h2>GNU Trove: High performance collections for Java.</h2> + <p> + <b><a href="http://sourceforge.net/donate/index.php?group_id=39235">Donate to GNU Trove</a></b> + </p> + <p>The GNU Trove library has two objectives: <ol> |
From: Eric F. <er...@us...> - 2003-12-19 19:40:33
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1:/tmp/cvs-serv23327 Modified Files: build.xml Log Message: update version number for 1.1 beta Index: build.xml =================================================================== RCS file: /cvsroot/trove4j/trove/build.xml,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** build.xml 19 Dec 2003 19:38:29 -0000 1.29 --- build.xml 19 Dec 2003 19:40:23 -0000 1.30 *************** *** 10,14 **** <property name="Name" value="GNU Trove for Java"/> <property name="name" value="trove"/> ! <property name="version" value="1.1"/> <property name="year" value="2001-2003"/> --- 10,14 ---- <property name="Name" value="GNU Trove for Java"/> <property name="name" value="trove"/> ! <property name="version" value="1.1b1"/> <property name="year" value="2001-2003"/> |
From: Eric F. <er...@us...> - 2003-12-19 19:38:32
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1:/tmp/cvs-serv22985 Modified Files: ChangeLog build.xml Log Message: update changelog for 1.1 beta Index: ChangeLog =================================================================== RCS file: /cvsroot/trove4j/trove/ChangeLog,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ChangeLog 15 Sep 2003 13:56:50 -0000 1.23 --- ChangeLog 19 Dec 2003 19:38:29 -0000 1.24 *************** *** 1,3 **** ! v 1.1 added clone() methods to decorator classes. Thanks to Steve Lunt --- 1,11 ---- ! v 1.1b1 ! ! fixed a bug in decorator equals methods (845890) ! ! fixed a memory leak for certain usage patterns (843772) ! ! corrected some javadoc defects (846286) ! ! minor tuning of T*ArrayList toString() added clone() methods to decorator classes. Thanks to Steve Lunt Index: build.xml =================================================================== RCS file: /cvsroot/trove4j/trove/build.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** build.xml 28 Jul 2003 13:50:56 -0000 1.28 --- build.xml 19 Dec 2003 19:38:29 -0000 1.29 *************** *** 11,15 **** <property name="name" value="trove"/> <property name="version" value="1.1"/> ! <property name="year" value="2001-2002"/> <echo message="----------- ${Name} ${version} [${year}] ------------"/> --- 11,15 ---- <property name="name" value="trove"/> <property name="version" value="1.1"/> ! <property name="year" value="2001-2003"/> <echo message="----------- ${Name} ${version} [${year}] ------------"/> |
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv9624 Modified Files: TDoubleDoubleHashMap.java TDoubleFloatHashMap.java TDoubleIntHashMap.java TDoubleLongHashMap.java TDoubleObjectHashMap.java TFloatDoubleHashMap.java TFloatFloatHashMap.java TFloatIntHashMap.java TFloatLongHashMap.java TFloatObjectHashMap.java TIntDoubleHashMap.java TIntFloatHashMap.java TIntIntHashMap.java TIntLongHashMap.java TIntObjectHashMap.java TLongDoubleHashMap.java TLongFloatHashMap.java TLongIntHashMap.java TLongLongHashMap.java TLongObjectHashMap.java gen_primitive_map.pl Log Message: documentation fix: 846286 -- correctly describe return types Index: TDoubleDoubleHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleDoubleHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TDoubleDoubleHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleDoubleHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>double</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public double put(double key, double value) { --- 139,143 ---- * @param value an <code>double</code> value * @return the previous value associated with <tt>key</tt>, ! * or (double)0 if none was found. */ public double put(double key, double value) { *************** *** 192,196 **** * * @param key an <code>double</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public double get(double key) { --- 192,196 ---- * * @param key an <code>double</code> value ! * @return the value of <tt>key</tt> or (double)0 if no such mapping exists. */ public double get(double key) { *************** *** 220,224 **** * * @param key an <code>double</code> value ! * @return an <code>double</code> value */ public double remove(double key) { --- 220,224 ---- * * @param key an <code>double</code> value ! * @return an <code>double</code> value, or (double)0 if no mapping for key exists */ public double remove(double key) { Index: TDoubleFloatHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleFloatHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TDoubleFloatHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleFloatHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>float</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public float put(double key, float value) { --- 139,143 ---- * @param value an <code>float</code> value * @return the previous value associated with <tt>key</tt>, ! * or (float)0 if none was found. */ public float put(double key, float value) { *************** *** 192,196 **** * * @param key an <code>double</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public float get(double key) { --- 192,196 ---- * * @param key an <code>double</code> value ! * @return the value of <tt>key</tt> or (float)0 if no such mapping exists. */ public float get(double key) { *************** *** 220,224 **** * * @param key an <code>double</code> value ! * @return an <code>float</code> value */ public float remove(double key) { --- 220,224 ---- * * @param key an <code>double</code> value ! * @return an <code>float</code> value, or (float)0 if no mapping for key exists */ public float remove(double key) { Index: TDoubleIntHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleIntHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TDoubleIntHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleIntHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>int</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public int put(double key, int value) { --- 139,143 ---- * @param value an <code>int</code> value * @return the previous value associated with <tt>key</tt>, ! * or (int)0 if none was found. */ public int put(double key, int value) { *************** *** 192,196 **** * * @param key an <code>double</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public int get(double key) { --- 192,196 ---- * * @param key an <code>double</code> value ! * @return the value of <tt>key</tt> or (int)0 if no such mapping exists. */ public int get(double key) { *************** *** 220,224 **** * * @param key an <code>double</code> value ! * @return an <code>int</code> value */ public int remove(double key) { --- 220,224 ---- * * @param key an <code>double</code> value ! * @return an <code>int</code> value, or (int)0 if no mapping for key exists */ public int remove(double key) { Index: TDoubleLongHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleLongHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TDoubleLongHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleLongHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public long put(double key, long value) { --- 139,143 ---- * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, ! * or (long)0 if none was found. */ public long put(double key, long value) { *************** *** 192,196 **** * * @param key an <code>double</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public long get(double key) { --- 192,196 ---- * * @param key an <code>double</code> value ! * @return the value of <tt>key</tt> or (long)0 if no such mapping exists. */ public long get(double key) { *************** *** 220,224 **** * * @param key an <code>double</code> value ! * @return an <code>long</code> value */ public long remove(double key) { --- 220,224 ---- * * @param key an <code>double</code> value ! * @return an <code>long</code> value, or (long)0 if no mapping for key exists */ public long remove(double key) { Index: TDoubleObjectHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleObjectHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TDoubleObjectHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleObjectHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 220,224 **** * * @param key an <code>double</code> value ! * @return an <code>Object</code> value */ public Object remove(double key) { --- 220,224 ---- * * @param key an <code>double</code> value ! * @return an <code>Object</code> value, or null if no mapping for key exists */ public Object remove(double key) { Index: TFloatDoubleHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatDoubleHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TFloatDoubleHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TFloatDoubleHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>double</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public double put(float key, double value) { --- 139,143 ---- * @param value an <code>double</code> value * @return the previous value associated with <tt>key</tt>, ! * or (double)0 if none was found. */ public double put(float key, double value) { *************** *** 192,196 **** * * @param key an <code>float</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public double get(float key) { --- 192,196 ---- * * @param key an <code>float</code> value ! * @return the value of <tt>key</tt> or (double)0 if no such mapping exists. */ public double get(float key) { *************** *** 220,224 **** * * @param key an <code>float</code> value ! * @return an <code>double</code> value */ public double remove(float key) { --- 220,224 ---- * * @param key an <code>float</code> value ! * @return an <code>double</code> value, or (double)0 if no mapping for key exists */ public double remove(float key) { Index: TFloatFloatHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatFloatHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TFloatFloatHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TFloatFloatHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>float</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public float put(float key, float value) { --- 139,143 ---- * @param value an <code>float</code> value * @return the previous value associated with <tt>key</tt>, ! * or (float)0 if none was found. */ public float put(float key, float value) { *************** *** 192,196 **** * * @param key an <code>float</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public float get(float key) { --- 192,196 ---- * * @param key an <code>float</code> value ! * @return the value of <tt>key</tt> or (float)0 if no such mapping exists. */ public float get(float key) { *************** *** 220,224 **** * * @param key an <code>float</code> value ! * @return an <code>float</code> value */ public float remove(float key) { --- 220,224 ---- * * @param key an <code>float</code> value ! * @return an <code>float</code> value, or (float)0 if no mapping for key exists */ public float remove(float key) { Index: TFloatIntHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatIntHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TFloatIntHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TFloatIntHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>int</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public int put(float key, int value) { --- 139,143 ---- * @param value an <code>int</code> value * @return the previous value associated with <tt>key</tt>, ! * or (int)0 if none was found. */ public int put(float key, int value) { *************** *** 192,196 **** * * @param key an <code>float</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public int get(float key) { --- 192,196 ---- * * @param key an <code>float</code> value ! * @return the value of <tt>key</tt> or (int)0 if no such mapping exists. */ public int get(float key) { *************** *** 220,224 **** * * @param key an <code>float</code> value ! * @return an <code>int</code> value */ public int remove(float key) { --- 220,224 ---- * * @param key an <code>float</code> value ! * @return an <code>int</code> value, or (int)0 if no mapping for key exists */ public int remove(float key) { Index: TFloatLongHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatLongHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TFloatLongHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TFloatLongHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public long put(float key, long value) { --- 139,143 ---- * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, ! * or (long)0 if none was found. */ public long put(float key, long value) { *************** *** 192,196 **** * * @param key an <code>float</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public long get(float key) { --- 192,196 ---- * * @param key an <code>float</code> value ! * @return the value of <tt>key</tt> or (long)0 if no such mapping exists. */ public long get(float key) { *************** *** 220,224 **** * * @param key an <code>float</code> value ! * @return an <code>long</code> value */ public long remove(float key) { --- 220,224 ---- * * @param key an <code>float</code> value ! * @return an <code>long</code> value, or (long)0 if no mapping for key exists */ public long remove(float key) { Index: TFloatObjectHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatObjectHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TFloatObjectHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TFloatObjectHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 220,224 **** * * @param key an <code>float</code> value ! * @return an <code>Object</code> value */ public Object remove(float key) { --- 220,224 ---- * * @param key an <code>float</code> value ! * @return an <code>Object</code> value, or null if no mapping for key exists */ public Object remove(float key) { Index: TIntDoubleHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntDoubleHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TIntDoubleHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TIntDoubleHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>double</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public double put(int key, double value) { --- 139,143 ---- * @param value an <code>double</code> value * @return the previous value associated with <tt>key</tt>, ! * or (double)0 if none was found. */ public double put(int key, double value) { *************** *** 192,196 **** * * @param key an <code>int</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public double get(int key) { --- 192,196 ---- * * @param key an <code>int</code> value ! * @return the value of <tt>key</tt> or (double)0 if no such mapping exists. */ public double get(int key) { *************** *** 220,224 **** * * @param key an <code>int</code> value ! * @return an <code>double</code> value */ public double remove(int key) { --- 220,224 ---- * * @param key an <code>int</code> value ! * @return an <code>double</code> value, or (double)0 if no mapping for key exists */ public double remove(int key) { Index: TIntFloatHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntFloatHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TIntFloatHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TIntFloatHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>float</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public float put(int key, float value) { --- 139,143 ---- * @param value an <code>float</code> value * @return the previous value associated with <tt>key</tt>, ! * or (float)0 if none was found. */ public float put(int key, float value) { *************** *** 192,196 **** * * @param key an <code>int</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public float get(int key) { --- 192,196 ---- * * @param key an <code>int</code> value ! * @return the value of <tt>key</tt> or (float)0 if no such mapping exists. */ public float get(int key) { *************** *** 220,224 **** * * @param key an <code>int</code> value ! * @return an <code>float</code> value */ public float remove(int key) { --- 220,224 ---- * * @param key an <code>int</code> value ! * @return an <code>float</code> value, or (float)0 if no mapping for key exists */ public float remove(int key) { Index: TIntIntHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntIntHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TIntIntHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TIntIntHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>int</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public int put(int key, int value) { --- 139,143 ---- * @param value an <code>int</code> value * @return the previous value associated with <tt>key</tt>, ! * or (int)0 if none was found. */ public int put(int key, int value) { *************** *** 192,196 **** * * @param key an <code>int</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public int get(int key) { --- 192,196 ---- * * @param key an <code>int</code> value ! * @return the value of <tt>key</tt> or (int)0 if no such mapping exists. */ public int get(int key) { *************** *** 220,224 **** * * @param key an <code>int</code> value ! * @return an <code>int</code> value */ public int remove(int key) { --- 220,224 ---- * * @param key an <code>int</code> value ! * @return an <code>int</code> value, or (int)0 if no mapping for key exists */ public int remove(int key) { Index: TIntLongHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntLongHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TIntLongHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TIntLongHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public long put(int key, long value) { --- 139,143 ---- * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, ! * or (long)0 if none was found. */ public long put(int key, long value) { *************** *** 192,196 **** * * @param key an <code>int</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public long get(int key) { --- 192,196 ---- * * @param key an <code>int</code> value ! * @return the value of <tt>key</tt> or (long)0 if no such mapping exists. */ public long get(int key) { *************** *** 220,224 **** * * @param key an <code>int</code> value ! * @return an <code>long</code> value */ public long remove(int key) { --- 220,224 ---- * * @param key an <code>int</code> value ! * @return an <code>long</code> value, or (long)0 if no mapping for key exists */ public long remove(int key) { Index: TIntObjectHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntObjectHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TIntObjectHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TIntObjectHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 220,224 **** * * @param key an <code>int</code> value ! * @return an <code>Object</code> value */ public Object remove(int key) { --- 220,224 ---- * * @param key an <code>int</code> value ! * @return an <code>Object</code> value, or null if no mapping for key exists */ public Object remove(int key) { Index: TLongDoubleHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongDoubleHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TLongDoubleHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TLongDoubleHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>double</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public double put(long key, double value) { --- 139,143 ---- * @param value an <code>double</code> value * @return the previous value associated with <tt>key</tt>, ! * or (double)0 if none was found. */ public double put(long key, double value) { *************** *** 192,196 **** * * @param key an <code>long</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public double get(long key) { --- 192,196 ---- * * @param key an <code>long</code> value ! * @return the value of <tt>key</tt> or (double)0 if no such mapping exists. */ public double get(long key) { *************** *** 220,224 **** * * @param key an <code>long</code> value ! * @return an <code>double</code> value */ public double remove(long key) { --- 220,224 ---- * * @param key an <code>long</code> value ! * @return an <code>double</code> value, or (double)0 if no mapping for key exists */ public double remove(long key) { Index: TLongFloatHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongFloatHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TLongFloatHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TLongFloatHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>float</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public float put(long key, float value) { --- 139,143 ---- * @param value an <code>float</code> value * @return the previous value associated with <tt>key</tt>, ! * or (float)0 if none was found. */ public float put(long key, float value) { *************** *** 192,196 **** * * @param key an <code>long</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public float get(long key) { --- 192,196 ---- * * @param key an <code>long</code> value ! * @return the value of <tt>key</tt> or (float)0 if no such mapping exists. */ public float get(long key) { *************** *** 220,224 **** * * @param key an <code>long</code> value ! * @return an <code>float</code> value */ public float remove(long key) { --- 220,224 ---- * * @param key an <code>long</code> value ! * @return an <code>float</code> value, or (float)0 if no mapping for key exists */ public float remove(long key) { Index: TLongIntHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongIntHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TLongIntHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TLongIntHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>int</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public int put(long key, int value) { --- 139,143 ---- * @param value an <code>int</code> value * @return the previous value associated with <tt>key</tt>, ! * or (int)0 if none was found. */ public int put(long key, int value) { *************** *** 192,196 **** * * @param key an <code>long</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public int get(long key) { --- 192,196 ---- * * @param key an <code>long</code> value ! * @return the value of <tt>key</tt> or (int)0 if no such mapping exists. */ public int get(long key) { *************** *** 220,224 **** * * @param key an <code>long</code> value ! * @return an <code>int</code> value */ public int remove(long key) { --- 220,224 ---- * * @param key an <code>long</code> value ! * @return an <code>int</code> value, or (int)0 if no mapping for key exists */ public int remove(long key) { Index: TLongLongHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongLongHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TLongLongHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TLongLongHashMap.java 21 Nov 2003 17:32:30 -0000 1.15 *************** *** 139,143 **** * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public long put(long key, long value) { --- 139,143 ---- * @param value an <code>long</code> value * @return the previous value associated with <tt>key</tt>, ! * or (long)0 if none was found. */ public long put(long key, long value) { *************** *** 192,196 **** * * @param key an <code>long</code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public long get(long key) { --- 192,196 ---- * * @param key an <code>long</code> value ! * @return the value of <tt>key</tt> or (long)0 if no such mapping exists. */ public long get(long key) { *************** *** 220,224 **** * * @param key an <code>long</code> value ! * @return an <code>long</code> value */ public long remove(long key) { --- 220,224 ---- * * @param key an <code>long</code> value ! * @return an <code>long</code> value, or (long)0 if no mapping for key exists */ public long remove(long key) { Index: TLongObjectHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongObjectHashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TLongObjectHashMap.java 19 Mar 2003 04:17:04 -0000 1.14 --- TLongObjectHashMap.java 21 Nov 2003 17:32:31 -0000 1.15 *************** *** 220,224 **** * * @param key an <code>long</code> value ! * @return an <code>Object</code> value */ public Object remove(long key) { --- 220,224 ---- * * @param key an <code>long</code> value ! * @return an <code>Object</code> value, or null if no mapping for key exists */ public Object remove(long key) { Index: gen_primitive_map.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/gen_primitive_map.pl,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gen_primitive_map.pl 19 Mar 2003 04:17:04 -0000 1.14 --- gen_primitive_map.pl 21 Nov 2003 17:32:31 -0000 1.15 *************** *** 287,291 **** * @param value an <code><valueType></code> value * @return the previous value associated with <tt>key</tt>, ! * or null if none was found. */ public <valueType> put(<keyType> key, <valueType> value) { --- 287,291 ---- * @param value an <code><valueType></code> value * @return the previous value associated with <tt>key</tt>, ! * or <clearValType> if none was found. */ public <valueType> put(<keyType> key, <valueType> value) { *************** *** 340,344 **** * * @param key an <code><keyType></code> value ! * @return the value of <tt>key</tt> or null if no such mapping exists. */ public <valueType> get(<keyType> key) { --- 340,344 ---- * * @param key an <code><keyType></code> value ! * @return the value of <tt>key</tt> or <clearValType> if no such mapping exists. */ public <valueType> get(<keyType> key) { *************** *** 368,372 **** * * @param key an <code><keyType></code> value ! * @return an <code><valueType></code> value */ public <valueType> remove(<keyType> key) { --- 368,372 ---- * * @param key an <code><keyType></code> value ! * @return an <code><valueType></code> value, or <clearValType> if no mapping for key exists */ public <valueType> remove(<keyType> key) { |
Update of /cvsroot/trove4j/trove/src/gnu/trove/decorator In directory sc8-pr-cvs1:/tmp/cvs-serv7923 Modified Files: TDoubleDoubleHashMapDecorator.java TDoubleFloatHashMapDecorator.java TDoubleIntHashMapDecorator.java TDoubleLongHashMapDecorator.java TDoubleObjectHashMapDecorator.java TFloatDoubleHashMapDecorator.java TFloatFloatHashMapDecorator.java TFloatIntHashMapDecorator.java TFloatLongHashMapDecorator.java TFloatObjectHashMapDecorator.java TIntDoubleHashMapDecorator.java TIntFloatHashMapDecorator.java TIntIntHashMapDecorator.java TIntLongHashMapDecorator.java TIntObjectHashMapDecorator.java TLongDoubleHashMapDecorator.java TLongFloatHashMapDecorator.java TLongIntHashMapDecorator.java TLongLongHashMapDecorator.java TLongObjectHashMapDecorator.java TObjectDoubleHashMapDecorator.java TObjectFloatHashMapDecorator.java TObjectIntHashMapDecorator.java TObjectLongHashMapDecorator.java gen_map_decorators.pl Log Message: fix for 845890: untemplated code in equals method Index: TDoubleDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleDoubleHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TDoubleDoubleHashMapDecorator.java 28 Jul 2003 13:50:56 -0000 1.2 --- TDoubleDoubleHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { double k = unwrapKey(key); double v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Double && val instanceof Double) { double k = unwrapKey(key); double v = unwrapValue(val); Index: TDoubleFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleFloatHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TDoubleFloatHashMapDecorator.java 28 Jul 2003 13:50:56 -0000 1.2 --- TDoubleFloatHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { double k = unwrapKey(key); float v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Double && val instanceof Float) { double k = unwrapKey(key); float v = unwrapValue(val); Index: TDoubleIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleIntHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TDoubleIntHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TDoubleIntHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { double k = unwrapKey(key); int v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Double && val instanceof Integer) { double k = unwrapKey(key); int v = unwrapValue(val); Index: TDoubleLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleLongHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TDoubleLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TDoubleLongHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { double k = unwrapKey(key); long v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Double && val instanceof Long) { double k = unwrapKey(key); long v = unwrapValue(val); Index: TDoubleObjectHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleObjectHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TDoubleObjectHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TDoubleObjectHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { double k = unwrapKey(key); Object v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Double && val instanceof Object) { double k = unwrapKey(key); Object v = unwrapValue(val); Index: TFloatDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatDoubleHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TFloatDoubleHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TFloatDoubleHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { float k = unwrapKey(key); double v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Float && val instanceof Double) { float k = unwrapKey(key); double v = unwrapValue(val); Index: TFloatFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatFloatHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TFloatFloatHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TFloatFloatHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { float k = unwrapKey(key); float v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Float && val instanceof Float) { float k = unwrapKey(key); float v = unwrapValue(val); Index: TFloatIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatIntHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TFloatIntHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TFloatIntHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { float k = unwrapKey(key); int v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Float && val instanceof Integer) { float k = unwrapKey(key); int v = unwrapValue(val); Index: TFloatLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatLongHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TFloatLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TFloatLongHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { float k = unwrapKey(key); long v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Float && val instanceof Long) { float k = unwrapKey(key); long v = unwrapValue(val); Index: TFloatObjectHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatObjectHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TFloatObjectHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TFloatObjectHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { float k = unwrapKey(key); Object v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Float && val instanceof Object) { float k = unwrapKey(key); Object v = unwrapValue(val); Index: TIntDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntDoubleHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TIntDoubleHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TIntDoubleHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { int k = unwrapKey(key); double v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Double) { int k = unwrapKey(key); double v = unwrapValue(val); Index: TIntFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntFloatHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TIntFloatHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TIntFloatHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { int k = unwrapKey(key); float v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Float) { int k = unwrapKey(key); float v = unwrapValue(val); Index: TIntIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntIntHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Index: TIntLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntLongHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TIntLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TIntLongHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { int k = unwrapKey(key); long v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Long) { int k = unwrapKey(key); long v = unwrapValue(val); Index: TIntObjectHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntObjectHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TIntObjectHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TIntObjectHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { int k = unwrapKey(key); Object v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Object) { int k = unwrapKey(key); Object v = unwrapValue(val); Index: TLongDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongDoubleHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TLongDoubleHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TLongDoubleHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { long k = unwrapKey(key); double v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Long && val instanceof Double) { long k = unwrapKey(key); double v = unwrapValue(val); Index: TLongFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongFloatHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TLongFloatHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TLongFloatHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { long k = unwrapKey(key); float v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Long && val instanceof Float) { long k = unwrapKey(key); float v = unwrapValue(val); Index: TLongIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongIntHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TLongIntHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TLongIntHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { long k = unwrapKey(key); int v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Long && val instanceof Integer) { long k = unwrapKey(key); int v = unwrapValue(val); Index: TLongLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongLongHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TLongLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TLongLongHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { long k = unwrapKey(key); long v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Long && val instanceof Long) { long k = unwrapKey(key); long v = unwrapValue(val); Index: TLongObjectHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongObjectHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TLongObjectHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TLongObjectHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { long k = unwrapKey(key); Object v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Long && val instanceof Object) { long k = unwrapKey(key); Object v = unwrapValue(val); Index: TObjectDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TObjectDoubleHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TObjectDoubleHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TObjectDoubleHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { Object k = unwrapKey(key); double v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Object && val instanceof Double) { Object k = unwrapKey(key); double v = unwrapValue(val); Index: TObjectFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TObjectFloatHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TObjectFloatHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TObjectFloatHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { Object k = unwrapKey(key); float v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Object && val instanceof Float) { Object k = unwrapKey(key); float v = unwrapValue(val); Index: TObjectIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TObjectIntHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TObjectIntHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TObjectIntHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { Object k = unwrapKey(key); int v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Object && val instanceof Integer) { Object k = unwrapKey(key); int v = unwrapValue(val); Index: TObjectLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TObjectLongHashMapDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TObjectLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 --- TObjectLongHashMapDecorator.java 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 102,106 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { Object k = unwrapKey(key); long v = unwrapValue(val); --- 102,106 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Object && val instanceof Long) { Object k = unwrapKey(key); long v = unwrapValue(val); Index: gen_map_decorators.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/gen_map_decorators.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gen_map_decorators.pl 28 Jul 2003 13:50:57 -0000 1.2 --- gen_map_decorators.pl 21 Nov 2003 17:22:22 -0000 1.3 *************** *** 21,25 **** --- 21,42 ---- my $wrappers = getWrappers($keyType, $valueType); my $getMethod = getGetMethod($keyType, $valueType); + my ($keyWrapperType, $valWrapperType); + + if ($keyType eq 'Object') { + $keyWrapperType = 'Object'; + } else { + $keyWrapperType = $wrappers{$keyType}; + } + if ($valueType eq 'Object') { + $valWrapperType = 'Object'; + } else { + $valWrapperType = $wrappers{$valueType}; + } + + + + $c =~ s/<keyWrapperType>/$keyWrapperType/g; + $c =~ s/<valWrapperType>/$valWrapperType/g; $c =~ s/<wrappers>/$wrappers/; $c =~ s/<getMethod>/$getMethod/; *************** *** 140,144 **** Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof Integer && val instanceof Integer) { <keyType> k = unwrapKey(key); <valueType> v = unwrapValue(val); --- 157,161 ---- Object key = e.getKey(); Object val = e.getValue(); ! if (key instanceof <keyWrapperType> && val instanceof <valWrapperType>) { <keyType> k = unwrapKey(key); <valueType> v = unwrapValue(val); |
From: Eric F. <er...@us...> - 2003-11-19 15:45:44
|
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv22689/src/gnu/trove Modified Files: THash.java Log Message: fix for 843772: rehash at same capacity when an insertion uses the last free spot without exceeding the size limits for the table. This allows memory usage to remain constant over a large number of insertion/deletions. Index: THash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/THash.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** THash.java 25 Sep 2002 05:43:04 -0000 1.6 --- THash.java 19 Nov 2003 15:45:41 -0000 1.7 *************** *** 241,245 **** // rehash whenever we exhaust the available space in the table if (++_size > _maxSize || _free == 0) { ! rehash(PrimeFinder.nextPrime(capacity() << 1)); computeMaxSize(capacity()); } --- 241,250 ---- // rehash whenever we exhaust the available space in the table if (++_size > _maxSize || _free == 0) { ! // choose a new capacity suited to the new state of the table ! // if we've grown beyond our maximum size, double capacity; ! // if we've exhausted the free spots, rehash to the same capacity, ! // which will free up any stale removed slots for reuse. ! int newCapacity = _size > _maxSize ? PrimeFinder.nextPrime(capacity() << 1) : capacity(); ! rehash(newCapacity); computeMaxSize(capacity()); } |
From: Eric F. <er...@us...> - 2003-11-09 09:35:36
|
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv13751 Modified Files: TIntArrayListTests.java Log Message: more tests Index: TIntArrayListTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayListTests.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TIntArrayListTests.java 9 Nov 2003 09:23:37 -0000 1.10 --- TIntArrayListTests.java 9 Nov 2003 09:35:09 -0000 1.11 *************** *** 433,436 **** --- 433,440 ---- TIntArrayList list2 = new TIntArrayList(); assertEquals("{}", list2.toString()); + + TIntArrayList list3 = new TIntArrayList(); + list3.add(-5); + assertEquals("{-5}", list3.toString()); } } // TIntArrayListTests |
From: Eric F. <er...@us...> - 2003-11-09 09:24:00
|
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv12652 Modified Files: TIntArrayListTests.java Added Files: TDoubleArrayListTests.java Log Message: more tests --- NEW FILE: TDoubleArrayListTests.java --- /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2001, Eric D. Friedman All Rights Reserved. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////// package gnu.trove; import junit.framework.*; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; /** * * Created: Sat Dec 29 14:38:06 2001 * * @author Eric D. Friedman * @version $Id: TDoubleArrayListTests.java,v 1.1 2003/11/09 09:23:37 ericdf Exp $ */ public class TDoubleArrayListTests extends TestCase { protected TDoubleArrayList list; public TDoubleArrayListTests(String name) { super(name); } public void setUp() throws Exception { super.setUp(); list = new TDoubleArrayList(); } public void tearDown() throws Exception { super.tearDown(); list = null; } public void testToString() throws Exception { list.add(new double[] { -1.0, 4.0, 957.0, 32.0, 11.0 }); assertEquals("{-1.0, 4.0, 957.0, 32.0, 11.0}", list.toString()); } } // TDoubleArrayListTests Index: TIntArrayListTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayListTests.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TIntArrayListTests.java 9 Nov 2003 09:22:22 -0000 1.9 --- TIntArrayListTests.java 9 Nov 2003 09:23:37 -0000 1.10 *************** *** 430,433 **** --- 430,436 ---- list.add(new int[] { -1, 4, 957, 32, 11 }); assertEquals("{-1, 4, 957, 32, 11}", list.toString()); + + TIntArrayList list2 = new TIntArrayList(); + assertEquals("{}", list2.toString()); } } // TIntArrayListTests |
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv12529 Modified Files: TDoubleArrayList.java TFloatArrayList.java TIntArrayList.java TIntArrayListTests.java TLongArrayList.java gen_primitive_list.pl Log Message: made toString methods on array list types leave out trailing comma; reimplemented those methods without using procedures Index: TDoubleArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleArrayList.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TDoubleArrayList.java 9 Nov 2003 09:02:11 -0000 1.14 --- TDoubleArrayList.java 9 Nov 2003 09:22:22 -0000 1.15 *************** *** 848,859 **** */ public String toString() { ! final StringBuffer buf = new StringBuffer("{"); ! forEach(new TDoubleProcedure() { ! public boolean execute(double val) { ! buf.append(val); ! buf.append(", "); ! return true; ! } ! }); buf.append("}"); return buf.toString(); --- 848,859 ---- */ public String toString() { ! StringBuffer buf = new StringBuffer("{"); ! for (int i = 0, end = _pos - 1; i < end; i++) { ! buf.append(_data[i]); ! buf.append(", "); ! } ! if (size() > 0) { ! buf.append(_data[_pos - 1]); ! } buf.append("}"); return buf.toString(); Index: TFloatArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatArrayList.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TFloatArrayList.java 9 Nov 2003 09:02:11 -0000 1.14 --- TFloatArrayList.java 9 Nov 2003 09:22:22 -0000 1.15 *************** *** 848,859 **** */ public String toString() { ! final StringBuffer buf = new StringBuffer("{"); ! forEach(new TFloatProcedure() { ! public boolean execute(float val) { ! buf.append(val); ! buf.append(", "); ! return true; ! } ! }); buf.append("}"); return buf.toString(); --- 848,859 ---- */ public String toString() { ! StringBuffer buf = new StringBuffer("{"); ! for (int i = 0, end = _pos - 1; i < end; i++) { ! buf.append(_data[i]); ! buf.append(", "); ! } ! if (size() > 0) { ! buf.append(_data[_pos - 1]); ! } buf.append("}"); return buf.toString(); Index: TIntArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayList.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TIntArrayList.java 9 Nov 2003 09:02:11 -0000 1.12 --- TIntArrayList.java 9 Nov 2003 09:22:22 -0000 1.13 *************** *** 852,863 **** */ public String toString() { ! final StringBuffer buf = new StringBuffer("{"); ! forEach(new TIntProcedure() { ! public boolean execute(int val) { ! buf.append(val); ! buf.append(", "); ! return true; ! } ! }); buf.append("}"); return buf.toString(); --- 852,863 ---- */ public String toString() { ! StringBuffer buf = new StringBuffer("{"); ! for (int i = 0, end = _pos - 1; i < end; i++) { ! buf.append(_data[i]); ! buf.append(", "); ! } ! if (size() > 0) { ! buf.append(_data[_pos - 1]); ! } buf.append("}"); return buf.toString(); Index: TIntArrayListTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayListTests.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TIntArrayListTests.java 9 Nov 2003 09:02:11 -0000 1.8 --- TIntArrayListTests.java 9 Nov 2003 09:22:22 -0000 1.9 *************** *** 426,428 **** --- 426,433 ---- assertEquals(list, list2); } + + public void testToString() throws Exception { + list.add(new int[] { -1, 4, 957, 32, 11 }); + assertEquals("{-1, 4, 957, 32, 11}", list.toString()); + } } // TIntArrayListTests Index: TLongArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongArrayList.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TLongArrayList.java 9 Nov 2003 09:02:11 -0000 1.14 --- TLongArrayList.java 9 Nov 2003 09:22:22 -0000 1.15 *************** *** 848,859 **** */ public String toString() { ! final StringBuffer buf = new StringBuffer("{"); ! forEach(new TLongProcedure() { ! public boolean execute(long val) { ! buf.append(val); ! buf.append(", "); ! return true; ! } ! }); buf.append("}"); return buf.toString(); --- 848,859 ---- */ public String toString() { ! StringBuffer buf = new StringBuffer("{"); ! for (int i = 0, end = _pos - 1; i < end; i++) { ! buf.append(_data[i]); ! buf.append(", "); ! } ! if (size() > 0) { ! buf.append(_data[_pos - 1]); ! } buf.append("}"); return buf.toString(); Index: gen_primitive_list.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/gen_primitive_list.pl,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gen_primitive_list.pl 9 Nov 2003 09:02:11 -0000 1.10 --- gen_primitive_list.pl 9 Nov 2003 09:22:22 -0000 1.11 *************** *** 869,880 **** */ public String toString() { ! final StringBuffer buf = new StringBuffer("{"); ! forEach(new T<Type>Procedure() { ! public boolean execute(<type> val) { ! buf.append(val); ! buf.append(", "); ! return true; ! } ! }); buf.append("}"); return buf.toString(); --- 869,880 ---- */ public String toString() { ! StringBuffer buf = new StringBuffer("{"); ! for (int i = 0, end = _pos - 1; i < end; i++) { ! buf.append(_data[i]); ! buf.append(", "); ! } ! if (size() > 0) { ! buf.append(_data[_pos - 1]); ! } buf.append("}"); return buf.toString(); |
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv10189 Modified Files: TDoubleArrayList.java TFloatArrayList.java TIntArrayList.java TIntArrayListTests.java TLongArrayList.java gen_primitive_list.pl Log Message: fixed bug in min/max methods on primitive array lists also removed call to Math.min|max methods Index: TDoubleArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleArrayList.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TDoubleArrayList.java 13 Aug 2003 02:18:01 -0000 1.13 --- TDoubleArrayList.java 9 Nov 2003 09:02:11 -0000 1.14 *************** *** 814,818 **** double max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! max = Math.max(max, _data[_pos]); } return max; --- 814,820 ---- double max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] > max) { ! max = _data[i]; ! } } return max; *************** *** 831,835 **** double min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! min = Math.min(min, _data[_pos]); } return min; --- 833,839 ---- double min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] < min) { ! min = _data[i]; ! } } return min; Index: TFloatArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatArrayList.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TFloatArrayList.java 13 Aug 2003 02:18:01 -0000 1.13 --- TFloatArrayList.java 9 Nov 2003 09:02:11 -0000 1.14 *************** *** 814,818 **** float max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! max = Math.max(max, _data[_pos]); } return max; --- 814,820 ---- float max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] > max) { ! max = _data[i]; ! } } return max; *************** *** 831,835 **** float min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! min = Math.min(min, _data[_pos]); } return min; --- 833,839 ---- float min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] < min) { ! min = _data[i]; ! } } return min; Index: TIntArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayList.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TIntArrayList.java 13 Aug 2003 02:18:01 -0000 1.11 --- TIntArrayList.java 9 Nov 2003 09:02:11 -0000 1.12 *************** *** 818,822 **** int max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! max = Math.max(max, _data[_pos]); } return max; --- 818,824 ---- int max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] > max) { ! max = _data[i]; ! } } return max; *************** *** 835,839 **** int min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! min = Math.min(min, _data[_pos]); } return min; --- 837,843 ---- int min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] < min) { ! min = _data[i]; ! } } return min; Index: TIntArrayListTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayListTests.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TIntArrayListTests.java 13 Aug 2003 02:18:01 -0000 1.7 --- TIntArrayListTests.java 9 Nov 2003 09:02:11 -0000 1.8 *************** *** 399,402 **** --- 399,416 ---- } + public void testMin() { + TIntArrayList l1; + l1 = new TIntArrayList(); + l1.add(new int[] { 1, 2, -6, 3, 4 }); + assertEquals(-6, l1.min()); + } + + public void testMax() { + TIntArrayList l1; + l1 = new TIntArrayList(); + l1.add(new int[] { 1, 2, -6, 3, 4, -9, 0 }); + assertEquals(4, l1.max()); + } + public void testSerialization() throws Exception { list.add(new int[] { -1, 0, 33, 14, -97, 7 }); Index: TLongArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongArrayList.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TLongArrayList.java 13 Aug 2003 02:18:01 -0000 1.13 --- TLongArrayList.java 9 Nov 2003 09:02:11 -0000 1.14 *************** *** 814,818 **** long max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! max = Math.max(max, _data[_pos]); } return max; --- 814,820 ---- long max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] > max) { ! max = _data[i]; ! } } return max; *************** *** 831,835 **** long min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! min = Math.min(min, _data[_pos]); } return min; --- 833,839 ---- long min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] < min) { ! min = _data[i]; ! } } return min; Index: gen_primitive_list.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/gen_primitive_list.pl,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gen_primitive_list.pl 13 Aug 2003 02:18:01 -0000 1.9 --- gen_primitive_list.pl 9 Nov 2003 09:02:11 -0000 1.10 *************** *** 835,839 **** <type> max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! max = Math.max(max, _data[_pos]); } return max; --- 835,841 ---- <type> max = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] > max) { ! max = _data[i]; ! } } return max; *************** *** 852,856 **** <type> min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! min = Math.min(min, _data[_pos]); } return min; --- 854,860 ---- <type> min = _data[_pos - 1]; for (int i = _pos - 1; i-- > 0;) { ! if (_data[i] < min) { ! min = _data[i]; ! } } return min; |
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv9414/src/gnu/trove Modified Files: Tag: no_states TDoubleDoubleHashMap.java TDoubleFloatHashMap.java TDoubleHash.java TDoubleHashSet.java TDoubleIntHashMap.java TDoubleLongHashMap.java TDoubleObjectHashMap.java TFloatDoubleHashMap.java TFloatFloatHashMap.java TFloatHash.java TFloatHashSet.java TFloatIntHashMap.java TFloatLongHashMap.java TFloatObjectHashMap.java TIntDoubleHashMap.java TIntFloatHashMap.java TIntHash.java TIntHashSet.java TIntIntHashMap.java TIntLongHashMap.java TIntObjectHashMap.java TLongDoubleHashMap.java TLongFloatHashMap.java TLongHash.java TLongHashSet.java TLongIntHashMap.java TLongLongHashMap.java TLongObjectHashMap.java TPrimitiveHash.java TPrimitiveIterator.java gen_primitive_base.pl gen_primitive_map.pl gen_primitive_set.pl Log Message: savepoint on no_states branch for work toward ditching the states array in primitive hashes Index: TDoubleDoubleHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleDoubleHashMap.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** TDoubleDoubleHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleDoubleHashMap.java 20 Sep 2003 17:06:40 -0000 1.14.2.1 *************** *** 142,146 **** */ public double put(double key, double value) { - byte previousState; double previous = (double)0; int index = insertionIndex(key); --- 142,145 ---- *************** *** 151,160 **** isNewMapping = false; } ! previousState = _states[index]; _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(previousState == FREE); } --- 150,159 ---- isNewMapping = false; } ! boolean wasFree = isFree(index); _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(wasFree); } *************** *** 205,216 **** public void clear() { super.clear(); - double[] keys = _set; - double[] vals = _values; - byte[] states = _states; ! for (int i = keys.length; i-- > 0;) { ! keys[i] = (double)0; ! vals[i] = (double)0; ! states[i] = FREE; } } --- 204,212 ---- public void clear() { super.clear(); ! for (int i = _set.length; i-- > 0;) { ! _set[i] = (double)0; ! _values[i] = (double)0; ! _states[i] = FREE; } } *************** *** 311,318 **** double[] vals = new double[size()]; double[] v = _values; - byte[] states = _states; for (int i = v.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { vals[j++] = v[i]; } --- 307,313 ---- double[] vals = new double[size()]; double[] v = _values; for (int i = v.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { vals[j++] = v[i]; } *************** *** 329,336 **** double[] keys = new double[size()]; double[] k = _set; - byte[] states = _states; for (int i = k.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { keys[j++] = k[i]; } --- 324,330 ---- double[] keys = new double[size()]; double[] k = _set; for (int i = k.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { keys[j++] = k[i]; } *************** *** 346,354 **** */ public boolean containsValue(double val) { - byte[] states = _states; double[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (states[i] == FULL && val == vals[i]) { return true; } --- 340,347 ---- */ public boolean containsValue(double val) { double[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (isInUse(i) && val == vals[i]) { return true; } *************** *** 387,394 **** */ public boolean forEachValue(TDoubleProcedure procedure) { - byte[] states = _states; double[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(values[i])) { return false; } --- 380,386 ---- */ public boolean forEachValue(TDoubleProcedure procedure) { double[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(values[i])) { return false; } *************** *** 406,414 **** */ public boolean forEachEntry(TDoubleDoubleProcedure procedure) { - byte[] states = _states; double[] keys = _set; double[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { return false; } --- 398,405 ---- */ public boolean forEachEntry(TDoubleDoubleProcedure procedure) { double[] keys = _set; double[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { return false; } *************** *** 426,434 **** public boolean retainEntries(TDoubleDoubleProcedure procedure) { boolean modified = false; - byte[] states = _states; double[] keys = _set; double[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; --- 417,424 ---- public boolean retainEntries(TDoubleDoubleProcedure procedure) { boolean modified = false; double[] keys = _set; double[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; *************** *** 444,451 **** */ public void transformValues(TDoubleFunction function) { - byte[] states = _states; double[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL) { values[i] = function.execute(values[i]); } --- 434,440 ---- */ public void transformValues(TDoubleFunction function) { double[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i)) { values[i] = function.execute(values[i]); } Index: TDoubleFloatHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleFloatHashMap.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** TDoubleFloatHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleFloatHashMap.java 20 Sep 2003 17:06:40 -0000 1.14.2.1 *************** *** 142,146 **** */ public float put(double key, float value) { - byte previousState; float previous = (float)0; int index = insertionIndex(key); --- 142,145 ---- *************** *** 151,160 **** isNewMapping = false; } ! previousState = _states[index]; _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(previousState == FREE); } --- 150,159 ---- isNewMapping = false; } ! boolean wasFree = isFree(index); _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(wasFree); } *************** *** 205,216 **** public void clear() { super.clear(); - double[] keys = _set; - float[] vals = _values; - byte[] states = _states; ! for (int i = keys.length; i-- > 0;) { ! keys[i] = (double)0; ! vals[i] = (float)0; ! states[i] = FREE; } } --- 204,212 ---- public void clear() { super.clear(); ! for (int i = _set.length; i-- > 0;) { ! _set[i] = (double)0; ! _values[i] = (float)0; ! _states[i] = FREE; } } *************** *** 311,318 **** float[] vals = new float[size()]; float[] v = _values; - byte[] states = _states; for (int i = v.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { vals[j++] = v[i]; } --- 307,313 ---- float[] vals = new float[size()]; float[] v = _values; for (int i = v.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { vals[j++] = v[i]; } *************** *** 329,336 **** double[] keys = new double[size()]; double[] k = _set; - byte[] states = _states; for (int i = k.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { keys[j++] = k[i]; } --- 324,330 ---- double[] keys = new double[size()]; double[] k = _set; for (int i = k.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { keys[j++] = k[i]; } *************** *** 346,354 **** */ public boolean containsValue(float val) { - byte[] states = _states; float[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (states[i] == FULL && val == vals[i]) { return true; } --- 340,347 ---- */ public boolean containsValue(float val) { float[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (isInUse(i) && val == vals[i]) { return true; } *************** *** 387,394 **** */ public boolean forEachValue(TFloatProcedure procedure) { - byte[] states = _states; float[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(values[i])) { return false; } --- 380,386 ---- */ public boolean forEachValue(TFloatProcedure procedure) { float[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(values[i])) { return false; } *************** *** 406,414 **** */ public boolean forEachEntry(TDoubleFloatProcedure procedure) { - byte[] states = _states; double[] keys = _set; float[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { return false; } --- 398,405 ---- */ public boolean forEachEntry(TDoubleFloatProcedure procedure) { double[] keys = _set; float[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { return false; } *************** *** 426,434 **** public boolean retainEntries(TDoubleFloatProcedure procedure) { boolean modified = false; - byte[] states = _states; double[] keys = _set; float[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; --- 417,424 ---- public boolean retainEntries(TDoubleFloatProcedure procedure) { boolean modified = false; double[] keys = _set; float[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; *************** *** 444,451 **** */ public void transformValues(TFloatFunction function) { - byte[] states = _states; float[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL) { values[i] = function.execute(values[i]); } --- 434,440 ---- */ public void transformValues(TFloatFunction function) { float[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i)) { values[i] = function.execute(values[i]); } Index: TDoubleHash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleHash.java,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** TDoubleHash.java 19 Mar 2003 04:17:03 -0000 1.13 --- TDoubleHash.java 20 Sep 2003 17:06:40 -0000 1.13.2.1 *************** *** 152,159 **** */ public boolean forEach(TDoubleProcedure procedure) { ! byte[] states = _states; ! double[] set = _set; ! for (int i = set.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(set[i])) { return false; } --- 152,157 ---- */ public boolean forEach(TDoubleProcedure procedure) { ! for (int i = _set.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(_set[i])) { return false; } *************** *** 181,194 **** int hash, probe, index, length; double[] set; - byte[] states; - states = _states; set = _set; ! length = states.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length; ! if (states[index] != FREE && ! (states[index] == REMOVED || set[index] != val)) { // see Knuth, p. 529 probe = 1 + (hash % (length - 2)); --- 179,190 ---- int hash, probe, index, length; double[] set; set = _set; ! length = set.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length; ! if (! isFree(index) && ! (isRemoved(index) || set[index] != val)) { // see Knuth, p. 529 probe = 1 + (hash % (length - 2)); *************** *** 199,207 **** index += length; } ! } while (states[index] != FREE && ! (states[index] == REMOVED || set[index] != val)); } ! return states[index] == FREE ? -1 : index; } --- 195,203 ---- index += length; } ! } while (! isFree(index) && ! (isRemoved(index) || set[index] != val)); } ! return isFree(index) ? -1 : index; } *************** *** 217,231 **** int hash, probe, index, length; double[] set; - byte[] states; - states = _states; set = _set; ! length = states.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length; ! if (states[index] == FREE) { return index; // empty, all done ! } else if (states[index] == FULL && set[index] == val) { return -index -1; // already stored } else { // already FULL or REMOVED, must probe --- 213,225 ---- int hash, probe, index, length; double[] set; set = _set; ! length = set.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length; ! if (isFree(index)) { return index; // empty, all done ! } else if (isInUse(index) && set[index] == val) { return -index -1; // already stored } else { // already FULL or REMOVED, must probe *************** *** 239,251 **** index += length; } ! } while (states[index] == FULL && set[index] != val); // if the index we found was removed: continue probing until we // locate a free location or an element which equal()s the // one we have. ! if (states[index] == REMOVED) { int firstRemoved = index; ! while (states[index] != FREE && ! (states[index] == REMOVED || set[index] != val)) { index -= probe; if (index < 0) { --- 233,245 ---- index += length; } ! } while (isInUse(index) && set[index] != val); // if the index we found was removed: continue probing until we // locate a free location or an element which equal()s the // one we have. ! if (isRemoved(index)) { int firstRemoved = index; ! while (! isFree(index) && ! (isRemoved(index) || set[index] != val)) { index -= probe; if (index < 0) { *************** *** 253,260 **** } } ! return states[index] == FULL ? -index -1 : firstRemoved; } // if it's full, the key is already stored ! return states[index] == FULL ? -index -1 : index; } } --- 247,254 ---- } } ! return isInUse(index) ? -index -1 : firstRemoved; } // if it's full, the key is already stored ! return isInUse(index) ? -index -1 : index; } } Index: TDoubleHashSet.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleHashSet.java,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** TDoubleHashSet.java 19 Mar 2003 04:17:03 -0000 1.11 --- TDoubleHashSet.java 20 Sep 2003 17:06:40 -0000 1.11.2.1 *************** *** 145,152 **** } ! byte previousState = _states[index]; _set[index] = val; _states[index] = FULL; ! postInsertHook(previousState == FREE); return true; // yes, we added something --- 145,152 ---- } ! boolean wasFree = isFree(index); _set[index] = val; _states[index] = FULL; ! postInsertHook(wasFree); return true; // yes, we added something *************** *** 183,192 **** public double[] toArray() { double[] result = new double[size()]; - double[] set = _set; - byte[] states = _states; ! for (int i = states.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { ! result[j++] = set[i]; } } --- 183,190 ---- public double[] toArray() { double[] result = new double[size()]; ! for (int i = _set.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { ! result[j++] = _set[i]; } } *************** *** 199,208 **** public void clear() { super.clear(); - double[] set = _set; - byte[] states = _states; ! for (int i = set.length; i-- > 0;) { ! set[i] = (double)0; ! states[i] = FREE; } } --- 197,204 ---- public void clear() { super.clear(); ! for (int i = _set.length; i-- > 0;) { ! _set[i] = (double)0; ! _states[i] = FREE; } } *************** *** 323,330 **** Arrays.sort(array); double[] set = _set; - byte[] states = _states; for (int i = set.length; i-- > 0;) { ! if (states[i] == FULL && (Arrays.binarySearch(array,set[i]) < 0)) { remove(set[i]); changed = true; --- 319,325 ---- Arrays.sort(array); double[] set = _set; for (int i = set.length; i-- > 0;) { ! if (isInUse(i) && (Arrays.binarySearch(array,set[i]) < 0)) { remove(set[i]); changed = true; Index: TDoubleIntHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleIntHashMap.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** TDoubleIntHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleIntHashMap.java 20 Sep 2003 17:06:40 -0000 1.14.2.1 *************** *** 142,146 **** */ public int put(double key, int value) { - byte previousState; int previous = (int)0; int index = insertionIndex(key); --- 142,145 ---- *************** *** 151,160 **** isNewMapping = false; } ! previousState = _states[index]; _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(previousState == FREE); } --- 150,159 ---- isNewMapping = false; } ! boolean wasFree = isFree(index); _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(wasFree); } *************** *** 205,216 **** public void clear() { super.clear(); - double[] keys = _set; - int[] vals = _values; - byte[] states = _states; ! for (int i = keys.length; i-- > 0;) { ! keys[i] = (double)0; ! vals[i] = (int)0; ! states[i] = FREE; } } --- 204,212 ---- public void clear() { super.clear(); ! for (int i = _set.length; i-- > 0;) { ! _set[i] = (double)0; ! _values[i] = (int)0; ! _states[i] = FREE; } } *************** *** 311,318 **** int[] vals = new int[size()]; int[] v = _values; - byte[] states = _states; for (int i = v.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { vals[j++] = v[i]; } --- 307,313 ---- int[] vals = new int[size()]; int[] v = _values; for (int i = v.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { vals[j++] = v[i]; } *************** *** 329,336 **** double[] keys = new double[size()]; double[] k = _set; - byte[] states = _states; for (int i = k.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { keys[j++] = k[i]; } --- 324,330 ---- double[] keys = new double[size()]; double[] k = _set; for (int i = k.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { keys[j++] = k[i]; } *************** *** 346,354 **** */ public boolean containsValue(int val) { - byte[] states = _states; int[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (states[i] == FULL && val == vals[i]) { return true; } --- 340,347 ---- */ public boolean containsValue(int val) { int[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (isInUse(i) && val == vals[i]) { return true; } *************** *** 387,394 **** */ public boolean forEachValue(TIntProcedure procedure) { - byte[] states = _states; int[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(values[i])) { return false; } --- 380,386 ---- */ public boolean forEachValue(TIntProcedure procedure) { int[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(values[i])) { return false; } *************** *** 406,414 **** */ public boolean forEachEntry(TDoubleIntProcedure procedure) { - byte[] states = _states; double[] keys = _set; int[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { return false; } --- 398,405 ---- */ public boolean forEachEntry(TDoubleIntProcedure procedure) { double[] keys = _set; int[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { return false; } *************** *** 426,434 **** public boolean retainEntries(TDoubleIntProcedure procedure) { boolean modified = false; - byte[] states = _states; double[] keys = _set; int[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; --- 417,424 ---- public boolean retainEntries(TDoubleIntProcedure procedure) { boolean modified = false; double[] keys = _set; int[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; *************** *** 444,451 **** */ public void transformValues(TIntFunction function) { - byte[] states = _states; int[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL) { values[i] = function.execute(values[i]); } --- 434,440 ---- */ public void transformValues(TIntFunction function) { int[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i)) { values[i] = function.execute(values[i]); } Index: TDoubleLongHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleLongHashMap.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** TDoubleLongHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleLongHashMap.java 20 Sep 2003 17:06:40 -0000 1.14.2.1 *************** *** 142,146 **** */ public long put(double key, long value) { - byte previousState; long previous = (long)0; int index = insertionIndex(key); --- 142,145 ---- *************** *** 151,160 **** isNewMapping = false; } ! previousState = _states[index]; _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(previousState == FREE); } --- 150,159 ---- isNewMapping = false; } ! boolean wasFree = isFree(index); _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(wasFree); } *************** *** 205,216 **** public void clear() { super.clear(); - double[] keys = _set; - long[] vals = _values; - byte[] states = _states; ! for (int i = keys.length; i-- > 0;) { ! keys[i] = (double)0; ! vals[i] = (long)0; ! states[i] = FREE; } } --- 204,212 ---- public void clear() { super.clear(); ! for (int i = _set.length; i-- > 0;) { ! _set[i] = (double)0; ! _values[i] = (long)0; ! _states[i] = FREE; } } *************** *** 311,318 **** long[] vals = new long[size()]; long[] v = _values; - byte[] states = _states; for (int i = v.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { vals[j++] = v[i]; } --- 307,313 ---- long[] vals = new long[size()]; long[] v = _values; for (int i = v.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { vals[j++] = v[i]; } *************** *** 329,336 **** double[] keys = new double[size()]; double[] k = _set; - byte[] states = _states; for (int i = k.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { keys[j++] = k[i]; } --- 324,330 ---- double[] keys = new double[size()]; double[] k = _set; for (int i = k.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { keys[j++] = k[i]; } *************** *** 346,354 **** */ public boolean containsValue(long val) { - byte[] states = _states; long[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (states[i] == FULL && val == vals[i]) { return true; } --- 340,347 ---- */ public boolean containsValue(long val) { long[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (isInUse(i) && val == vals[i]) { return true; } *************** *** 387,394 **** */ public boolean forEachValue(TLongProcedure procedure) { - byte[] states = _states; long[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(values[i])) { return false; } --- 380,386 ---- */ public boolean forEachValue(TLongProcedure procedure) { long[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(values[i])) { return false; } *************** *** 406,414 **** */ public boolean forEachEntry(TDoubleLongProcedure procedure) { - byte[] states = _states; double[] keys = _set; long[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { return false; } --- 398,405 ---- */ public boolean forEachEntry(TDoubleLongProcedure procedure) { double[] keys = _set; long[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { return false; } *************** *** 426,434 **** public boolean retainEntries(TDoubleLongProcedure procedure) { boolean modified = false; - byte[] states = _states; double[] keys = _set; long[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; --- 417,424 ---- public boolean retainEntries(TDoubleLongProcedure procedure) { boolean modified = false; double[] keys = _set; long[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; *************** *** 444,451 **** */ public void transformValues(TLongFunction function) { - byte[] states = _states; long[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL) { values[i] = function.execute(values[i]); } --- 434,440 ---- */ public void transformValues(TLongFunction function) { long[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i)) { values[i] = function.execute(values[i]); } Index: TDoubleObjectHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleObjectHashMap.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** TDoubleObjectHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TDoubleObjectHashMap.java 20 Sep 2003 17:06:40 -0000 1.14.2.1 *************** *** 142,146 **** */ public Object put(double key, Object value) { - byte previousState; Object previous = null; int index = insertionIndex(key); --- 142,145 ---- *************** *** 151,160 **** isNewMapping = false; } ! previousState = _states[index]; _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(previousState == FREE); } --- 150,159 ---- isNewMapping = false; } ! boolean wasFree = isFree(index); _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(wasFree); } *************** *** 205,216 **** public void clear() { super.clear(); - double[] keys = _set; - Object[] vals = _values; - byte[] states = _states; ! for (int i = keys.length; i-- > 0;) { ! keys[i] = (double)0; ! vals[i] = null; ! states[i] = FREE; } } --- 204,212 ---- public void clear() { super.clear(); ! for (int i = _set.length; i-- > 0;) { ! _set[i] = (double)0; ! _values[i] = null; ! _states[i] = FREE; } } *************** *** 311,318 **** Object[] vals = new Object[size()]; Object[] v = _values; - byte[] states = _states; for (int i = v.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { vals[j++] = v[i]; } --- 307,313 ---- Object[] vals = new Object[size()]; Object[] v = _values; for (int i = v.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { vals[j++] = v[i]; } *************** *** 329,336 **** double[] keys = new double[size()]; double[] k = _set; - byte[] states = _states; for (int i = k.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { keys[j++] = k[i]; } --- 324,330 ---- double[] keys = new double[size()]; double[] k = _set; for (int i = k.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { keys[j++] = k[i]; } *************** *** 346,350 **** */ public boolean containsValue(Object val) { - byte[] states = _states; Object[] vals = _values; --- 340,343 ---- *************** *** 353,357 **** if (null == val) { for (int i = vals.length; i-- > 0;) { ! if (states[i] == FULL && val == vals[i]) { return true; --- 346,350 ---- if (null == val) { for (int i = vals.length; i-- > 0;) { ! if (isInUse(i) && val == vals[i]) { return true; *************** *** 360,364 **** } else { for (int i = vals.length; i-- > 0;) { ! if (states[i] == FULL && (val == vals[i] || val.equals(vals[i]))) { return true; --- 353,357 ---- } else { for (int i = vals.length; i-- > 0;) { ! if (isInUse(i) && (val == vals[i] || val.equals(vals[i]))) { return true; *************** *** 399,406 **** */ public boolean forEachValue(TObjectProcedure procedure) { - byte[] states = _states; Object[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(values[i])) { return false; } --- 392,398 ---- */ public boolean forEachValue(TObjectProcedure procedure) { Object[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(values[i])) { return false; } *************** *** 418,426 **** */ public boolean forEachEntry(TDoubleObjectProcedure procedure) { - byte[] states = _states; double[] keys = _set; Object[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { return false; } --- 410,417 ---- */ public boolean forEachEntry(TDoubleObjectProcedure procedure) { double[] keys = _set; Object[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { return false; } *************** *** 438,446 **** public boolean retainEntries(TDoubleObjectProcedure procedure) { boolean modified = false; - byte[] states = _states; double[] keys = _set; Object[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; --- 429,436 ---- public boolean retainEntries(TDoubleObjectProcedure procedure) { boolean modified = false; double[] keys = _set; Object[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; *************** *** 456,463 **** */ public void transformValues(TObjectFunction function) { - byte[] states = _states; Object[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL) { values[i] = function.execute(values[i]); } --- 446,452 ---- */ public void transformValues(TObjectFunction function) { Object[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i)) { values[i] = function.execute(values[i]); } Index: TFloatDoubleHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatDoubleHashMap.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** TFloatDoubleHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TFloatDoubleHashMap.java 20 Sep 2003 17:06:40 -0000 1.14.2.1 *************** *** 142,146 **** */ public double put(float key, double value) { - byte previousState; double previous = (double)0; int index = insertionIndex(key); --- 142,145 ---- *************** *** 151,160 **** isNewMapping = false; } ! previousState = _states[index]; _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(previousState == FREE); } --- 150,159 ---- isNewMapping = false; } ! boolean wasFree = isFree(index); _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(wasFree); } *************** *** 205,216 **** public void clear() { super.clear(); - float[] keys = _set; - double[] vals = _values; - byte[] states = _states; ! for (int i = keys.length; i-- > 0;) { ! keys[i] = (float)0; ! vals[i] = (double)0; ! states[i] = FREE; } } --- 204,212 ---- public void clear() { super.clear(); ! for (int i = _set.length; i-- > 0;) { ! _set[i] = (float)0; ! _values[i] = (double)0; ! _states[i] = FREE; } } *************** *** 311,318 **** double[] vals = new double[size()]; double[] v = _values; - byte[] states = _states; for (int i = v.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { vals[j++] = v[i]; } --- 307,313 ---- double[] vals = new double[size()]; double[] v = _values; for (int i = v.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { vals[j++] = v[i]; } *************** *** 329,336 **** float[] keys = new float[size()]; float[] k = _set; - byte[] states = _states; for (int i = k.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { keys[j++] = k[i]; } --- 324,330 ---- float[] keys = new float[size()]; float[] k = _set; for (int i = k.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { keys[j++] = k[i]; } *************** *** 346,354 **** */ public boolean containsValue(double val) { - byte[] states = _states; double[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (states[i] == FULL && val == vals[i]) { return true; } --- 340,347 ---- */ public boolean containsValue(double val) { double[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (isInUse(i) && val == vals[i]) { return true; } *************** *** 387,394 **** */ public boolean forEachValue(TDoubleProcedure procedure) { - byte[] states = _states; double[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(values[i])) { return false; } --- 380,386 ---- */ public boolean forEachValue(TDoubleProcedure procedure) { double[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(values[i])) { return false; } *************** *** 406,414 **** */ public boolean forEachEntry(TFloatDoubleProcedure procedure) { - byte[] states = _states; float[] keys = _set; double[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { return false; } --- 398,405 ---- */ public boolean forEachEntry(TFloatDoubleProcedure procedure) { float[] keys = _set; double[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { return false; } *************** *** 426,434 **** public boolean retainEntries(TFloatDoubleProcedure procedure) { boolean modified = false; - byte[] states = _states; float[] keys = _set; double[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; --- 417,424 ---- public boolean retainEntries(TFloatDoubleProcedure procedure) { boolean modified = false; float[] keys = _set; double[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; *************** *** 444,451 **** */ public void transformValues(TDoubleFunction function) { - byte[] states = _states; double[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL) { values[i] = function.execute(values[i]); } --- 434,440 ---- */ public void transformValues(TDoubleFunction function) { double[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i)) { values[i] = function.execute(values[i]); } Index: TFloatFloatHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatFloatHashMap.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** TFloatFloatHashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- TFloatFloatHashMap.java 20 Sep 2003 17:06:40 -0000 1.14.2.1 *************** *** 142,146 **** */ public float put(float key, float value) { - byte previousState; float previous = (float)0; int index = insertionIndex(key); --- 142,145 ---- *************** *** 151,160 **** isNewMapping = false; } ! previousState = _states[index]; _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(previousState == FREE); } --- 150,159 ---- isNewMapping = false; } ! boolean wasFree = isFree(index); _set[index] = key; _states[index] = FULL; _values[index] = value; if (isNewMapping) { ! postInsertHook(wasFree); } *************** *** 205,216 **** public void clear() { super.clear(); - float[] keys = _set; - float[] vals = _values; - byte[] states = _states; ! for (int i = keys.length; i-- > 0;) { ! keys[i] = (float)0; ! vals[i] = (float)0; ! states[i] = FREE; } } --- 204,212 ---- public void clear() { super.clear(); ! for (int i = _set.length; i-- > 0;) { ! _set[i] = (float)0; ! _values[i] = (float)0; ! _states[i] = FREE; } } *************** *** 311,318 **** float[] vals = new float[size()]; float[] v = _values; - byte[] states = _states; for (int i = v.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { vals[j++] = v[i]; } --- 307,313 ---- float[] vals = new float[size()]; float[] v = _values; for (int i = v.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { vals[j++] = v[i]; } *************** *** 329,336 **** float[] keys = new float[size()]; float[] k = _set; - byte[] states = _states; for (int i = k.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { keys[j++] = k[i]; } --- 324,330 ---- float[] keys = new float[size()]; float[] k = _set; for (int i = k.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { keys[j++] = k[i]; } *************** *** 346,354 **** */ public boolean containsValue(float val) { - byte[] states = _states; float[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (states[i] == FULL && val == vals[i]) { return true; } --- 340,347 ---- */ public boolean containsValue(float val) { float[] vals = _values; for (int i = vals.length; i-- > 0;) { ! if (isInUse(i) && val == vals[i]) { return true; } *************** *** 387,394 **** */ public boolean forEachValue(TFloatProcedure procedure) { - byte[] states = _states; float[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(values[i])) { return false; } --- 380,386 ---- */ public boolean forEachValue(TFloatProcedure procedure) { float[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(values[i])) { return false; } *************** *** 406,414 **** */ public boolean forEachEntry(TFloatFloatProcedure procedure) { - byte[] states = _states; float[] keys = _set; float[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { return false; } --- 398,405 ---- */ public boolean forEachEntry(TFloatFloatProcedure procedure) { float[] keys = _set; float[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { return false; } *************** *** 426,434 **** public boolean retainEntries(TFloatFloatProcedure procedure) { boolean modified = false; - byte[] states = _states; float[] keys = _set; float[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; --- 417,424 ---- public boolean retainEntries(TFloatFloatProcedure procedure) { boolean modified = false; float[] keys = _set; float[] values = _values; for (int i = keys.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(keys[i],values[i])) { removeAt(i); modified = true; *************** *** 444,451 **** */ public void transformValues(TFloatFunction function) { - byte[] states = _states; float[] values = _values; for (int i = values.length; i-- > 0;) { ! if (states[i] == FULL) { values[i] = function.execute(values[i]); } --- 434,440 ---- */ public void transformValues(TFloatFunction function) { float[] values = _values; for (int i = values.length; i-- > 0;) { ! if (isInUse(i)) { values[i] = function.execute(values[i]); } Index: TFloatHash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatHash.java,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** TFloatHash.java 19 Mar 2003 04:17:03 -0000 1.13 --- TFloatHash.java 20 Sep 2003 17:06:40 -0000 1.13.2.1 *************** *** 152,159 **** */ public boolean forEach(TFloatProcedure procedure) { ! byte[] states = _states; ! float[] set = _set; ! for (int i = set.length; i-- > 0;) { ! if (states[i] == FULL && ! procedure.execute(set[i])) { return false; } --- 152,157 ---- */ public boolean forEach(TFloatProcedure procedure) { ! for (int i = _set.length; i-- > 0;) { ! if (isInUse(i) && ! procedure.execute(_set[i])) { return false; } *************** *** 181,194 **** int hash, probe, index, length; float[] set; - byte[] states; - states = _states; set = _set; ! length = states.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length; ! if (states[index] != FREE && ! (states[index] == REMOVED || set[index] != val)) { // see Knuth, p. 529 probe = 1 + (hash % (length - 2)); --- 179,190 ---- int hash, probe, index, length; float[] set; set = _set; ! length = set.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length; ! if (! isFree(index) && ! (isRemoved(index) || set[index] != val)) { // see Knuth, p. 529 probe = 1 + (hash % (length - 2)); *************** *** 199,207 **** index += length; } ! } while (states[index] != FREE && ! (states[index] == REMOVED || set[index] != val)); } ! return states[index] == FREE ? -1 : index; } --- 195,203 ---- index += length; } ! } while (! isFree(index) && ! (isRemoved(index) || set[index] != val)); } ! return isFree(index) ? -1 : index; } *************** *** 217,231 **** int hash, probe, index, length; float[] set; - byte[] states; - states = _states; set = _set; ! length = states.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length; ! if (states[index] == FREE) { return index; // empty, all done ! } else if (states[index] == FULL && set[index] == val) { return -index -1; // already stored } else { // already FULL or REMOVED, must probe --- 213,225 ---- int hash, probe, index, length; float[] set; set = _set; ! length = set.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length; ! if (isFree(index)) { return index; // empty, all done ! } else if (isInUse(index) && set[index] == val) { return -index -1; // already stored } else { // already FULL or REMOVED, must probe *************** *** 239,251 **** index += length; } ! } while (states[index] == FULL && set[index] != val); // if the index we found was removed: continue probing until we // locate a free location or an element which equal()s the // one we have. ! if (states[index] == REMOVED) { int firstRemoved = index; ! while (states[index] != FREE && ! (states[index] == REMOVED || set[index] != val)) { index -= probe; if (index < 0) { --- 233,245 ---- index += length; } ! } while (isInUse(index) && set[index] != val); // if the index we found was removed: continue probing until we // locate a free location or an element which equal()s the // one we have. ! if (isRemoved(index)) { int firstRemoved = index; ! while (! isFree(index) && ! (isRemoved(index) || set[index] != val)) { index -= probe; if (index < 0) { *************** *** 253,260 **** } } ! return states[index] == FULL ? -index -1 : firstRemoved; } // if it's full, the key is already stored ! return states[index] == FULL ? -index -1 : index; } } --- 247,254 ---- } } ! return isInUse(index) ? -index -1 : firstRemoved; } // if it's full, the key is already stored ! return isInUse(index) ? -index -1 : index; } } Index: TFloatHashSet.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatHashSet.java,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** TFloatHashSet.java 19 Mar 2003 04:17:03 -0000 1.11 --- TFloatHashSet.java 20 Sep 2003 17:06:40 -0000 1.11.2.1 *************** *** 145,152 **** } ! byte previousState = _states[index]; _set[index] = val; _states[index] = FULL; ! postInsertHook(previousState == FREE); return true; // yes, we added something --- 145,152 ---- } ! boolean wasFree = isFree(index); _set[index] = val; _states[index] = FULL; ! postInsertHook(wasFree); return true; // yes, we added something *************** *** 183,192 **** public float[] toArray() { float[] result = new float[size()]; - float[] set = _set; - byte[] states = _states; ! for (int i = states.length, j = 0; i-- > 0;) { ! if (states[i] == FULL) { ! result[j++] = set[i]; } } --- 183,190 ---- public float[] toArray() { float[] result = new float[size()]; ! for (int i = _set.length, j = 0; i-- > 0;) { ! if (isInUse(i)) { ! result[j++] = _set[i]; } } *************** *** 199,208 **** public void clear() { super.clear(); - float[] set = _set; - byte[] states = _states; ! for (int i = set.length; i-- > 0;) { ! set[i] = (float)0; ! states[i] = FREE; } } --- 197,204 ---- public void clear() { super.clear(); ! for (int i = _set.length; i-- > 0;) { ! _set[i] = (float)0; ! _states[i] = FREE; } } *************** *** 323,330 **** Arrays.sort(array); float[] set = _set; - byte[] states = _states; for (int i = set.length; i-- > 0;) { ! if (states[i] == FULL && (Arrays.binarySearch(array,set[i]) < 0)) { remove(set[i]); changed = true; --- 319,325 ---- Arrays.sort(array); float[] set = _set; for (int i = set.length; i-- > 0;) { ! if (isInUse(i) && (Arrays.binarySearch(array,set[i]) < 0)) { remove(set[i]); changed = true; Index: TFloatIntHashMap.java ====================================... [truncated message content] |
From: Eric F. <er...@us...> - 2003-09-15 13:56:58
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1:/tmp/cvs-serv1197 Modified Files: ChangeLog Log Message: added test testKeySetEqualsEquivalentSet and code to make it pass in THashMap.KeyView Index: ChangeLog =================================================================== RCS file: /cvsroot/trove4j/trove/ChangeLog,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ChangeLog 13 Aug 2003 02:18:01 -0000 1.22 --- ChangeLog 15 Sep 2003 13:56:50 -0000 1.23 *************** *** 4,7 **** --- 4,10 ---- for the bug report. + implemented equals()/hashCode() on THashMap.KeyView and (by extension) subclasses. + This allows the test in THashMapTests.testKeySetEqualsEquivalentSet to pass. + fix 787515 -- bug in T*ArrayList.set(int, *[], int, int) |
From: Eric F. <er...@us...> - 2003-09-15 13:56:58
|
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv1197/src/gnu/trove Modified Files: THashMap.java THashMapTests.java Log Message: added test testKeySetEqualsEquivalentSet and code to make it pass in THashMap.KeyView Index: THashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/THashMap.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** THashMap.java 23 Mar 2003 04:06:59 -0000 1.15 --- THashMap.java 15 Sep 2003 13:56:50 -0000 1.16 *************** *** 579,582 **** --- 579,601 ---- } + public int hashCode() { + int h = 0; + for (Iterator i = this.iterator(); i.hasNext();) { + h += i.next().hashCode(); + } + return h; + } + + public boolean equals(Object other) { + if (super.equals(other)) { + return true; + } else if (other instanceof Collection) { + Collection that = (Collection) other; + return this.size() == that.size() && this.containsAll(that); + } else { + return false; + } + } + public boolean remove(Object key) { return (null != THashMap.this.remove(key)); Index: THashMapTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/THashMapTests.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** THashMapTests.java 23 Mar 2003 04:06:59 -0000 1.13 --- THashMapTests.java 15 Sep 2003 13:56:50 -0000 1.14 *************** *** 354,356 **** --- 354,369 ---- assertTrue("expected THashMap to throw an IllegalArgumentException", didThrow); } + + public void testKeySetEqualsEquivalentSet() { + Set set = new java.util.HashSet(); + set.add("foo"); + set.add("doh"); + set.add("hal"); + + THashMap tv1 = new THashMap(); + tv1.put("doh", "blah"); + tv1.put("foo", "blah"); + tv1.put("hal", "notblah"); + assertTrue(tv1.keySet().equals(set)); + } } // THashMapTests |
From: Eric F. <er...@us...> - 2003-08-13 02:40:47
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1:/tmp/cvs-serv3286 Modified Files: ChangeLog Log Message: fix for bug in set method that performs a bulk array copy Index: ChangeLog =================================================================== RCS file: /cvsroot/trove4j/trove/ChangeLog,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ChangeLog 28 Jul 2003 13:53:30 -0000 1.21 --- ChangeLog 13 Aug 2003 02:18:01 -0000 1.22 *************** *** 4,7 **** --- 4,9 ---- for the bug report. + fix 787515 -- bug in T*ArrayList.set(int, *[], int, int) + v 1.0.2 |
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv3286/src/gnu/trove Modified Files: TDoubleArrayList.java TFloatArrayList.java TIntArrayList.java TIntArrayListTests.java TLongArrayList.java gen_primitive_list.pl Log Message: fix for bug in set method that performs a bulk array copy Index: TDoubleArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleArrayList.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TDoubleArrayList.java 19 Mar 2003 05:07:11 -0000 1.12 --- TDoubleArrayList.java 13 Aug 2003 02:18:01 -0000 1.13 *************** *** 297,301 **** throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(_data, offset, values, valOffset, length); } --- 297,301 ---- throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(values, valOffset, _data, offset, length); } Index: TFloatArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatArrayList.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TFloatArrayList.java 19 Mar 2003 05:07:11 -0000 1.12 --- TFloatArrayList.java 13 Aug 2003 02:18:01 -0000 1.13 *************** *** 297,301 **** throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(_data, offset, values, valOffset, length); } --- 297,301 ---- throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(values, valOffset, _data, offset, length); } Index: TIntArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayList.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TIntArrayList.java 19 Mar 2003 05:07:11 -0000 1.10 --- TIntArrayList.java 13 Aug 2003 02:18:01 -0000 1.11 *************** *** 300,304 **** throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(_data, offset, values, valOffset, length); } --- 300,304 ---- throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(values, valOffset, _data, offset, length); } Index: TIntArrayListTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayListTests.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TIntArrayListTests.java 19 Mar 2003 05:07:11 -0000 1.6 --- TIntArrayListTests.java 13 Aug 2003 02:18:01 -0000 1.7 *************** *** 99,102 **** --- 99,113 ---- } + public void testBulkSet() { + list.add(99); + list.add(0); + list.add(4); + list.add(3); + int[] d = new int[] { 1, 2 }; + list.set(1, d, 0, d.length); + assertEquals(1, list.get(1)); + assertEquals(2, list.get(2)); + } + public void testTransformValues() { int[] v = { 1, 2, 3 }; Index: TLongArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongArrayList.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TLongArrayList.java 19 Mar 2003 05:07:11 -0000 1.12 --- TLongArrayList.java 13 Aug 2003 02:18:01 -0000 1.13 *************** *** 297,301 **** throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(_data, offset, values, valOffset, length); } --- 297,301 ---- throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(values, valOffset, _data, offset, length); } Index: gen_primitive_list.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/gen_primitive_list.pl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gen_primitive_list.pl 19 Mar 2003 05:07:11 -0000 1.8 --- gen_primitive_list.pl 13 Aug 2003 02:18:01 -0000 1.9 *************** *** 318,322 **** throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(_data, offset, values, valOffset, length); } --- 318,322 ---- throw new ArrayIndexOutOfBoundsException(offset); } ! System.arraycopy(values, valOffset, _data, offset, length); } |
Update of /cvsroot/trove4j/trove/src/gnu/trove/decorator In directory sc8-pr-cvs1:/tmp/cvs-serv11665/src/gnu/trove/decorator Modified Files: TDoubleDoubleHashMapDecorator.java TDoubleFloatHashMapDecorator.java TDoubleHashSetDecorator.java TDoubleIntHashMapDecorator.java TDoubleLongHashMapDecorator.java TDoubleObjectHashMapDecorator.java TFloatDoubleHashMapDecorator.java TFloatFloatHashMapDecorator.java TFloatHashSetDecorator.java TFloatIntHashMapDecorator.java TFloatLongHashMapDecorator.java TFloatObjectHashMapDecorator.java TIntDoubleHashMapDecorator.java TIntFloatHashMapDecorator.java TIntHashSetDecorator.java TIntHashSetDecoratorTests.java TIntIntHashMapDecorator.java TIntIntHashMapDecoratorTests.java TIntLongHashMapDecorator.java TIntObjectHashMapDecorator.java TLongDoubleHashMapDecorator.java TLongFloatHashMapDecorator.java TLongHashSetDecorator.java TLongIntHashMapDecorator.java TLongLongHashMapDecorator.java TLongObjectHashMapDecorator.java TObjectDoubleHashMapDecorator.java TObjectFloatHashMapDecorator.java TObjectIntHashMapDecorator.java TObjectLongHashMapDecorator.java gen_map_decorators.pl gen_set_decorators.pl Log Message: fix for [ 778904 ] clone broken on decorator classes Added clone method to decorator classes along with appropriate unit tests. Index: TDoubleDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleDoubleHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TDoubleDoubleHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TDoubleDoubleHashMapDecorator.java 28 Jul 2003 13:50:56 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TDoubleDoubleHashMap copy = (TDoubleDoubleHashMap) _map.clone(); + return new TDoubleDoubleHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TDoubleFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleFloatHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TDoubleFloatHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TDoubleFloatHashMapDecorator.java 28 Jul 2003 13:50:56 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TDoubleFloatHashMap copy = (TDoubleFloatHashMap) _map.clone(); + return new TDoubleFloatHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TDoubleHashSetDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleHashSetDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TDoubleHashSetDecorator.java 25 Sep 2002 05:14:38 -0000 1.2 --- TDoubleHashSetDecorator.java 28 Jul 2003 13:50:56 -0000 1.3 *************** *** 55,58 **** --- 55,70 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TDoubleHashSet copy = (TDoubleHashSet) _set.clone(); + return new TDoubleHashSetDecorator(copy); + } + /** * Inserts a value into the set. Index: TDoubleIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleIntHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TDoubleIntHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TDoubleIntHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TDoubleIntHashMap copy = (TDoubleIntHashMap) _map.clone(); + return new TDoubleIntHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TDoubleLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleLongHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TDoubleLongHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TDoubleLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TDoubleLongHashMap copy = (TDoubleLongHashMap) _map.clone(); + return new TDoubleLongHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TDoubleObjectHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TDoubleObjectHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TDoubleObjectHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TDoubleObjectHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TDoubleObjectHashMap copy = (TDoubleObjectHashMap) _map.clone(); + return new TDoubleObjectHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TFloatDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatDoubleHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TFloatDoubleHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TFloatDoubleHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TFloatDoubleHashMap copy = (TFloatDoubleHashMap) _map.clone(); + return new TFloatDoubleHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TFloatFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatFloatHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TFloatFloatHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TFloatFloatHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TFloatFloatHashMap copy = (TFloatFloatHashMap) _map.clone(); + return new TFloatFloatHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TFloatHashSetDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatHashSetDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TFloatHashSetDecorator.java 25 Sep 2002 05:14:38 -0000 1.2 --- TFloatHashSetDecorator.java 28 Jul 2003 13:50:57 -0000 1.3 *************** *** 55,58 **** --- 55,70 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TFloatHashSet copy = (TFloatHashSet) _set.clone(); + return new TFloatHashSetDecorator(copy); + } + /** * Inserts a value into the set. Index: TFloatIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatIntHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TFloatIntHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TFloatIntHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TFloatIntHashMap copy = (TFloatIntHashMap) _map.clone(); + return new TFloatIntHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TFloatLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatLongHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TFloatLongHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TFloatLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TFloatLongHashMap copy = (TFloatLongHashMap) _map.clone(); + return new TFloatLongHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TFloatObjectHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TFloatObjectHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TFloatObjectHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TFloatObjectHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TFloatObjectHashMap copy = (TFloatObjectHashMap) _map.clone(); + return new TFloatObjectHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TIntDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntDoubleHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIntDoubleHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TIntDoubleHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TIntDoubleHashMap copy = (TIntDoubleHashMap) _map.clone(); + return new TIntDoubleHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TIntFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntFloatHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIntFloatHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TIntFloatHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TIntFloatHashMap copy = (TIntFloatHashMap) _map.clone(); + return new TIntFloatHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TIntHashSetDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntHashSetDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TIntHashSetDecorator.java 25 Sep 2002 05:14:38 -0000 1.2 --- TIntHashSetDecorator.java 28 Jul 2003 13:50:57 -0000 1.3 *************** *** 55,58 **** --- 55,70 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TIntHashSet copy = (TIntHashSet) _set.clone(); + return new TIntHashSetDecorator(copy); + } + /** * Inserts a value into the set. Index: TIntHashSetDecoratorTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntHashSetDecoratorTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIntHashSetDecoratorTests.java 25 Sep 2002 05:10:08 -0000 1.1 --- TIntHashSetDecoratorTests.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 50,53 **** --- 50,65 ---- } + public void testClone() throws Exception { + TIntHashSetDecorator s = new TIntHashSetDecorator(set); + set.add(1); + set.add(2); + Set s2 = (Set) s.clone(); + assertEquals(s, s2); + set.add(3); + assertTrue( ! s.equals(s2)); + s2.add(new Integer(3)); + assertEquals(s, s2); + } + public void testWrap() throws Exception { Set s = new TIntHashSetDecorator(set); Index: TIntIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntIntHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIntIntHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TIntIntHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TIntIntHashMap copy = (TIntIntHashMap) _map.clone(); + return new TIntIntHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TIntIntHashMapDecoratorTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntIntHashMapDecoratorTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIntIntHashMapDecoratorTests.java 25 Sep 2002 05:10:08 -0000 1.1 --- TIntIntHashMapDecoratorTests.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + public void testClone() throws Exception { + TIntIntHashMapDecorator m = new TIntIntHashMapDecorator(map); + map.put(1,1); + map.put(2,2); + Map m2 = (Map)m.clone(); + assertEquals(m, m2); + map.put(3,3); + assertTrue(! m.equals(m2)); + assertEquals(2, m2.size()); + assertEquals(3, m.size()); + } + public void testIterators() throws Exception { Map m = new TIntIntHashMapDecorator(map); Index: TIntLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntLongHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIntLongHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TIntLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TIntLongHashMap copy = (TIntLongHashMap) _map.clone(); + return new TIntLongHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TIntObjectHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TIntObjectHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIntObjectHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TIntObjectHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TIntObjectHashMap copy = (TIntObjectHashMap) _map.clone(); + return new TIntObjectHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TLongDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongDoubleHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TLongDoubleHashMapDecorator.java 25 Sep 2002 05:10:08 -0000 1.1 --- TLongDoubleHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TLongDoubleHashMap copy = (TLongDoubleHashMap) _map.clone(); + return new TLongDoubleHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TLongFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongFloatHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TLongFloatHashMapDecorator.java 25 Sep 2002 05:10:09 -0000 1.1 --- TLongFloatHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TLongFloatHashMap copy = (TLongFloatHashMap) _map.clone(); + return new TLongFloatHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TLongHashSetDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongHashSetDecorator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TLongHashSetDecorator.java 25 Sep 2002 05:14:38 -0000 1.2 --- TLongHashSetDecorator.java 28 Jul 2003 13:50:57 -0000 1.3 *************** *** 55,58 **** --- 55,70 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TLongHashSet copy = (TLongHashSet) _set.clone(); + return new TLongHashSetDecorator(copy); + } + /** * Inserts a value into the set. Index: TLongIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongIntHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TLongIntHashMapDecorator.java 25 Sep 2002 05:10:09 -0000 1.1 --- TLongIntHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TLongIntHashMap copy = (TLongIntHashMap) _map.clone(); + return new TLongIntHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TLongLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongLongHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TLongLongHashMapDecorator.java 25 Sep 2002 05:10:09 -0000 1.1 --- TLongLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TLongLongHashMap copy = (TLongLongHashMap) _map.clone(); + return new TLongLongHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TLongObjectHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TLongObjectHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TLongObjectHashMapDecorator.java 25 Sep 2002 05:10:09 -0000 1.1 --- TLongObjectHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TLongObjectHashMap copy = (TLongObjectHashMap) _map.clone(); + return new TLongObjectHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TObjectDoubleHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TObjectDoubleHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TObjectDoubleHashMapDecorator.java 25 Sep 2002 05:10:09 -0000 1.1 --- TObjectDoubleHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TObjectDoubleHashMap copy = (TObjectDoubleHashMap) _map.clone(); + return new TObjectDoubleHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TObjectFloatHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TObjectFloatHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TObjectFloatHashMapDecorator.java 25 Sep 2002 05:10:09 -0000 1.1 --- TObjectFloatHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TObjectFloatHashMap copy = (TObjectFloatHashMap) _map.clone(); + return new TObjectFloatHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TObjectIntHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TObjectIntHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TObjectIntHashMapDecorator.java 25 Sep 2002 05:10:09 -0000 1.1 --- TObjectIntHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TObjectIntHashMap copy = (TObjectIntHashMap) _map.clone(); + return new TObjectIntHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: TObjectLongHashMapDecorator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/TObjectLongHashMapDecorator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TObjectLongHashMapDecorator.java 25 Sep 2002 05:10:09 -0000 1.1 --- TObjectLongHashMapDecorator.java 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 58,61 **** --- 58,73 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + TObjectLongHashMap copy = (TObjectLongHashMap) _map.clone(); + return new TObjectLongHashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: gen_map_decorators.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/gen_map_decorators.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gen_map_decorators.pl 25 Sep 2002 05:10:09 -0000 1.1 --- gen_map_decorators.pl 28 Jul 2003 13:50:57 -0000 1.2 *************** *** 96,99 **** --- 96,111 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + T<KeyType><ValueType>HashMap copy = (T<KeyType><ValueType>HashMap) _map.clone(); + return new T<KeyType><ValueType>HashMapDecorator(copy); + } + /** * Inserts a key/value pair into the map. Index: gen_set_decorators.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/decorator/gen_set_decorators.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gen_set_decorators.pl 25 Sep 2002 05:14:38 -0000 1.2 --- gen_set_decorators.pl 28 Jul 2003 13:50:57 -0000 1.3 *************** *** 84,87 **** --- 84,99 ---- } + /** + * Clones the underlying trove collection and returns the clone wrapped in a new + * decorator instance. This is a shallow clone except where primitives are + * concerned. + * + * @return a copy of the receiver + */ + public Object clone() { + T<Type>HashSet copy = (T<Type>HashSet) _set.clone(); + return new T<Type>HashSetDecorator(copy); + } + /** * Inserts a value into the set. |
From: Eric F. <er...@us...> - 2003-07-28 14:13:50
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1:/tmp/cvs-serv11665 Modified Files: build.xml Log Message: fix for [ 778904 ] clone broken on decorator classes Added clone method to decorator classes along with appropriate unit tests. Index: build.xml =================================================================== RCS file: /cvsroot/trove4j/trove/build.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** build.xml 23 Mar 2003 04:07:22 -0000 1.27 --- build.xml 28 Jul 2003 13:50:56 -0000 1.28 *************** *** 10,14 **** <property name="Name" value="GNU Trove for Java"/> <property name="name" value="trove"/> ! <property name="version" value="1.0.2"/> <property name="year" value="2001-2002"/> --- 10,14 ---- <property name="Name" value="GNU Trove for Java"/> <property name="name" value="trove"/> ! <property name="version" value="1.1"/> <property name="year" value="2001-2002"/> |
From: Eric F. <er...@us...> - 2003-07-28 13:56:57
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1:/tmp/cvs-serv12196 Modified Files: ChangeLog Log Message: 1.1 updates Index: ChangeLog =================================================================== RCS file: /cvsroot/trove4j/trove/ChangeLog,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ChangeLog 28 Jul 2003 13:48:42 -0000 1.20 --- ChangeLog 28 Jul 2003 13:53:30 -0000 1.21 *************** *** 1,2 **** --- 1,7 ---- + v 1.1 + + added clone() methods to decorator classes. Thanks to Steve Lunt + for the bug report. + v 1.0.2 |
From: Eric F. <er...@us...> - 2003-07-28 13:48:45
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1:/tmp/cvs-serv11359 Modified Files: ChangeLog Log Message: added comments that should have been included with 1.0.2 Index: ChangeLog =================================================================== RCS file: /cvsroot/trove4j/trove/ChangeLog,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ChangeLog 25 Sep 2002 05:20:29 -0000 1.19 --- ChangeLog 28 Jul 2003 13:48:42 -0000 1.20 *************** *** 1,2 **** --- 1,12 ---- + v 1.0.2 + + revamped versioning scheme + + added hashCode implementation to collections so that they can appear in collections + too. + + added check+exception to detect violations of the equals() <-> hashCode() contract + specified in java.lang.Object's api. + v 0.1.8 |
From: Eric F. <er...@us...> - 2003-03-23 04:07:25
|
Update of /cvsroot/trove4j/trove In directory sc8-pr-cvs1:/tmp/cvs-serv9003 Modified Files: build.xml Log Message: Index: build.xml =================================================================== RCS file: /cvsroot/trove4j/trove/build.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** build.xml 19 Mar 2003 05:07:11 -0000 1.26 --- build.xml 23 Mar 2003 04:07:22 -0000 1.27 *************** *** 10,14 **** <property name="Name" value="GNU Trove for Java"/> <property name="name" value="trove"/> ! <property name="version" value="1.0.1"/> <property name="year" value="2001-2002"/> --- 10,14 ---- <property name="Name" value="GNU Trove for Java"/> <property name="name" value="trove"/> ! <property name="version" value="1.0.2"/> <property name="year" value="2001-2002"/> |
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv8804 Modified Files: THashMap.java THashMapTests.java THashSet.java THashSetTests.java TIdentityHashMapTests.java TIdentityHashSetTests.java TObjectDoubleHashMap.java TObjectDoubleHashMapTests.java TObjectFloatHashMap.java TObjectHash.java TObjectIntHashMap.java TObjectLongHashMap.java gen_obj_primitive_map.pl Log Message: added exception foo for badly written objects in hash collections Index: THashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/THashMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** THashMap.java 19 Mar 2003 04:17:03 -0000 1.14 --- THashMap.java 23 Mar 2003 04:06:59 -0000 1.15 *************** *** 344,347 **** --- 344,350 ---- Object o = oldKeys[i]; int index = insertionIndex(o); + if (index < 0) { + throwObjectContractViolation(_set[(-index -1)], o); + } _set[index] = o; _values[index] = oldVals[i]; Index: THashMapTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/THashMapTests.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** THashMapTests.java 19 Mar 2003 04:17:03 -0000 1.12 --- THashMapTests.java 23 Mar 2003 04:06:59 -0000 1.13 *************** *** 342,344 **** --- 342,356 ---- assertTrue(! m1.equals(m2)); } + + public void testBadlyWrittenKey() { + boolean didThrow = false; + try { + for (int i = 0; i < 1000; i++) { // enough to trigger a rehash + map.put(new THashSetTests.Crap(), new Integer(i)); + } + } catch (IllegalArgumentException e) { + didThrow = true; + } + assertTrue("expected THashMap to throw an IllegalArgumentException", didThrow); + } } // THashMapTests Index: THashSet.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/THashSet.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** THashSet.java 19 Mar 2003 04:17:04 -0000 1.10 --- THashSet.java 23 Mar 2003 04:06:59 -0000 1.11 *************** *** 194,197 **** --- 194,200 ---- Object o = oldSet[i]; int index = insertionIndex(o); + if (index < 0) { // everyone pays for this because some people can't RTFM + throwObjectContractViolation(_set[(-index -1)], o); + } _set[index] = o; } Index: THashSetTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/THashSetTests.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** THashSetTests.java 18 Aug 2002 16:43:14 -0000 1.5 --- THashSetTests.java 23 Mar 2003 04:06:59 -0000 1.6 *************** *** 180,182 **** --- 180,217 ---- } } + + /** + * this tests that we throw when people violate the + * general contract for hashcode on java.lang.Object + */ + public void testSomeBadlyWrittenObject() { + boolean didThrow = false; + try { + for (int i = 0; i < 101; i++) { + s.add(new Crap()); + } + } catch (IllegalArgumentException e) { + didThrow = true; + } + assertTrue("expected THashSet to throw an IllegalArgumentException", didThrow); + } + + // in this junk class, all instances hash to the same + // address, but some objects claim to be equal where + // others do not. + public static class Crap { + static int count = 0; + public boolean equals(Object other) { + if (count++ == 100) return true; + return false; + } + + public int hashCode() { + return 1; + } + } + + public static void main(String[] args) throws Exception { + junit.textui.TestRunner.run(new THashSetTests("testBadlyWrittenObject")); + } } // THashSetTests Index: TIdentityHashMapTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIdentityHashMapTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIdentityHashMapTests.java 18 Aug 2002 16:43:14 -0000 1.1 --- TIdentityHashMapTests.java 23 Mar 2003 04:06:59 -0000 1.2 *************** *** 32,34 **** --- 32,38 ---- assertTrue(! map.containsKey(i2)); } + + public void testBadlyWrittenKey() { + ; // this test not applicable in identity hashing + } } // TIdentityHashMapTests Index: TIdentityHashSetTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIdentityHashSetTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIdentityHashSetTests.java 18 Aug 2002 16:43:14 -0000 1.1 --- TIdentityHashSetTests.java 23 Mar 2003 04:06:59 -0000 1.2 *************** *** 22,24 **** --- 22,28 ---- s = new THashSet(new TObjectIdentityHashingStrategy()); } + + public void testSomeBadlyWrittenObject() { + ; // this test doesn't apply to identity sets + } } // TIdentityHashSetTests Index: TObjectDoubleHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TObjectDoubleHashMap.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TObjectDoubleHashMap.java 22 Sep 2002 21:53:42 -0000 1.12 --- TObjectDoubleHashMap.java 23 Mar 2003 04:06:59 -0000 1.13 *************** *** 168,171 **** --- 168,174 ---- Object o = oldKeys[i]; int index = insertionIndex(o); + if (index < 0) { + throwObjectContractViolation(_set[(-index -1)], o); + } _set[index] = o; _values[index] = oldVals[i]; Index: TObjectDoubleHashMapTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TObjectDoubleHashMapTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TObjectDoubleHashMapTests.java 27 Nov 2001 15:38:16 -0000 1.1 --- TObjectDoubleHashMapTests.java 23 Mar 2003 04:06:59 -0000 1.2 *************** *** 57,60 **** --- 57,74 ---- } } + + public void testBadlyWrittenKey() { + TObjectDoubleHashMap map = new TObjectDoubleHashMap(); + boolean didThrow = false; + try { + for (int i = 0; i < 1000; i++) { // enough to trigger a rehash + map.put(new THashSetTests.Crap(), 0.0d); + } + } catch (IllegalArgumentException e) { + didThrow = true; + } + assertTrue("expected TObjectDoubleHashMap to throw an IllegalArgumentException", didThrow); + } + } // TObjectDoubleHashMapTests Index: TObjectFloatHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TObjectFloatHashMap.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TObjectFloatHashMap.java 22 Sep 2002 21:53:42 -0000 1.12 --- TObjectFloatHashMap.java 23 Mar 2003 04:06:59 -0000 1.13 *************** *** 168,171 **** --- 168,174 ---- Object o = oldKeys[i]; int index = insertionIndex(o); + if (index < 0) { + throwObjectContractViolation(_set[(-index -1)], o); + } _set[index] = o; _values[index] = oldVals[i]; Index: TObjectHash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TObjectHash.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TObjectHash.java 19 Mar 2003 04:17:04 -0000 1.14 --- TObjectHash.java 23 Mar 2003 04:06:59 -0000 1.15 *************** *** 299,301 **** --- 299,327 ---- return o1.equals(o2); } + + /** + * Convenience methods for subclasses to use in throwing exceptions about + * badly behaved user objects employed as keys. We have to throw an + * IllegalArgumentException with a rather verbose message telling the + * user that they need to fix their object implementation to conform + * to the general contract for java.lang.Object. + * + * @param o1 the first of the equal elements with unequal hash codes. + * @param o2 the second of the equal elements with unequal hash codes. + * @exception IllegalArgumentException the whole point of this method. + */ + protected final void throwObjectContractViolation(Object o1, Object o2) + throws IllegalArgumentException { + throw new IllegalArgumentException("Equal objects must have equal hashcodes. " + + "During rehashing, Trove discovered that " + + "the following two objects claim to be " + + "equal (as in java.lang.Object.equals()) " + + "but their hashCodes (or those calculated by " + + "your TObjectHashingStrategy) are not equal." + + "This violates the general contract of " + + "java.lang.Object.hashCode(). See bullet point two " + + "in that method's documentation. " + + "object #1 =" + o1 + + "; object #2 =" + o2); + } } // TObjectHash Index: TObjectIntHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TObjectIntHashMap.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TObjectIntHashMap.java 22 Sep 2002 21:53:42 -0000 1.12 --- TObjectIntHashMap.java 23 Mar 2003 04:06:59 -0000 1.13 *************** *** 168,171 **** --- 168,174 ---- Object o = oldKeys[i]; int index = insertionIndex(o); + if (index < 0) { + throwObjectContractViolation(_set[(-index -1)], o); + } _set[index] = o; _values[index] = oldVals[i]; Index: TObjectLongHashMap.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TObjectLongHashMap.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TObjectLongHashMap.java 22 Sep 2002 21:53:42 -0000 1.12 --- TObjectLongHashMap.java 23 Mar 2003 04:07:00 -0000 1.13 *************** *** 168,171 **** --- 168,174 ---- Object o = oldKeys[i]; int index = insertionIndex(o); + if (index < 0) { + throwObjectContractViolation(_set[(-index -1)], o); + } _set[index] = o; _values[index] = oldVals[i]; Index: gen_obj_primitive_map.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/gen_obj_primitive_map.pl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gen_obj_primitive_map.pl 22 Sep 2002 21:53:42 -0000 1.6 --- gen_obj_primitive_map.pl 23 Mar 2003 04:07:00 -0000 1.7 *************** *** 263,266 **** --- 263,269 ---- Object o = oldKeys[i]; int index = insertionIndex(o); + if (index < 0) { + throwObjectContractViolation(_set[(-index -1)], o); + } _set[index] = o; _values[index] = oldVals[i]; |
Update of /cvsroot/trove4j/trove/src/gnu/trove In directory sc8-pr-cvs1:/tmp/cvs-serv1899/src/gnu/trove Modified Files: TDoubleArrayList.java TFloatArrayList.java TIntArrayList.java TIntArrayListTests.java TLongArrayList.java gen_primitive_list.pl Log Message: hashCode in primitive lists Index: TDoubleArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TDoubleArrayList.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TDoubleArrayList.java 10 Jan 2003 14:34:54 -0000 1.11 --- TDoubleArrayList.java 19 Mar 2003 05:07:11 -0000 1.12 *************** *** 548,551 **** --- 548,559 ---- } + public int hashCode() { + int h = 0; + for (int i = _pos; i-- > 0;) { + h += HashFunctions.hash(_data[i]); + } + return h; + } + // procedures Index: TFloatArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TFloatArrayList.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TFloatArrayList.java 10 Jan 2003 14:34:54 -0000 1.11 --- TFloatArrayList.java 19 Mar 2003 05:07:11 -0000 1.12 *************** *** 548,551 **** --- 548,559 ---- } + public int hashCode() { + int h = 0; + for (int i = _pos; i-- > 0;) { + h += HashFunctions.hash(_data[i]); + } + return h; + } + // procedures Index: TIntArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayList.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TIntArrayList.java 10 Jan 2003 14:34:54 -0000 1.9 --- TIntArrayList.java 19 Mar 2003 05:07:11 -0000 1.10 *************** *** 552,555 **** --- 552,563 ---- } + public int hashCode() { + int h = 0; + for (int i = _pos; i-- > 0;) { + h += _data[i]; + } + return h; + } + // procedures Index: TIntArrayListTests.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TIntArrayListTests.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TIntArrayListTests.java 19 Mar 2003 04:17:04 -0000 1.5 --- TIntArrayListTests.java 19 Mar 2003 05:07:11 -0000 1.6 *************** *** 358,362 **** public void testDeepClone() { TIntArrayList l1, l2; - l1 = new TIntArrayList(); l1.add(new int[] { 1, 2, 3, 4 }); --- 358,361 ---- *************** *** 375,378 **** --- 374,389 ---- assertEquals(list.get(4), target[0]); assertEquals(list.get(5), target[1]); + } + + public void testHashCode() { + TIntArrayList l1, l2; + l1 = new TIntArrayList(); + l1.add(new int[] { 1, 2, 3, 4 }); + l2 = new TIntArrayList(); + l2.add(new int[] { 1, 2, 3, 4 }); + + assertTrue(l1.hashCode() == l2.hashCode()); + l2.add(6); + assertTrue(l1.hashCode() != l2.hashCode()); } Index: TLongArrayList.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/TLongArrayList.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TLongArrayList.java 10 Jan 2003 14:34:54 -0000 1.11 --- TLongArrayList.java 19 Mar 2003 05:07:11 -0000 1.12 *************** *** 548,551 **** --- 548,559 ---- } + public int hashCode() { + int h = 0; + for (int i = _pos; i-- > 0;) { + h += HashFunctions.hash(_data[i]); + } + return h; + } + // procedures Index: gen_primitive_list.pl =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/gen_primitive_list.pl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gen_primitive_list.pl 10 Jan 2003 14:34:55 -0000 1.7 --- gen_primitive_list.pl 19 Mar 2003 05:07:11 -0000 1.8 *************** *** 569,572 **** --- 569,580 ---- } + public int hashCode() { + int h = 0; + for (int i = _pos; i-- > 0;) { + h += HashFunctions.hash(_data[i]); + } + return h; + } + // procedures |