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: Rob E. <ro...@us...> - 2009-10-09 02:46:16
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/map/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7501/trove/templates/gnu/trove/map/hash Modified Files: Tag: TROVE_3_WORKING _K__V_HashMap.template _E_ObjectHashMap.template Log Message: Back out builder changes. Index: _K__V_HashMap.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/map/hash/Attic/_K__V_HashMap.template,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -C2 -d -r1.1.2.10 -r1.1.2.11 *** _K__V_HashMap.template 9 Oct 2009 01:44:34 -0000 1.1.2.10 --- _K__V_HashMap.template 9 Oct 2009 02:46:07 -0000 1.1.2.11 *************** *** 34,38 **** import gnu.trove.impl.hash.*; import gnu.trove.impl.HashFunctions; - import gnu.trove.impl.Constants; import gnu.trove.*; --- 34,37 ---- *************** *** 51,57 **** static final long serialVersionUID = 1L; - /** a default builder object to use when none is specified. */ - private static final Builder<#KT#, #VT#> DEFAULT_BUILDER = new Builder<#KT#, #VT#>(); - /** the values of the map */ protected transient #v#[] _values; --- 50,53 ---- *************** *** 63,85 **** */ public T#K##V#HashMap() { ! this( DEFAULT_BUILDER ); } /** ! * Creates a new <code>TIntLongHashMap</code> instance with a prime ! * capacity equal to or greater than the <tt>initialCapacity</tt> ! * specified . * ! * @param builder describes the configurable parameters. */ ! public T#K##V#HashMap( Builder<? extends #KT#, ? extends #VT#> builder ) { ! super( builder.getInitialCapacity(), builder.getLoadFactor(), ! builder.getNoEntryKey() == null ? ! Constants.DEFAULT_#KC#_NO_ENTRY_VALUE : ! builder.getNoEntryKey().#k#Value(), ! builder.getNoEntryValue() == null ? ! Constants.DEFAULT_#VC#_NO_ENTRY_VALUE : ! builder.getNoEntryValue().#v#Value() ); } --- 59,106 ---- */ public T#K##V#HashMap() { ! super(); } /** ! * Creates a new <code>T#K##V#HashMap</code> instance with a prime ! * capacity equal to or greater than <tt>initialCapacity</tt> and ! * with the default load factor. * ! * @param initialCapacity an <code>int</code> value */ ! public T#K##V#HashMap( int initialCapacity ) { ! super( initialCapacity ); ! } ! ! ! /** ! * Creates a new <code>T#K##V#HashMap</code> instance with a prime ! * capacity equal to or greater than <tt>initialCapacity</tt> and ! * with the specified load factor. ! * ! * @param initialCapacity an <code>int</code> value ! * @param loadFactor a <code>float</code> value ! */ ! public T#K##V#HashMap( int initialCapacity, float loadFactor ) { ! super( initialCapacity, loadFactor ); ! } ! ! ! /** ! * Creates a new <code>T#K##V#HashMap</code> instance with a prime ! * capacity equal to or greater than <tt>initialCapacity</tt> and ! * with the specified load factor. ! * ! * @param initialCapacity an <code>int</code> value ! * @param loadFactor a <code>float</code> value ! * @param noEntryKey a <code>#k#</code> value that represents ! * <tt>null</tt> for the Key set. ! * @param noEntryValue a <code>#v#</code> value that represents ! * <tt>null</tt> for the Value set. ! */ ! public T#K##V#HashMap( int initialCapacity, float loadFactor, ! #k# noEntryKey, #v# noEntryValue ) { ! super( initialCapacity, loadFactor, noEntryKey, noEntryValue ); } *************** *** 89,99 **** * all of the entries in the map passed in. * - * @param builder describes of the customizable values desired. * @param keys a <tt>#k#</tt> array containing the keys for the matching values. * @param values a <tt>#v#</tt> array containing the values. */ ! public T#K##V#HashMap( Builder<? extends #KT#, ? extends #VT#> builder, ! #k#[] keys, #v#[] values ) { ! this( builder == null ? DEFAULT_BUILDER : builder ); int size = Math.min( keys.length, values.length ); --- 110,118 ---- * all of the entries in the map passed in. * * @param keys a <tt>#k#</tt> array containing the keys for the matching values. * @param values a <tt>#v#</tt> array containing the values. */ ! public T#K##V#HashMap( #k#[] keys, #v#[] values ) { ! super( Math.max( keys.length, values.length ) ); int size = Math.min( keys.length, values.length ); *************** *** 111,123 **** */ public T#K##V#HashMap( T#K##V#Map map ) { ! this( new Builder<#KT#, #VT#>(). ! setInitialCapacity( Math.max( map.size(), DEFAULT_CAPACITY ) ). ! setNoEntryKey( map.getNoEntryKey() ). ! setNoEntryValue( map.getNoEntryValue() ) ); if ( map instanceof T#K##V#HashMap ) { T#K##V#HashMap hashmap = ( T#K##V#HashMap ) map; this._loadFactor = hashmap._loadFactor; ! int size = Math.max( map.size(), DEFAULT_CAPACITY ); ! setUp( (int) Math.ceil( size / _loadFactor ) ); } putAll( map ); --- 130,148 ---- */ public T#K##V#HashMap( T#K##V#Map map ) { ! super( map.size() ); if ( map instanceof T#K##V#HashMap ) { T#K##V#HashMap hashmap = ( T#K##V#HashMap ) map; this._loadFactor = hashmap._loadFactor; ! this.no_entry_key = hashmap.no_entry_key; ! this.no_entry_value = hashmap.no_entry_value; ! //noinspection RedundantCast ! if ( this.no_entry_key != ( #k# ) 0 ) { ! Arrays.fill( _set, this.no_entry_key ); ! } ! //noinspection RedundantCast ! if ( this.no_entry_value != ( #v# ) 0 ) { ! Arrays.fill( _values, this.no_entry_value ); ! } ! setUp( (int) Math.ceil( DEFAULT_CAPACITY / _loadFactor ) ); } putAll( map ); Index: _E_ObjectHashMap.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/map/hash/Attic/_E_ObjectHashMap.template,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** _E_ObjectHashMap.template 9 Oct 2009 01:44:34 -0000 1.1.2.5 --- _E_ObjectHashMap.template 9 Oct 2009 02:46:07 -0000 1.1.2.6 *************** *** 34,38 **** import gnu.trove.set.T#E#Set; import gnu.trove.T#E#Collection; - import gnu.trove.Builder; import java.io.*; --- 34,37 ---- *************** *** 59,65 **** static final long serialVersionUID = 1L; - /** a default builder object to use when none is specified. */ - private static final Builder<#ET#, ?> DEFAULT_BUILDER = new Builder<#ET#, Object>(); - private final T#E#ObjectProcedure<V> PUT_ALL_PROC = new T#E#ObjectProcedure<V>() { public boolean execute( #e# key, V value) { --- 58,61 ---- *************** *** 81,85 **** */ public T#E#ObjectHashMap() { ! this( ( Builder<#ET#, V> ) DEFAULT_BUILDER ); } --- 77,81 ---- */ public T#E#ObjectHashMap() { ! super(); } *************** *** 87,103 **** /** * Creates a new <code>T#E#ObjectHashMap</code> instance with a prime ! * value at or near the specified capacity and load factor. * ! * @param builder describes the configurable parameters. */ ! public T#E#ObjectHashMap( Builder<#ET#, V> builder ) { ! super( builder.getInitialCapacity(), builder.getLoadFactor(), ! builder.getNoEntryKey() == null ? ! Constants.DEFAULT_#EC#_NO_ENTRY_VALUE : ! builder.getNoEntryKey().#e#Value()); ! this.no_entry_value = builder.getNoEntryKey() == null ? ! Constants.DEFAULT_#EC#_NO_ENTRY_VALUE : ! builder.getNoEntryKey().#e#Value(); } --- 83,123 ---- /** * Creates a new <code>T#E#ObjectHashMap</code> instance with a prime ! * capacity equal to or greater than <tt>initialCapacity</tt> and ! * with the default load factor. * ! * @param initialCapacity an <code>int</code> value */ ! public T#E#ObjectHashMap( int initialCapacity ) { ! super( initialCapacity ); ! no_entry_key = Constants.DEFAULT_#EC#_NO_ENTRY_VALUE; ! } ! ! /** ! * Creates a new <code>T#E#ObjectHashMap</code> instance with a prime ! * capacity equal to or greater than <tt>initialCapacity</tt> and ! * with the specified load factor. ! * ! * @param initialCapacity an <code>int</code> value ! * @param loadFactor a <code>float</code> value ! */ ! public T#E#ObjectHashMap( int initialCapacity, float loadFactor ) { ! super( initialCapacity, loadFactor ); ! no_entry_key = Constants.DEFAULT_#EC#_NO_ENTRY_VALUE; ! } ! ! ! /** ! * Creates a new <code>T#E#ObjectHashMap</code> instance with a prime ! * value at or near the specified capacity and load factor. ! * ! * @param initialCapacity used to find a prime capacity for the table. ! * @param loadFactor used to calculate the threshold over which ! * rehashing takes place. ! * @param noEntryKey the value used to represent null in the key set. ! */ ! public T#E#ObjectHashMap( int initialCapacity, float loadFactor, #e# noEntryKey ) { ! super( initialCapacity, loadFactor ); ! this.no_entry_value = noEntryKey; } *************** *** 110,122 **** */ public T#E#ObjectHashMap( T#E#ObjectMap<V> map ) { ! this( new Builder<#ET#, V>(). ! setInitialCapacity( Math.max( map.size(), DEFAULT_CAPACITY ) ). ! setNoEntryKey( map.getNoEntryKey() ) ); ! if ( map instanceof T#E#ObjectHashMap ) { ! T#E#ObjectHashMap hashmap = ( T#E#ObjectHashMap ) map; ! this._loadFactor = hashmap._loadFactor; ! int size = Math.max( map.size(), DEFAULT_CAPACITY ); ! setUp( (int) Math.ceil( size / _loadFactor ) ); ! } putAll( map ); } --- 130,134 ---- */ public T#E#ObjectHashMap( T#E#ObjectMap<V> map ) { ! this( map.size(), 0.5f, map.getNoEntryKey() ); putAll( map ); } |
From: Rob E. <ro...@us...> - 2009-10-09 01:45:11
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31693/trove/templates/gnu/trove Modified Files: Tag: TROVE_3_WORKING TCollections.template Log Message: Clean up warning suppression anotation. Index: TCollections.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/Attic/TCollections.template,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** TCollections.template 3 Oct 2009 02:45:47 -0000 1.1.2.3 --- TCollections.template 9 Oct 2009 01:45:00 -0000 1.1.2.4 *************** *** 38,42 **** * Trove equivalent of the {@link java.util.Collections} class. */ ! @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass", "JavaDoc"}) public class TCollections { --- 38,42 ---- * Trove equivalent of the {@link java.util.Collections} class. */ ! @SuppressWarnings({"UnusedDeclaration"}) public class TCollections { |
From: Rob E. <ro...@us...> - 2009-10-09 01:44:46
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/map/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31623/trove/templates/gnu/trove/map/hash Modified Files: Tag: TROVE_3_WORKING _K__V_HashMap.template _E_ObjectHashMap.template Log Message: Moves some classes and pull TPrimitiveIterator into an interface. This allows hiding setup(int) and removeAt(int) methods in hash maps and set. Index: _K__V_HashMap.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/map/hash/Attic/_K__V_HashMap.template,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -C2 -d -r1.1.2.9 -r1.1.2.10 *** _K__V_HashMap.template 2 Oct 2009 00:37:31 -0000 1.1.2.9 --- _K__V_HashMap.template 9 Oct 2009 01:44:34 -0000 1.1.2.10 *************** *** 1034,1038 **** ! class T#K##V#KeyHashIterator extends TPrimitiveIterator implements T#K#Iterator { /** --- 1034,1038 ---- ! class T#K##V#KeyHashIterator extends THashPrimitiveIterator implements T#K#Iterator { /** *************** *** 1072,1076 **** ! class T#K##V#ValueHashIterator extends TPrimitiveIterator implements T#V#Iterator { /** --- 1072,1076 ---- ! class T#K##V#ValueHashIterator extends THashPrimitiveIterator implements T#V#Iterator { /** *************** *** 1109,1113 **** ! class T#K##V#HashIterator extends TPrimitiveIterator implements T#K##V#Iterator { /** --- 1109,1113 ---- ! class T#K##V#HashIterator extends THashPrimitiveIterator implements T#K##V#Iterator { /** Index: _E_ObjectHashMap.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/map/hash/Attic/_E_ObjectHashMap.template,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** _E_ObjectHashMap.template 27 Sep 2009 06:23:59 -0000 1.1.2.4 --- _E_ObjectHashMap.template 9 Oct 2009 01:44:34 -0000 1.1.2.5 *************** *** 24,28 **** import gnu.trove.impl.Constants; import gnu.trove.impl.HashFunctions; ! import gnu.trove.impl.hash.T#E#Hash; import gnu.trove.procedure.T#E#ObjectProcedure; import gnu.trove.procedure.T#E#Procedure; --- 24,28 ---- import gnu.trove.impl.Constants; import gnu.trove.impl.HashFunctions; ! import gnu.trove.impl.hash.*; import gnu.trove.procedure.T#E#ObjectProcedure; import gnu.trove.procedure.T#E#Procedure; *************** *** 30,34 **** import gnu.trove.iterator.T#E#Iterator; import gnu.trove.iterator.T#E#ObjectIterator; ! import gnu.trove.iterator.hash.TPrimitiveIterator; import gnu.trove.function.TObjectFunction; import gnu.trove.set.T#E#Set; --- 30,34 ---- import gnu.trove.iterator.T#E#Iterator; import gnu.trove.iterator.T#E#ObjectIterator; ! import gnu.trove.iterator.TPrimitiveIterator; import gnu.trove.function.TObjectFunction; import gnu.trove.set.T#E#Set; *************** *** 123,130 **** - // TODO: review and see if we can make this at least protected. /** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) ! public int setUp( int initialCapacity ) { int capacity; --- 123,129 ---- /** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) ! protected int setUp( int initialCapacity ) { int capacity; *************** *** 742,746 **** ! class T#E#HashIterator extends TPrimitiveIterator implements T#E#Iterator { /** the collection on which the iterator operates */ --- 741,745 ---- ! class T#E#HashIterator extends THashPrimitiveIterator implements T#E#Iterator { /** the collection on which the iterator operates */ *************** *** 794,798 **** } ! class T#E#ObjectValueHashIterator extends TPrimitiveIterator implements Iterator<V> { protected final T#E#ObjectHashMap _map; --- 793,797 ---- } ! class T#E#ObjectValueHashIterator extends THashPrimitiveIterator implements Iterator<V> { protected final T#E#ObjectHashMap _map; *************** *** 906,910 **** ! class T#E#ObjectHashIterator<V> extends TPrimitiveIterator implements T#E#ObjectIterator<V> { --- 905,909 ---- ! class T#E#ObjectHashIterator<V> extends THashPrimitiveIterator implements T#E#ObjectIterator<V> { |
From: Rob E. <ro...@us...> - 2009-10-09 01:44:46
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/set/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31623/trove/templates/gnu/trove/set/hash Modified Files: Tag: TROVE_3_WORKING _E_HashSet.template Log Message: Moves some classes and pull TPrimitiveIterator into an interface. This allows hiding setup(int) and removeAt(int) methods in hash maps and set. Index: _E_HashSet.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/set/hash/Attic/_E_HashSet.template,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -C2 -d -r1.1.2.8 -r1.1.2.9 *** _E_HashSet.template 27 Sep 2009 06:23:59 -0000 1.1.2.8 --- _E_HashSet.template 9 Oct 2009 01:44:34 -0000 1.1.2.9 *************** *** 23,29 **** import gnu.trove.set.T#E#Set; import gnu.trove.iterator.T#E#Iterator; ! import gnu.trove.iterator.hash.TPrimitiveIterator; import gnu.trove.impl.*; ! import gnu.trove.impl.hash.T#E#Hash; import gnu.trove.T#E#Collection; import gnu.trove.Builder; --- 23,29 ---- import gnu.trove.set.T#E#Set; import gnu.trove.iterator.T#E#Iterator; ! import gnu.trove.iterator.TPrimitiveIterator; import gnu.trove.impl.*; ! import gnu.trove.impl.hash.*; import gnu.trove.T#E#Collection; import gnu.trove.Builder; *************** *** 456,460 **** ! class T#E#HashIterator extends TPrimitiveIterator implements T#E#Iterator { /** the collection on which the iterator operates */ --- 456,460 ---- ! class T#E#HashIterator extends THashPrimitiveIterator implements T#E#Iterator { /** the collection on which the iterator operates */ |
From: Rob E. <ro...@us...> - 2009-10-09 01:44:46
|
Update of /cvsroot/trove4j/trove/src/gnu/trove/impl/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31623/trove/src/gnu/trove/impl/hash Modified Files: Tag: TROVE_3_WORKING TPrimitiveHash.java THash.java Added Files: Tag: TROVE_3_WORKING THashPrimitiveIterator.java THashIterator.java Log Message: Moves some classes and pull TPrimitiveIterator into an interface. This allows hiding setup(int) and removeAt(int) methods in hash maps and set. --- NEW FILE: THashPrimitiveIterator.java --- // //////////////////////////////////////////////////////////////////////////// // Copyright (c) 2009, Rob Eden 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.impl.hash; import gnu.trove.iterator.TPrimitiveIterator; import java.util.ConcurrentModificationException; import java.util.NoSuchElementException; /** * Implements all iterator functions for the hashed object set. * Subclasses may override objectAtIndex to vary the object * returned by calls to next() (e.g. for values, and Map.Entry * objects). * <p/> * <p> Note that iteration is fastest if you forego the calls to * <tt>hasNext</tt> in favor of checking the size of the structure * yourself and then call next() that many times: * <p/> * <pre> * Iterator i = collection.iterator(); * for (int size = collection.size(); size-- > 0;) { * Object o = i.next(); * } * </pre> * <p/> * <p>You may, of course, use the hasNext(), next() idiom too if * you aren't in a performance critical spot.</p> */ public abstract class THashPrimitiveIterator implements TPrimitiveIterator { /** the data structure this iterator traverses */ protected final TPrimitiveHash _hash; /** * the number of elements this iterator believes are in the * data structure it accesses. */ protected int _expectedSize; /** the index used for iteration. */ protected int _index; /** * Creates a <tt>TPrimitiveIterator</tt> for the specified collection. * * @param hash the <tt>TPrimitiveHash</tt> we want to iterate over. */ public THashPrimitiveIterator( TPrimitiveHash hash ) { _hash = hash; _expectedSize = _hash.size(); _index = _hash.capacity(); } /** * Returns the index of the next value in the data structure * or a negative value if the iterator is exhausted. * * @return an <code>int</code> value * @throws java.util.ConcurrentModificationException * if the underlying collection's * size has been modified since the iterator was created. */ protected final int nextIndex() { if ( _expectedSize != _hash.size() ) { throw new ConcurrentModificationException(); } byte[] states = _hash._states; int i = _index; while ( i-- > 0 && ( states[i] != TPrimitiveHash.FULL ) ) { ; } return i; } /** * Returns true if the iterator can be advanced past its current * location. * * @return a <code>boolean</code> value */ public boolean hasNext() { return nextIndex() >= 0; } /** * Removes the last entry returned by the iterator. * Invoking this method more than once for a single entry * will leave the underlying data structure in a confused * state. */ public void remove() { if (_expectedSize != _hash.size()) { throw new ConcurrentModificationException(); } // Disable auto compaction during the remove. This is a workaround for bug 1642768. try { _hash.tempDisableAutoCompaction(); _hash.removeAt(_index); } finally { _hash.reenableAutoCompaction( false ); } _expectedSize--; } /** * Sets the internal <tt>index</tt> so that the `next' object * can be returned. */ protected final void moveToNextIndex() { // doing the assignment && < 0 in one line shaves // 3 opcodes... if ( ( _index = nextIndex() ) < 0 ) { throw new NoSuchElementException(); } } } // TPrimitiveIterator --- NEW FILE: THashIterator.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.impl.hash; import gnu.trove.iterator.TIterator; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.NoSuchElementException; /** * Implements all iterator functions for the hashed object set. * Subclasses may override objectAtIndex to vary the object * returned by calls to next() (e.g. for values, and Map.Entry * objects). * <p/> * <p> Note that iteration is fastest if you forego the calls to * <tt>hasNext</tt> in favor of checking the size of the structure * yourself and then call next() that many times: * <p/> * <pre> * Iterator i = collection.iterator(); * for (int size = collection.size(); size-- > 0;) { * Object o = i.next(); * } * </pre> * <p/> * <p>You may, of course, use the hasNext(), next() idiom too if * you aren't in a performance critical spot.</p> */ public abstract class THashIterator<V> implements TIterator, Iterator<V> { private final TObjectHash<V> _object_hash; /** the data structure this iterator traverses */ protected final THash _hash; /** * the number of elements this iterator believes are in the * data structure it accesses. */ protected int _expectedSize; /** the index used for iteration. */ protected int _index; /** * Create an instance of THashIterator over the values of the TObjectHash * * @param hash the object */ protected THashIterator( TObjectHash<V> hash ) { _hash = hash; _expectedSize = _hash.size(); _index = _hash.capacity(); _object_hash = hash; } /** * Moves the iterator to the next Object and returns it. * * @return an <code>Object</code> value * @throws ConcurrentModificationException * if the structure * was changed using a method that isn't on this iterator. * @throws NoSuchElementException if this is called on an * exhausted iterator. */ public V next() { moveToNextIndex(); return objectAtIndex( _index ); } /** * Returns true if the iterator can be advanced past its current * location. * * @return a <code>boolean</code> value */ public boolean hasNext() { return nextIndex() >= 0; } /** * Removes the last entry returned by the iterator. * Invoking this method more than once for a single entry * will leave the underlying data structure in a confused * state. */ public void remove() { if ( _expectedSize != _hash.size() ) { throw new ConcurrentModificationException(); } // Disable auto compaction during the remove. This is a workaround for bug 1642768. try { _hash.tempDisableAutoCompaction(); _hash.removeAt( _index ); } finally { _hash.reenableAutoCompaction( false ); } _expectedSize--; } /** * Sets the internal <tt>index</tt> so that the `next' object * can be returned. */ protected final void moveToNextIndex() { // doing the assignment && < 0 in one line shaves // 3 opcodes... if ( ( _index = nextIndex() ) < 0 ) { throw new NoSuchElementException(); } } /** * Returns the index of the next value in the data structure * or a negative value if the iterator is exhausted. * * @return an <code>int</code> value * @throws ConcurrentModificationException * if the underlying * collection's size has been modified since the iterator was * created. */ protected final int nextIndex() { if ( _expectedSize != _hash.size() ) { throw new ConcurrentModificationException(); } Object[] set = _object_hash._set; int i = _index; while ( i-- > 0 && ( set[i] == TObjectHash.FREE || set[i] == TObjectHash.REMOVED ) ) { ; } return i; } /** * Returns the object at the specified index. Subclasses should * implement this to return the appropriate object for the given * index. * * @param index the index of the value to return. * @return an <code>Object</code> value */ abstract protected V objectAtIndex( int index ); } // THashIterator Index: TPrimitiveHash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/impl/hash/Attic/TPrimitiveHash.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** TPrimitiveHash.java 27 Sep 2009 06:23:59 -0000 1.1.2.3 --- TPrimitiveHash.java 9 Oct 2009 01:44:34 -0000 1.1.2.4 *************** *** 91,95 **** * @param index an <code>int</code> value */ ! public void removeAt( int index ) { _states[index] = REMOVED; super.removeAt( index ); --- 91,95 ---- * @param index an <code>int</code> value */ ! protected void removeAt( int index ) { _states[index] = REMOVED; super.removeAt( index ); Index: THash.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/impl/hash/Attic/THash.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** THash.java 4 Sep 2009 12:32:33 -0000 1.1.2.2 --- THash.java 9 Oct 2009 01:44:34 -0000 1.1.2.3 *************** *** 259,263 **** * @param index an <code>int</code> value */ ! public void removeAt( int index ) { _size--; --- 259,263 ---- * @param index an <code>int</code> value */ ! protected void removeAt( int index ) { _size--; |
From: Rob E. <ro...@us...> - 2009-10-09 01:44:45
|
Update of /cvsroot/trove4j/trove/src/gnu/trove/iterator/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31623/trove/src/gnu/trove/iterator/hash Modified Files: Tag: TROVE_3_WORKING TObjectHashIterator.java Removed Files: Tag: TROVE_3_WORKING TPrimitiveIterator.java THashIterator.java Log Message: Moves some classes and pull TPrimitiveIterator into an interface. This allows hiding setup(int) and removeAt(int) methods in hash maps and set. Index: TObjectHashIterator.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/iterator/hash/Attic/TObjectHashIterator.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** TObjectHashIterator.java 9 Sep 2009 06:24:06 -0000 1.1.2.3 --- TObjectHashIterator.java 9 Oct 2009 01:44:34 -0000 1.1.2.4 *************** *** 23,26 **** --- 23,27 ---- import gnu.trove.impl.hash.TObjectHash; + import gnu.trove.impl.hash.THashIterator; --- TPrimitiveIterator.java DELETED --- --- THashIterator.java DELETED --- |
From: Rob E. <ro...@us...> - 2009-10-09 01:44:45
|
Update of /cvsroot/trove4j/trove/src/gnu/trove/iterator In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31623/trove/src/gnu/trove/iterator Added Files: Tag: TROVE_3_WORKING TPrimitiveIterator.java Log Message: Moves some classes and pull TPrimitiveIterator into an interface. This allows hiding setup(int) and removeAt(int) methods in hash maps and set. --- NEW FILE: TPrimitiveIterator.java --- /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2001, Eric D. Friedman All Rights Reserved. // Copyright (c) 2009, Rob Eden All Rights Reserved. // Copyright (c) 2009, Jeff Randall 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.iterator; /** * Implements all iterator functions for the hashed object set. * Subclasses may override objectAtIndex to vary the object * returned by calls to next() (e.g. for values, and Map.Entry * objects). * <p/> * <p> Note that iteration is fastest if you forego the calls to * <tt>hasNext</tt> in favor of checking the size of the structure * yourself and then call next() that many times: * <p/> * <pre> * Iterator i = collection.iterator(); * for (int size = collection.size(); size-- > 0;) { * Object o = i.next(); * } * </pre> * <p/> * <p>You may, of course, use the hasNext(), next() idiom too if * you aren't in a performance critical spot.</p> */ public interface TPrimitiveIterator extends TIterator { /** * Returns true if the iterator can be advanced past its current * location. * * @return a <code>boolean</code> value */ public boolean hasNext(); /** * Removes the last entry returned by the iterator. * Invoking this method more than once for a single entry * will leave the underlying data structure in a confused * state. */ public void remove(); } // TPrimitiveIterator |
From: Jeff R. <uph...@us...> - 2009-10-06 05:05:14
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/list/array In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14546/templates/gnu/trove/list/array Modified Files: Tag: TROVE_3_WORKING _E_ArrayList.template Log Message: Add suggested toArray() variant with both source position and destination position specified. Index: _E_ArrayList.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/list/array/Attic/_E_ArrayList.template,v retrieving revision 1.1.2.16 retrieving revision 1.1.2.17 diff -C2 -d -r1.1.2.16 -r1.1.2.17 *** _E_ArrayList.template 27 Sep 2009 06:23:59 -0000 1.1.2.16 --- _E_ArrayList.template 6 Oct 2009 05:04:54 -0000 1.1.2.17 *************** *** 67,74 **** * default capacity. */ - @SuppressWarnings({"RedundantCast"}) public T#E#ArrayList() { ! //noinspection unchecked ! this( ( Builder<Object, #ET#> ) DEFAULT_BUILDER ); } --- 67,72 ---- * default capacity. [...1075 lines suppressed...] ! /** {@inheritDoc} */ ! @Override public String toString() { final StringBuilder buf = new StringBuilder( "{" ); *************** *** 1272,1275 **** --- 956,960 ---- + /** {@inheritDoc} */ public void writeExternal( ObjectOutput out ) throws IOException { // VERSION *************** *** 1291,1294 **** --- 976,980 ---- + /** {@inheritDoc} */ public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException { |
From: Jeff R. <uph...@us...> - 2009-10-06 05:05:14
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/list In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14546/templates/gnu/trove/list Modified Files: Tag: TROVE_3_WORKING _E_List.template Log Message: Add suggested toArray() variant with both source position and destination position specified. Index: _E_List.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/list/Attic/_E_List.template,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** _E_List.template 11 Sep 2009 04:48:26 -0000 1.1.2.4 --- _E_List.template 6 Oct 2009 05:04:54 -0000 1.1.2.5 *************** *** 312,315 **** --- 312,327 ---- /** + * Copies a slice of the list into a native array. + * + * @param dest the array to copy into. + * @param source_pos the offset of the first value to copy + * @param dest_pos the offset where the first value should be copied + * @param len the number of values to copy. + * @return the array passed in. + */ + public #e#[] toArray( #e#[] dest, int source_pos, int dest_pos, int len ); + + + /** * Applies the procedure to each value in the list in ascending * (front to back) order. |
From: Jeff R. <uph...@us...> - 2009-10-06 05:05:07
|
Update of /cvsroot/trove4j/trove/test/gnu/trove/list/array In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14546/test/gnu/trove/list/array Modified Files: Tag: TROVE_3_WORKING TPrimitiveArrayListTest.java Log Message: Add suggested toArray() variant with both source position and destination position specified. Index: TPrimitiveArrayListTest.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/list/array/Attic/TPrimitiveArrayListTest.java,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** TPrimitiveArrayListTest.java 27 Sep 2009 06:23:59 -0000 1.1.2.7 --- TPrimitiveArrayListTest.java 6 Oct 2009 05:04:54 -0000 1.1.2.8 *************** *** 1093,1096 **** --- 1093,1139 ---- + public void testToArrayWithDest() { + int[] dest = new int[5]; + assertTrue( Arrays.equals( new int[]{1, 2, 3, 4, 5}, list.toArray( dest ) ) ); + dest = new int[4]; + assertTrue( Arrays.equals( new int[]{1, 2, 3, 4}, list.toArray( dest, 0, 4 ) ) ); + dest = new int[4]; + assertTrue( Arrays.equals( new int[]{2, 3, 4, 5}, list.toArray( dest, 1, 4 ) ) ); + dest = new int[3]; + assertTrue( Arrays.equals( new int[]{2, 3, 4}, list.toArray( dest, 1, 3 ) ) ); + + try { + list.toArray( dest, -1, 5 ); + fail( "Expected ArrayIndexOutOfBoundsException when begin < 0" ); + } + catch ( ArrayIndexOutOfBoundsException expected ) { + // Expected + } + } + + + public void testToArrayWithDestTarget() { + int[] dest = new int[5]; + assertTrue( Arrays.equals( new int[]{1, 2, 3, 4, 5}, list.toArray( dest ) ) ); + dest = new int[4]; + assertTrue( Arrays.equals( new int[]{1, 2, 3, 4}, list.toArray( dest, 0, 0, 4 ) ) ); + dest = new int[5]; + assertTrue( Arrays.equals( new int[]{0, 2, 3, 4, 5}, list.toArray( dest, 1, 1, 4 ) ) ); + dest = new int[4]; + assertTrue( Arrays.equals( new int[]{0, 2, 3, 4}, list.toArray( dest, 1, 1, 3 ) ) ); + + dest = new int[5]; + assertTrue( Arrays.equals( new int[]{0, 0, 0, 0, 0}, list.toArray( dest, 0, 0, 0 ) ) ); + + try { + list.toArray( dest, -1, 0, 5 ); + fail( "Expected ArrayIndexOutOfBoundsException when begin < 0" ); + } + catch ( ArrayIndexOutOfBoundsException expected ) { + // Expected + } + } + + public void testSubList() throws Exception { TIntList subList = list.subList( 1, 4 ); |
From: Jeff R. <uph...@us...> - 2009-10-06 05:05:04
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14546/templates/gnu/trove/impl Modified Files: Tag: TROVE_3_WORKING TSynchronizedCollections.template TUnmodifiableCollections.template Log Message: Add suggested toArray() variant with both source position and destination position specified. Index: TSynchronizedCollections.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/impl/Attic/TSynchronizedCollections.template,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** TSynchronizedCollections.template 6 Oct 2009 04:25:59 -0000 1.1.2.2 --- TSynchronizedCollections.template 6 Oct 2009 05:04:54 -0000 1.1.2.3 *************** *** 436,439 **** --- 436,442 ---- synchronized( mutex ) { return list.toArray( dest, offset, len ); } } + public #e#[] toArray( #e#[] dest, int source_pos, int dest_pos, int len ) { + synchronized( mutex ) { return list.toArray( dest, source_pos, dest_pos, len ); } + } public int indexOf( int offset, #e# value ) { Index: TUnmodifiableCollections.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/impl/Attic/TUnmodifiableCollections.template,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** TUnmodifiableCollections.template 3 Oct 2009 02:45:47 -0000 1.1.2.1 --- TUnmodifiableCollections.template 6 Oct 2009 05:04:54 -0000 1.1.2.2 *************** *** 204,207 **** --- 204,210 ---- return list.toArray( dest, offset, len ); } + public #e#[] toArray( #e#[] dest, int source_pos, int dest_pos, int len ) { + return list.toArray( dest, source_pos, dest_pos, len ); + } public boolean forEachDescending( T#E#Procedure procedure ) { |
From: Jeff R. <uph...@us...> - 2009-10-06 04:26:11
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10873/templates/gnu/trove/impl Modified Files: Tag: TROVE_3_WORKING TSynchronizedCollections.template Log Message: Provide private implementations of SyncronizedCollection and SyncronizedSet so that we can pass in the correct mutex since the java.util.Collections constructors to do so are package private. Index: TSynchronizedCollections.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/impl/Attic/TSynchronizedCollections.template,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** TSynchronizedCollections.template 3 Oct 2009 02:45:47 -0000 1.1.2.1 --- TSynchronizedCollections.template 6 Oct 2009 04:25:59 -0000 1.1.2.2 *************** *** 40,44 **** import java.util.Collection; ! import java.util.Collections; import java.util.Set; import java.util.Map; --- 40,44 ---- import java.util.Collection; ! import java.util.Iterator; import java.util.Set; import java.util.Map; *************** *** 76,80 **** --- 76,161 ---- #REPLICATED6# + + + /** Local implementation of SynchronizedCollection so we can set the mutex explicitly. */ + private static class SynchronizedCollection<E> implements Collection<E>, Serializable { + // use serialVersionUID from JDK 1.2.2 for interoperability + private static final long serialVersionUID = 3053995032091335093L; + + final Collection<E> c; // Backing Collection + final Object mutex; // Object on which to synchronize + + SynchronizedCollection( Collection<E> c, Object mutex ) { + this.c = c; + this.mutex = mutex; + } + + public int size() { + synchronized( mutex ) { return c.size(); } + } + public boolean isEmpty() { + synchronized( mutex ) { return c.isEmpty(); } + } + public boolean contains( Object o ) { + synchronized( mutex ) { return c.contains( o ); } + } + public Object[] toArray() { + synchronized( mutex ) { return c.toArray(); } + } + @SuppressWarnings({"SuspiciousToArrayCall"}) + public <T> T[] toArray( T[] a ) { + synchronized( mutex ) { return c.toArray( a ); } + } + + public Iterator<E> iterator() { + return c.iterator(); // Must be manually synched by user! + } + + public boolean add( E e ) { + synchronized( mutex ) { return c.add( e ); } + } + public boolean remove( Object o ) { + synchronized( mutex ) { return c.remove( o ); } + } + + public boolean containsAll( Collection<?> coll ) { + synchronized( mutex ) { return c.containsAll( coll ); } + } + public boolean addAll( Collection<? extends E> coll ) { + synchronized( mutex ) { return c.addAll( coll ); } + } + public boolean removeAll( Collection<?> coll ) { + synchronized( mutex ) { return c.removeAll( coll ); } + } + public boolean retainAll( Collection<?> coll ) { + synchronized( mutex ) { return c.retainAll( coll ); } + } + public void clear() { + synchronized( mutex ) { c.clear(); } + } + public String toString() { + synchronized( mutex ) { return c.toString(); } + } + private void writeObject( ObjectOutputStream s ) throws IOException { + synchronized( mutex ) { s.defaultWriteObject(); } + } + } + + + /** Local implementation of SynchronizedSet so we can set the mutex explicitly. */ + private static class SynchronizedSet<E> extends SynchronizedCollection<E> implements Set<E> { + private static final long serialVersionUID = 487447009682186044L; + + SynchronizedSet( Set<E> s, Object mutex ) { super( s, mutex ); } + public boolean equals( Object o ) { synchronized( mutex ) { return c.equals( o ); } } + public int hashCode() { synchronized( mutex ) { return c.hashCode(); } } + } + + } + + + + ====START_REPLICATED_CONTENT #1==== /** *************** *** 682,687 **** synchronized( mutex ) { if ( values == null ) { ! // TODO: I don't think this is valid.. but what I want is package private.. ! values = Collections.synchronizedCollection( m.valueCollection() ); } return values; --- 763,767 ---- synchronized( mutex ) { if ( values == null ) { ! values = new SynchronizedCollection<V>( m.valueCollection(), mutex ); } return values; *************** *** 797,802 **** synchronized( mutex ) { if ( keySet == null ) { ! // TODO: don't think this is valid, but what I want is package private ! keySet = Collections.synchronizedSet( m.keySet() ); } return keySet; --- 877,881 ---- synchronized( mutex ) { if ( keySet == null ) { ! keySet = new SynchronizedSet<K>( m.keySet(), mutex ); } return keySet; |
From: Jeff R. <uph...@us...> - 2009-10-03 02:46:00
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23043/templates/gnu/trove Modified Files: Tag: TROVE_3_WORKING TCollections.template Removed Files: Tag: TROVE_3_WORKING TUnmodifiableCollections.template Log Message: Additional implementations for SyncronizedCollections, Move UnmodifiableCollections into the impl package. Still need tests, but builds properly. Index: TCollections.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/Attic/TCollections.template,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** TCollections.template 30 Sep 2009 05:45:35 -0000 1.1.2.2 --- TCollections.template 3 Oct 2009 02:45:47 -0000 1.1.2.3 *************** *** 29,32 **** --- 29,34 ---- import gnu.trove.list.*; import gnu.trove.map.*; + import gnu.trove.impl.TUnmodifiableCollections; + import gnu.trove.impl.TSynchronizedCollections; import java.util.RandomAccess; *************** *** 43,46 **** --- 45,51 ---- + /////////////////////////// + // TUnmodifiableCollections + #REPLICATED1# *************** *** 56,59 **** --- 61,98 ---- #REPLICATED5# + + + #REPLICATED6# + + + #REPLICATED7# + + + + /////////////////////////// + // TSynchronizedCollections + + #REPLICATED8# + + + #REPLICATED9# + + + #REPLICATED10# + + + #REPLICATED11# + + + #REPLICATED12# + + + #REPLICATED13# + + + #REPLICATED14# + + + #REPLICATED15# } ====START_REPLICATED_CONTENT #1==== *************** *** 79,83 **** * @return an unmodifiable view of the specified Trove primitive collection. */ ! public static T#E#Collection unmodifiableTCollection( T#E#Collection c ) { return new TUnmodifiableCollections.TUnmodifiable#E#Collection( c ); } --- 118,122 ---- * @return an unmodifiable view of the specified Trove primitive collection. */ ! public static T#E#Collection unmodifiableCollection( T#E#Collection c ) { return new TUnmodifiableCollections.TUnmodifiable#E#Collection( c ); } *************** *** 98,102 **** * @return an unmodifiable view of the specified Trove primitive set. */ ! public static T#E#Set unmodifiableTSet( T#E#Set s ) { return new TUnmodifiableCollections.TUnmodifiable#E#Set( s ); } --- 137,141 ---- * @return an unmodifiable view of the specified Trove primitive set. */ ! public static T#E#Set unmodifiableSet( T#E#Set s ) { return new TUnmodifiableCollections.TUnmodifiable#E#Set( s ); } *************** *** 120,124 **** // * @return an unmodifiable view of the specified Trove primitive sorted set. // */ ! // public static TSorted#E#Set unmodifiableSortedTSet( TSorted#E#Set s ) { // return new TUnmodifiableCollections.TUnmodifiableSorted#E#Set( s ); // } --- 159,163 ---- // * @return an unmodifiable view of the specified Trove primitive sorted set. // */ ! // public static TSorted#E#Set unmodifiableSortedSet( TSorted#E#Set s ) { // return new TUnmodifiableCollections.TUnmodifiableSorted#E#Set( s ); // } *************** *** 140,144 **** * @return an unmodifiable view of the specified Trove primitive list. */ ! public static T#E#List unmodifiableTList( T#E#List list) { return ( list instanceof RandomAccess ? new TUnmodifiableCollections.TUnmodifiableRandomAccess#E#List( list ) : --- 179,183 ---- * @return an unmodifiable view of the specified Trove primitive list. */ ! public static T#E#List unmodifiableList( T#E#List list) { return ( list instanceof RandomAccess ? new TUnmodifiableCollections.TUnmodifiableRandomAccess#E#List( list ) : *************** *** 161,167 **** * @return an unmodifiable view of the specified Trove primitive/primitive map. */ ! public static T#K##V#Map unmodifiableTMap( T#K##V#Map m ) { return new TUnmodifiableCollections.TUnmodifiable#K##V#Map( m ); } =====END_REPLICATED_CONTENT #5===== --- 200,640 ---- * @return an unmodifiable view of the specified Trove primitive/primitive map. */ ! public static T#K##V#Map unmodifiableMap( T#K##V#Map m ) { return new TUnmodifiableCollections.TUnmodifiable#K##V#Map( m ); } =====END_REPLICATED_CONTENT #5===== + ====START_REPLICATED_CONTENT #6==== + /** + * Returns an unmodifiable view of the specified Trove primitive/Object map. This method + * allows modules to provide users with "read-only" access to internal + * maps. Query operations on the returned map "read through" + * to the specified map, and attempts to modify the returned + * map, whether direct or via its collection views, result in an + * <tt>UnsupportedOperationException</tt>.<p> + * + * The returned map will be serializable if the specified map + * is serializable. + * + * @param m the map for which an unmodifiable view is to be returned. + * @return an unmodifiable view of the specified Trove primitive/primitive map. + */ + public static <V> T#E#ObjectMap<V> unmodifiableMap( T#E#ObjectMap<V> m ) { + return new TUnmodifiableCollections.TUnmodifiable#E#ObjectMap<V>( m ); + } + =====END_REPLICATED_CONTENT #6===== + ====START_REPLICATED_CONTENT #7==== + /** + * Returns an unmodifiable view of the specified Trove Object/primitive map. This method + * allows modules to provide users with "read-only" access to internal + * maps. Query operations on the returned map "read through" + * to the specified map, and attempts to modify the returned + * map, whether direct or via its collection views, result in an + * <tt>UnsupportedOperationException</tt>.<p> + * + * The returned map will be serializable if the specified map + * is serializable. + * + * @param m the map for which an unmodifiable view is to be returned. + * @return an unmodifiable view of the specified Trove primitive/primitive map. + */ + public static <K> TObject#E#Map<K> unmodifiableMap( TObject#E#Map<K> m ) { + return new TUnmodifiableCollections.TUnmodifiableObject#E#Map<K>( m ); + } + =====END_REPLICATED_CONTENT #7===== + ====START_REPLICATED_CONTENT #8==== + /** + * Returns a synchronized (thread-safe) Trove collection backed by the specified + * Trove collection. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing collection is accomplished + * through the returned collection.<p> + * + * It is imperative that the user manually synchronize on the returned + * collection when iterating over it: + * <pre> + * T#E#Collection c = TCollections.synchronizedCollection( myCollection ); + * ... + * synchronized( c ) { + * T#E#Iterator i = c.iterator(); // Must be in the synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned collection does <i>not</i> pass the <tt>hashCode</tt> + * and <tt>equals</tt> operations through to the backing collection, but + * relies on <tt>Object</tt>'s equals and hashCode methods. This is + * necessary to preserve the contracts of these operations in the case + * that the backing collection is a set or a list.<p> + * + * The returned collection will be serializable if the specified collection + * is serializable. + * + * @param c the collection to be "wrapped" in a synchronized collection. + * @return a synchronized view of the specified collection. + */ + public static T#E#Collection synchronizedCollection( T#E#Collection c ) { + return new TSynchronizedCollections.TSynchronized#E#Collection(c); + } + static T#E#Collection synchronizedCollection( T#E#Collection c, Object mutex ) { + return new TSynchronizedCollections.TSynchronized#E#Collection( c, mutex ); + } + =====END_REPLICATED_CONTENT #8===== + ====START_REPLICATED_CONTENT #9==== + /** + * Returns a synchronized (thread-safe) Trove set backed by the specified + * set. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing set is accomplished + * through the returned set.<p> + * + * It is imperative that the user manually synchronize on the returned + * set when iterating over it: + * <pre> + * T#E#Set s = TCollections.synchronizedSet( new T#E#HashSet() ); + * ... + * synchronized(s) { + * T#E#Iterator i = s.iterator(); // Must be in the synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned set will be serializable if the specified set is + * serializable. + * + * @param s the set to be "wrapped" in a synchronized set. + * @return a synchronized view of the specified set. + */ + public static T#E#Set synchronizedSet( T#E#Set s ) { + return new TSynchronizedCollections.TSynchronized#E#Set( s ); + } + + static T#E#Set synchronizedSet( T#E#Set s, Object mutex ) { + return new TSynchronizedCollections.TSynchronized#E#Set( s, mutex ); + } + =====END_REPLICATED_CONTENT #9===== + ====START_REPLICATED_CONTENT #10==== + // TODO: uncomment when sorted sets are implemented. + /** + * Returns a synchronized (thread-safe) sorted set backed by the specified + * sorted set. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing sorted set is accomplished + * through the returned sorted set (or its views).<p> + * + * It is imperative that the user manually synchronize on the returned + * sorted set when iterating over it or any of its <tt>subSet</tt>, + * <tt>headSet</tt>, or <tt>tailSet</tt> views. + * <pre> + * TSorted#E#Set s = TCollections.synchronizedSortedSet( new T#E#TreeSet() ); + * ... + * synchronized( s ) { + * T#E#Iterator i = s.iterator(); // Must be in the synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * or: + * <pre> + * TSorted#E#Set s = TCollections.synchronizedSortedSet( new T#E#TreeSet() ); + * TSorted#E#Set s2 = s.headSet( foo ); + * ... + * synchronized( s ) { // Note: s, not s2!!! + * T#E#Iterator i = s2.iterator(); // Must be in the synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned sorted set will be serializable if the specified + * sorted set is serializable. + * + * @param s the sorted set to be "wrapped" in a synchronized sorted set. + * @return a synchronized view of the specified sorted set. + */ + // public static TSorted#E#Set synchronizedSortedSet( TSorted#E#Set s ) { + // return new TSynchronizedCollections.TSynchronizedSorted#E#Set( s ); + // } + =====END_REPLICATED_CONTENT #10===== + ====START_REPLICATED_CONTENT #11==== + /** + * Returns a synchronized (thread-safe) Trove list backed by the specified + * list. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing list is accomplished + * through the returned list.<p> + * + * It is imperative that the user manually synchronize on the returned + * list when iterating over it: + * <pre> + * T#E#List list = TCollections.synchronizedList( new T#E#ArrayList() ); + * ... + * synchronized( list ) { + * T#E#Iterator i = list.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned list will be serializable if the specified list is + * serializable. + * + * @param list the list to be "wrapped" in a synchronized list. + * @return a synchronized view of the specified list. + */ + public static T#E#List synchronizedList( T#E#List list ) { + return ( list instanceof RandomAccess ? + new TSynchronizedCollections.TSynchronizedRandomAccess#E#List( list ) : + new TSynchronizedCollections.TSynchronized#E#List( list ) ); + } + + static T#E#List synchronizedList( T#E#List list, Object mutex ) { + return ( list instanceof RandomAccess ? + new TSynchronizedCollections.TSynchronizedRandomAccess#E#List( list, mutex ) : + new TSynchronizedCollections.TSynchronized#E#List( list, mutex ) ); + } + =====END_REPLICATED_CONTENT #11===== + ====START_REPLICATED_CONTENT #12==== + /** + * Returns a synchronized (thread-safe) Trove map backed by the specified + * map. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing map is accomplished + * through the returned map.<p> + * + * It is imperative that the user manually synchronize on the returned + * map when iterating over any of its collection views: + * <pre> + * T#K##V#Map m = TCollections.synchronizedMap( new T#K##V#HashMap() ); + * ... + * T#K#Set s = m.keySet(); // Needn't be in synchronized block + * ... + * synchronized( m ) { // Synchronizing on m, not s! + * T#K#Iterator i = s.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned map will be serializable if the specified map is + * serializable. + * + * @param m the map to be "wrapped" in a synchronized map. + * @return a synchronized view of the specified map. + */ + public static T#K##V#Map synchronizedMap( T#K##V#Map m ) { + return new TSynchronizedCollections.TSynchronized#K##V#Map( m ); + } + =====END_REPLICATED_CONTENT #12===== + ====START_REPLICATED_CONTENT #13==== + /** + * Returns a synchronized (thread-safe) Trove map backed by the specified + * map. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing map is accomplished + * through the returned map.<p> + * + * It is imperative that the user manually synchronize on the returned + * map when iterating over any of its collection views: + * <pre> + * T#E#ObjectMap m = TCollections.synchronizedMap( new T#E#ObjectHashMap() ); + * ... + * T#E#Set s = m.keySet(); // Needn't be in synchronized block + * ... + * synchronized( m ) { // Synchronizing on m, not s! + * T#E#Iterator i = s.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned map will be serializable if the specified map is + * serializable. + * + * @param m the map to be "wrapped" in a synchronized map. + * @return a synchronized view of the specified map. + */ + public static <V> T#E#ObjectMap<V> synchronizedMap( T#E#ObjectMap<V> m ) { + return new TSynchronizedCollections.TSynchronized#E#ObjectMap<V>( m ); + } + =====END_REPLICATED_CONTENT #13===== + ====START_REPLICATED_CONTENT #14==== + /** + * Returns a synchronized (thread-safe) Trove map backed by the specified + * map. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing map is accomplished + * through the returned map.<p> + * + * It is imperative that the user manually synchronize on the returned + * map when iterating over any of its collection views: + * <pre> + * TObject#E#Map m = TCollections.synchronizedMap( new TObject#E#HashMap() ); + * ... + * Set s = m.keySet(); // Needn't be in synchronized block + * ... + * synchronized( m ) { // Synchronizing on m, not s! + * Iterator i = s.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned map will be serializable if the specified map is + * serializable. + * + * @param m the map to be "wrapped" in a synchronized map. + * @return a synchronized view of the specified map. + */ + public static <K> TObject#E#Map<K> synchronizedMap( TObject#E#Map<K> m ) { + return new TSynchronizedCollections.TSynchronizedObject#E#Map<K>( m ); + } + =====END_REPLICATED_CONTENT #14===== + ====START_REPLICATED_CONTENT #15==== + // TODO: uncomment when we have Sorted Maps + /** + * Returns a synchronized (thread-safe) sorted Trove map backed by the specified + * sorted map. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing sorted map is accomplished + * through the returned sorted map (or its views).<p> + * + * It is imperative that the user manually synchronize on the returned + * sorted map when iterating over any of its collection views, or the + * collections views of any of its <tt>subMap</tt>, <tt>headMap</tt> or + * <tt>tailMap</tt> views. + * <pre> + * TSorted#K##V#Map m = TCollections.synchronizedSortedMap( new T#K##V#TreeMap() ); + * ... + * T#K#Set s = m.keySet(); // Needn't be in synchronized block + * ... + * synchronized( m ) { // Synchronizing on m, not s! + * T#K#Iterator i = s.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * or: + * <pre> + * TSorted#K##V#Map m = TCollections.synchronizedSortedMap( new T#K##V#TreeMap() ); + * TSorted#K##V#Map m2 = m.subMap( foo, bar ); + * ... + * T#K#Set s2 = m2.keySet(); // Needn't be in synchronized block + * ... + * synchronized( m ) { // Synchronizing on m, not m2 or s2! + * T#K#Iterator i = s.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned sorted map will be serializable if the specified + * sorted map is serializable. + * + * @param m the sorted map to be "wrapped" in a synchronized sorted map. + * @return a synchronized view of the specified sorted map. + */ + // public static TSorted#K##V#Map synchronizedSortedMap( TSorted#K##V#Map m ) { + // return new TSynchronizedSorted#K##V#Map( m ); + // } + =====END_REPLICATED_CONTENT #15===== + ====START_REPLICATED_CONTENT #16==== + // TODO: uncomment when we have Sorted Maps + /** + * Returns a synchronized (thread-safe) sorted Trove map backed by the specified + * sorted map. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing sorted map is accomplished + * through the returned sorted map (or its views).<p> + * + * It is imperative that the user manually synchronize on the returned + * sorted map when iterating over any of its collection views, or the + * collections views of any of its <tt>subMap</tt>, <tt>headMap</tt> or + * <tt>tailMap</tt> views. + * <pre> + * TSorted#E#ObjectMap m = TCollections.synchronizedSortedMap( new T#E#ObjectTreeMap() ); + * ... + * T#E#Set s = m.keySet(); // Needn't be in synchronized block + * ... + * synchronized( m ) { // Synchronizing on m, not s! + * T#E#Iterator i = s.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + i.advance(); + * foo( i.key(), i.value() ); + * } + * </pre> + * or: + * <pre> + * TSorted#E#ObjectMap m = TCollections.synchronizedSortedMap( new T#E#ObjectTreeMap() ); + * TSorted#E#ObjectMap m2 = m.subMap( foo, bar ); + * ... + * T#E#Set s2 = m2.keySet(); // Needn't be in synchronized block + * ... + * synchronized( m ) { // Synchronizing on m, not m2 or s2! + * T#E#Iterator i = s.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned sorted map will be serializable if the specified + * sorted map is serializable. + * + * @param m the sorted map to be "wrapped" in a synchronized sorted map. + * @return a synchronized view of the specified sorted map. + */ + // public static TSorted#E#ObjectMap synchronizedSortedMap( TSorted#E#ObjectMap m ) { + // return new TSynchronizedSorted#E#ObjectMap( m ); + // } + =====END_REPLICATED_CONTENT #16===== + ====START_REPLICATED_CONTENT #17==== + // TODO: uncomment when we have Sorted Maps + /** + * Returns a synchronized (thread-safe) sorted Trove map backed by the specified + * sorted map. In order to guarantee serial access, it is critical that + * <strong>all</strong> access to the backing sorted map is accomplished + * through the returned sorted map (or its views).<p> + * + * It is imperative that the user manually synchronize on the returned + * sorted map when iterating over any of its collection views, or the + * collections views of any of its <tt>subMap</tt>, <tt>headMap</tt> or + * <tt>tailMap</tt> views. + * <pre> + * TSortedObject#E#Map m = TCollections.synchronizedSortedMap( new TObject#E#TreeMap() ); + * ... + * Set s = m.keySet(); // Needn't be in synchronized block + * ... + * synchronized( m ) { // Synchronizing on m, not s! + * Iterator i = s.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + i.advance(); + * foo( i.key(), i.value() ); + * } + * </pre> + * or: + * <pre> + * TSortedObject#E#Map m = TCollections.synchronizedSortedMap( new TObject#E#TreeMap() ); + * TSortedObject#E#Map m2 = m.subMap( foo, bar ); + * ... + * Set s2 = m2.keySet(); // Needn't be in synchronized block + * ... + * synchronized( m ) { // Synchronizing on m, not m2 or s2! + * Iterator i = s.iterator(); // Must be in synchronized block + * while ( i.hasNext() ) + * foo( i.next() ); + * } + * </pre> + * Failure to follow this advice may result in non-deterministic behavior. + * + * <p>The returned sorted map will be serializable if the specified + * sorted map is serializable. + * + * @param m the sorted map to be "wrapped" in a synchronized sorted map. + * @return a synchronized view of the specified sorted map. + */ + // public static TSortedObject#E#Map synchronizedSortedMap( TSortedObject#E#Map m ) { + // return new TSynchronizedSortedObject#E#Map( m ); + // } + =====END_REPLICATED_CONTENT #17===== \ No newline at end of file --- TUnmodifiableCollections.template DELETED --- |
From: Jeff R. <uph...@us...> - 2009-10-03 02:45:59
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23043/templates/gnu/trove/impl Added Files: Tag: TROVE_3_WORKING TSynchronizedCollections.template TUnmodifiableCollections.template Log Message: Additional implementations for SyncronizedCollections, Move UnmodifiableCollections into the impl package. Still need tests, but builds properly. --- NEW FILE: TSynchronizedCollections.template --- /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2008, Robert D. Eden All Rights Reserved. // Copyright (c) 2009, Jeff Randall 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.impl; ////////////////////////////////////////////////// // THIS IS A GENERATED CLASS. DO NOT HAND EDIT! // ////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // THIS IS AN IMPLEMENTATION CLASS. DO NOT USE DIRECTLY! // // Access to these methods should be through TCollections // //////////////////////////////////////////////////////////// import gnu.trove.iterator.*; import gnu.trove.procedure.*; import gnu.trove.set.*; import gnu.trove.list.*; import gnu.trove.function.*; import gnu.trove.map.*; import gnu.trove.*; import java.util.Collection; import java.util.Collections; import java.util.Set; import java.util.Map; import java.util.RandomAccess; import java.util.Random; import java.io.Serializable; import java.io.ObjectOutputStream; import java.io.IOException; /** * The unmodifiable collections implementations. */ @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass", "JavaDoc"}) public class TSynchronizedCollections { // Disallow creation of instances of this class private TSynchronizedCollections() { } #REPLICATED1# #REPLICATED2# #REPLICATED3# #REPLICATED4# #REPLICATED5# #REPLICATED6# } ====START_REPLICATED_CONTENT #1==== /** * @serial include */ public static class TSynchronized#E#Collection implements T#E#Collection, Serializable { // TODO: generate proper serialVersionUID // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = 3053995032091335093L; final T#E#Collection c; // Backing Collection final Object mutex; // Object on which to synchronize public TSynchronized#E#Collection( T#E#Collection c ) { if ( c == null ) throw new NullPointerException(); this.c = c; mutex = this; } public TSynchronized#E#Collection( T#E#Collection c, Object mutex ) { this.c = c; this.mutex = mutex; } public int size() { synchronized( mutex ) { return c.size(); } } public boolean isEmpty() { synchronized( mutex ) { return c.isEmpty(); } } public boolean contains( #e# o ) { synchronized( mutex ) { return c.contains( o ); } } public #e#[] toArray() { synchronized( mutex ) { return c.toArray(); } } public #e#[] toArray( #e#[] a ) { synchronized( mutex ) { return c.toArray( a ); } } public T#E#Iterator iterator() { return c.iterator(); // Must be manually synched by user! } public boolean add( #e# e ) { synchronized (mutex ) { return c.add( e ); } } public boolean remove( #e# o ) { synchronized( mutex ) { return c.remove( o ); } } public boolean containsAll( Collection<?> coll ) { synchronized( mutex ) { return c.containsAll( coll );} } public boolean containsAll( T#E#Collection coll ) { synchronized( mutex ) { return c.containsAll( coll );} } public boolean containsAll( #e#[] array ) { synchronized( mutex ) { return c.containsAll( array );} } public boolean addAll( Collection<? extends #ET#> coll ) { synchronized( mutex ) { return c.addAll( coll ); } } public boolean addAll( T#E#Collection coll ) { synchronized( mutex ) { return c.addAll( coll ); } } public boolean addAll( #e#[] array ) { synchronized( mutex ) { return c.addAll( array ); } } public boolean removeAll( Collection<?> coll ) { synchronized( mutex ) { return c.removeAll( coll ); } } public boolean removeAll( T#E#Collection coll ) { synchronized( mutex ) { return c.removeAll( coll ); } } public boolean removeAll( #e#[] array ) { synchronized( mutex ) { return c.removeAll( array ); } } public boolean retainAll( Collection<?> coll ) { synchronized( mutex ) { return c.retainAll( coll ); } } public boolean retainAll( T#E#Collection coll ) { synchronized( mutex ) { return c.retainAll( coll ); } } public boolean retainAll( #e#[] array ) { synchronized( mutex ) { return c.retainAll( array ); } } public #e# getNoEntryValue() { return c.getNoEntryValue(); } public boolean forEach( T#E#Procedure procedure ) { synchronized( mutex ) { return c.forEach( procedure ); } } public void clear() { synchronized( mutex ) { c.clear(); } } public String toString() { synchronized( mutex ) { return c.toString(); } } private void writeObject( ObjectOutputStream s ) throws IOException { synchronized( mutex ) { s.defaultWriteObject(); } } } =====END_REPLICATED_CONTENT #1===== ====START_REPLICATED_CONTENT #2==== /** * @serial include */ public static class TSynchronized#E#Set extends TSynchronized#E#Collection implements T#E#Set { private static final long serialVersionUID = 487447009682186044L; public TSynchronized#E#Set( T#E#Set s ) { super( s ); } public TSynchronized#E#Set( T#E#Set s, Object mutex ) { super( s, mutex ); } public boolean equals( Object o ) { synchronized( mutex ) { return c.equals( o ); } } public int hashCode() { synchronized( mutex ) { return c.hashCode(); } } } /** * @serial include */ // TODO: uncomment when sorted sets are implemented /* public static class TSynchronizedSorted#E#Set extends TSynchronized#E#Set implements TSorted#E#Set { private static final long serialVersionUID = 8695801310862127406L; final private TSorted#E#Set ss; public TSynchronizedSorted#E#Set( TSorted#E#Set s ) { super( s ); ss = s; } public TSynchronizedSorted#E#Set( TSorted#E#Set s, Object mutex ) { super( s, mutex ); ss = s; } public T#E#Comparator comparator() { synchronized( mutex ) { return ss.comparator(); } } public TSorted#E#Set subSet( #e# fromElement, #e# toElement ) { synchronized(mutex) { return new TSynchronizedSorted#E#Set( ss.subSet( fromElement, toElement ), mutex); } } public TSorted#E#Set headSet( #e# toElement ) { synchronized( mutex ) { return new TSynchronizedSorted#E#Set( ss.headSet( toElement ), mutex ); } } public TSorted#E#Set tailSet( #e# fromElement ) { synchronized( mutex ) { return new TSynchronizedSorted#E#Set( ss.tailSet( fromElement ), mutex ); } } public E first() { synchronized( mutex ) { return ss.first(); } } public E last() { synchronized( mutex ) { return ss.last(); } } } */ =====END_REPLICATED_CONTENT #2===== ====START_REPLICATED_CONTENT #3==== /** * @serial include */ public static class TSynchronized#E#List extends TSynchronized#E#Collection implements T#E#List { // TODO: use a proper serialVersionUID static final long serialVersionUID = -7754090372962971524L; final T#E#List list; public TSynchronized#E#List( T#E#List list ) { super( list ); this.list = list; } public TSynchronized#E#List( T#E#List list, Object mutex ) { super( list, mutex ); this.list = list; } public boolean equals( Object o ) { synchronized( mutex ) { return list.equals( o ); } } public int hashCode() { synchronized( mutex ) { return list.hashCode(); } } public #e# get( int index ) { synchronized( mutex ) { return list.get( index ); } } public void set( int index, #e# element) { synchronized( mutex ) { list.set( index, element ); } } public void set( int offset, #e#[] values ) { synchronized( mutex ) { list.set( offset, values ); } } public void set( int offset, #e#[] values, int valOffset, int length ) { synchronized( mutex ) { list.set( offset, values, valOffset, length ); } } public #e# replace( int offset, #e# val ) { synchronized( mutex ) { return list.replace( offset, val ); } } public void remove( int offset, int length ) { synchronized( mutex ) { list.remove( offset, length ); } } public #e# removeAt( int offset ) { synchronized( mutex ) { return list.removeAt( offset ); } } public void add( #e#[] vals ) { synchronized( mutex ) { list.add( vals ); } } public void add( #e#[] vals, int offset, int length ) { synchronized( mutex ) { list.add( vals, offset, length ); } } public void insert( int offset, #e# value ) { synchronized( mutex ) { list.insert( offset, value ); } } public void insert( int offset, #e#[] values ) { synchronized( mutex ) { list.insert( offset, values ); } } public void insert( int offset, #e#[] values, int valOffset, int len ) { synchronized( mutex ) { list.insert( offset, values, valOffset, len ); } } public int indexOf( #e# o ) { synchronized( mutex ) { return list.indexOf( o ); } } public int lastIndexOf( #e# o ) { synchronized( mutex ) { return list.lastIndexOf( o ); } } // public TList#E#Iterator listIterator() { // return list.listIterator(); // Must be manually synched by user // } // public TList#E#Iterator listIterator( int index ) { // return list.listIterator( index ); // Must be manually synched by user // } public T#E#List subList( int fromIndex, int toIndex ) { synchronized( mutex ) { return new TSynchronized#E#List( list.subList( fromIndex, toIndex ), mutex ); } } public #e#[] toArray( int offset, int len ) { synchronized( mutex ) { return list.toArray( offset, len ); } } public #e#[] toArray( #e#[] dest, int offset, int len ) { synchronized( mutex ) { return list.toArray( dest, offset, len ); } } public int indexOf( int offset, #e# value ) { synchronized( mutex ) { return list.indexOf( offset, value ); } } public int lastIndexOf( int offset, #e# value ) { synchronized( mutex ) { return list.lastIndexOf( offset, value ); } } public void fill( #e# val ) { synchronized( mutex ) { list.fill( val ); } } public void fill( int fromIndex, int toIndex, #e# val ) { synchronized( mutex ) { list.fill( fromIndex, toIndex, val ); } } public void reverse() { synchronized( mutex ) { list.reverse(); } } public void reverse( int from, int to ) { synchronized( mutex ) { list.reverse( from, to ); } } public void shuffle( Random rand ) { synchronized( mutex ) { list.shuffle( rand ); } } public void sort() { synchronized( mutex ) { list.sort(); } } public void sort( int fromIndex, int toIndex ) { synchronized( mutex ) { list.sort( fromIndex, toIndex ); } } public int binarySearch( #e# value ) { synchronized( mutex ) { return list.binarySearch( value ); } } public int binarySearch( #e# value, int fromIndex, int toIndex ) { synchronized( mutex ) { return list.binarySearch( value, fromIndex, toIndex ); } } public T#E#List grep( T#E#Procedure condition ) { synchronized( mutex ) { return list.grep( condition ); } } public T#E#List inverseGrep( T#E#Procedure condition ) { synchronized( mutex ) { return list.inverseGrep( condition ); } } public #e# max() { synchronized( mutex ) { return list.max(); } } public #e# min() { synchronized( mutex ) { return list.min(); } } public boolean forEachDescending( T#E#Procedure procedure ) { synchronized( mutex ) { return list.forEachDescending( procedure ); } } public void transformValues( T#E#Function function ) { synchronized( mutex ) { list.transformValues( function ); } } /** * SynchronizedRandomAccessList instances are serialized as * SynchronizedList instances to allow them to be deserialized * in pre-1.4 JREs (which do not have SynchronizedRandomAccessList). * This method inverts the transformation. As a beneficial * side-effect, it also grafts the RandomAccess marker onto * SynchronizedList instances that were serialized in pre-1.4 JREs. * * Note: Unfortunately, SynchronizedRandomAccessList instances * serialized in 1.4.1 and deserialized in 1.4 will become * SynchronizedList instances, as this method was missing in 1.4. */ private Object readResolve() { return ( list instanceof RandomAccess ? new TSynchronizedRandomAccess#E#List( list ) : this ); } } /** * @serial include */ public static class TSynchronizedRandomAccess#E#List extends TSynchronized#E#List implements RandomAccess { public TSynchronizedRandomAccess#E#List( T#E#List list ) { super( list ); } public TSynchronizedRandomAccess#E#List( T#E#List list, Object mutex ) { super( list, mutex ); } public T#E#List subList( int fromIndex, int toIndex ) { synchronized( mutex ) { return new TSynchronizedRandomAccess#E#List( list.subList( fromIndex, toIndex ), mutex ); } } // TODO: proper serialVersionUID static final long serialVersionUID = 1530674583602358482L; /** * Allows instances to be deserialized in pre-1.4 JREs (which do * not have SynchronizedRandomAccessList). SynchronizedList has * a readResolve method that inverts this transformation upon * deserialization. */ private Object writeReplace() { return new TSynchronized#E#List( list ); } } =====END_REPLICATED_CONTENT #3===== ====START_REPLICATED_CONTENT #4==== /** * @serial include */ public static class TSynchronized#K##V#Map implements T#K##V#Map, Serializable { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = 1978198479659022715L; private final T#K##V#Map m; // Backing Map final Object mutex; // Object on which to synchronize public TSynchronized#K##V#Map( T#K##V#Map m ) { if ( m == null ) throw new NullPointerException(); this.m = m; mutex = this; } public TSynchronized#K##V#Map( T#K##V#Map m, Object mutex ) { this.m = m; this.mutex = mutex; } public int size() { synchronized( mutex ) { return m.size(); } } public boolean isEmpty(){ synchronized( mutex ) { return m.isEmpty(); } } public boolean containsKey( #k# key ) { synchronized( mutex ) { return m.containsKey( key ); } } public boolean containsValue( #v# value ){ synchronized( mutex ) { return m.containsValue( value ); } } public #v# get( #k# key ) { synchronized( mutex ) { return m.get( key ); } } public #v# put( #k# key, #v# value ) { synchronized( mutex ) { return m.put( key, value ); } } public #v# remove( #k# key ) { synchronized( mutex ) { return m.remove( key ); } } public void putAll( Map<? extends #KT#, ? extends #VT#> map ) { synchronized( mutex ) { m.putAll( map ); } } public void putAll( T#K##V#Map map ) { synchronized( mutex ) { m.putAll( map ); } } public void clear() { synchronized( mutex ) { m.clear(); } } private transient T#K#Set keySet = null; private transient T#V#Collection values = null; public T#K#Set keySet() { synchronized( mutex ) { if ( keySet == null ) keySet = new TSynchronized#K#Set( m.keySet(), mutex ); return keySet; } } public #k#[] keys() { synchronized( mutex ) { return m.keys(); } } public #k#[] keys( #k#[] array ) { synchronized( mutex ) { return m.keys( array ); } } public T#V#Collection valueCollection() { synchronized( mutex ) { if ( values == null ) values = new TSynchronized#V#Collection( m.valueCollection(), mutex ); return values; } } public #v#[] values() { synchronized( mutex ) { return m.values(); } } public #v#[] values( #v#[] array ) { synchronized( mutex ) { return m.values( array ); } } public T#K##V#Iterator iterator() { return m.iterator(); // Must be manually synched by user! } // these are unchanging over the life of the map, no need to lock public #k# getNoEntryKey() { return m.getNoEntryKey(); } public #v# getNoEntryValue() { return m.getNoEntryValue(); } public #v# putIfAbsent( #k# key, #v# value ) { synchronized( mutex ) { return m.putIfAbsent( key, value ); } } public boolean forEachKey( T#K#Procedure procedure ) { synchronized( mutex ) { return m.forEachKey( procedure ); } } public boolean forEachValue( T#V#Procedure procedure ) { synchronized( mutex ) { return m.forEachValue( procedure ); } } public boolean forEachEntry( T#K##V#Procedure procedure ) { synchronized( mutex ) { return m.forEachEntry( procedure ); } } public void transformValues( T#V#Function function ) { synchronized( mutex ) { m.transformValues( function ); } } public boolean retainEntries( T#K##V#Procedure procedure ) { synchronized( mutex ) { return m.retainEntries( procedure ); } } public boolean increment( #k# key ) { synchronized( mutex ) { return m.increment( key ); } } public boolean adjustValue( #k# key, #v# amount ) { synchronized( mutex ) { return m.adjustValue( key, amount ); } } public #v# adjustOrPutValue( #k# key, #v# adjust_amount, #v# put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } } public boolean equals( Object o ) { synchronized( mutex ) { return m.equals( o ); } } public int hashCode() { synchronized( mutex ) { return m.hashCode(); } } public String toString() { synchronized( mutex ) { return m.toString(); } } private void writeObject( ObjectOutputStream s ) throws IOException { synchronized( mutex ) { s.defaultWriteObject(); } } } =====END_REPLICATED_CONTENT #4===== ====START_REPLICATED_CONTENT #5==== /** * @serial include */ public static class TSynchronized#E#ObjectMap<V> implements T#E#ObjectMap<V>, Serializable { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = 1978198479659022715L; private final T#E#ObjectMap<V> m; // Backing Map final Object mutex; // Object on which to synchronize public TSynchronized#E#ObjectMap( T#E#ObjectMap<V> m ) { if ( m == null ) throw new NullPointerException(); this.m = m; mutex = this; } public TSynchronized#E#ObjectMap( T#E#ObjectMap<V> m, Object mutex ) { this.m = m; this.mutex = mutex; } public int size() { synchronized( mutex ) { return m.size(); } } public boolean isEmpty(){ synchronized( mutex ) { return m.isEmpty(); } } public boolean containsKey( #e# key ) { synchronized( mutex ) { return m.containsKey( key ); } } public boolean containsValue( Object value ){ synchronized( mutex ) { return m.containsValue( value ); } } public V get( #e# key ) { synchronized( mutex ) { return m.get( key ); } } public V put( #e# key, V value ) { synchronized( mutex ) { return m.put( key, value ); } } public V remove( #e# key ) { synchronized( mutex ) { return m.remove( key ); } } public void putAll( Map<? extends #ET#, ? extends V> map ) { synchronized( mutex ) { m.putAll( map ); } } public void putAll( T#E#ObjectMap<V> map ) { synchronized( mutex ) { m.putAll( map ); } } public void clear() { synchronized( mutex ) { m.clear(); } } private transient T#E#Set keySet = null; private transient Collection<V> values = null; public T#E#Set keySet() { synchronized( mutex ) { if ( keySet == null ) keySet = new TSynchronized#E#Set( m.keySet(), mutex ); return keySet; } } public #e#[] keys() { synchronized( mutex ) { return m.keys(); } } public #e#[] keys( #e#[] array ) { synchronized( mutex ) { return m.keys( array ); } } public Collection<V> valueCollection() { synchronized( mutex ) { if ( values == null ) { // TODO: I don't think this is valid.. but what I want is package private.. values = Collections.synchronizedCollection( m.valueCollection() ); } return values; } } public V[] values() { synchronized( mutex ) { return m.values(); } } public <T> T[] values( T[] array ) { synchronized( mutex ) { return m.values( array ); } } public T#E#ObjectIterator<V> iterator() { return m.iterator(); // Must be manually synched by user! } // unchanging over the life of the map, no need to lock public #e# getNoEntryKey() { return m.getNoEntryKey(); } public V putIfAbsent( #e# key, V value ) { synchronized( mutex ) { return m.putIfAbsent( key, value ); } } public boolean forEachKey( T#E#Procedure procedure ) { synchronized( mutex ) { return m.forEachKey( procedure ); } } public boolean forEachValue( TObjectProcedure<V> procedure ) { synchronized( mutex ) { return m.forEachValue( procedure ); } } public boolean forEachEntry( T#E#ObjectProcedure<V> procedure ) { synchronized( mutex ) { return m.forEachEntry( procedure ); } } public void transformValues( TObjectFunction<V,V> function ) { synchronized( mutex ) { m.transformValues( function ); } } public boolean retainEntries( T#E#ObjectProcedure<V> procedure ) { synchronized( mutex ) { return m.retainEntries( procedure ); } } public boolean equals( Object o ) { synchronized( mutex ) { return m.equals( o ); } } public int hashCode() { synchronized( mutex ) { return m.hashCode(); } } public String toString() { synchronized( mutex ) { return m.toString(); } } private void writeObject( ObjectOutputStream s ) throws IOException { synchronized( mutex ) { s.defaultWriteObject(); } } } =====END_REPLICATED_CONTENT #5===== ====START_REPLICATED_CONTENT #6==== /** * @serial include */ public static class TSynchronizedObject#E#Map<K> implements TObject#E#Map<K>, Serializable { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = 1978198479659022715L; private final TObject#E#Map<K> m; // Backing Map final Object mutex; // Object on which to synchronize public TSynchronizedObject#E#Map( TObject#E#Map<K> m ) { if ( m == null ) throw new NullPointerException(); this.m = m; mutex = this; } public TSynchronizedObject#E#Map( TObject#E#Map<K> m, Object mutex ) { this.m = m; this.mutex = mutex; } public int size() { synchronized( mutex ) { return m.size(); } } public boolean isEmpty(){ synchronized( mutex ) { return m.isEmpty(); } } public boolean containsKey( Object key ) { synchronized( mutex ) { return m.containsKey( key ); } } public boolean containsValue( #e# value ){ synchronized( mutex ) { return m.containsValue( value ); } } public #e# get( Object key ) { synchronized( mutex ) { return m.get( key ); } } public #e# put( K key, #e# value ) { synchronized( mutex ) { return m.put( key, value ); } } public #e# remove( Object key ) { synchronized( mutex ) { return m.remove( key ); } } public void putAll( Map<? extends K, ? extends #ET#> map ) { synchronized( mutex ) { m.putAll( map ); } } public void putAll( TObject#E#Map<K> map ) { synchronized( mutex ) { m.putAll( map ); } } public void clear() { synchronized( mutex ) { m.clear(); } } private transient Set<K> keySet = null; private transient T#E#Collection values = null; public Set<K> keySet() { synchronized( mutex ) { if ( keySet == null ) { // TODO: don't think this is valid, but what I want is package private keySet = Collections.synchronizedSet( m.keySet() ); } return keySet; } } public Object[] keys() { synchronized( mutex ) { return m.keys(); } } public K[] keys( K[] array ) { synchronized( mutex ) { return m.keys( array ); } } public T#E#Collection valueCollection() { synchronized( mutex ) { if ( values == null ) values = new TSynchronized#E#Collection( m.valueCollection(), mutex ); return values; } } public #e#[] values() { synchronized( mutex ) { return m.values(); } } public #e#[] values( #e#[] array ) { synchronized( mutex ) { return m.values( array ); } } public TObject#E#Iterator<K> iterator() { return m.iterator(); // Must be manually synched by user! } // unchanging over the life of the map, no need to lock public #e# getNoEntryValue() { return m.getNoEntryValue(); } public #e# putIfAbsent( K key, #e# value ) { synchronized( mutex ) { return m.putIfAbsent( key, value ); } } public boolean forEachKey( TObjectProcedure<K> procedure ) { synchronized( mutex ) { return m.forEachKey( procedure ); } } public boolean forEachValue( T#E#Procedure procedure ) { synchronized( mutex ) { return m.forEachValue( procedure ); } } public boolean forEachEntry( TObject#E#Procedure<K> procedure ) { synchronized( mutex ) { return m.forEachEntry( procedure ); } } public void transformValues( T#E#Function function ) { synchronized( mutex ) { m.transformValues( function ); } } public boolean retainEntries( TObject#E#Procedure<K> procedure ) { synchronized( mutex ) { return m.retainEntries( procedure ); } } public boolean increment( K key ) { synchronized( mutex ) { return m.increment( key ); } } public boolean adjustValue( K key, #e# amount ) { synchronized( mutex ) { return m.adjustValue( key, amount ); } } public #e# adjustOrPutValue( K key, #e# adjust_amount, #e# put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } } public boolean equals( Object o ) { synchronized( mutex ) { return m.equals( o ); } } public int hashCode() { synchronized( mutex ) { return m.hashCode(); } } public String toString() { synchronized( mutex ) { return m.toString(); } } private void writeObject( ObjectOutputStream s ) throws IOException { synchronized( mutex ) { s.defaultWriteObject(); } } } =====END_REPLICATED_CONTENT #6===== --- NEW FILE: TUnmodifiableCollections.template --- /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2008, Robert D. Eden All Rights Reserved. // Copyright (c) 2009, Jeff Randall 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.impl; ////////////////////////////////////////////////// // THIS IS A GENERATED CLASS. DO NOT HAND EDIT! // ////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // THIS IS AN IMPLEMENTATION CLASS. DO NOT USE DIRECTLY! // // Access to these methods should be through TCollections // //////////////////////////////////////////////////////////// import gnu.trove.iterator.*; import gnu.trove.procedure.*; import gnu.trove.set.*; import gnu.trove.list.*; import gnu.trove.function.*; import gnu.trove.map.*; import gnu.trove.*; import java.util.Collection; import java.util.Collections; import java.util.Set; import java.util.Map; import java.util.RandomAccess; import java.util.Random; import java.io.Serializable; /** * The unmodifiable collections implementations. */ @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass", "JavaDoc"}) public class TUnmodifiableCollections { // Disallow creation of instances of this class private TUnmodifiableCollections() { } #REPLICATED1# #REPLICATED2# #REPLICATED3# #REPLICATED4# #REPLICATED5# #REPLICATED6# #REPLICATED7# } ====START_REPLICATED_CONTENT #1==== /** * @serial include */ public static class TUnmodifiable#E#Collection implements T#E#Collection, Serializable { // TODO: use a correctly formulated serialVersionUID private static final long serialVersionUID = 1820017752578914078L; final T#E#Collection c; public TUnmodifiable#E#Collection( T#E#Collection c ) { if ( c == null ) throw new NullPointerException(); this.c = c; } public int size() { return c.size(); } public boolean isEmpty() { return c.isEmpty(); } public boolean contains( #e# o ) { return c.contains( o ); } public #e#[] toArray() { return c.toArray(); } public #e#[] toArray( #e#[] a ) { return c.toArray( a ); } public String toString() { return c.toString(); } public #e# getNoEntryValue() { return c.getNoEntryValue(); } public boolean forEach( T#E#Procedure procedure ) { return c.forEach( procedure ); } public T#E#Iterator iterator() { return new T#E#Iterator() { T#E#Iterator i = c.iterator(); public boolean hasNext() { return i.hasNext(); } public #e# next() { return i.next(); } public void remove() { throw new UnsupportedOperationException(); } }; } public boolean add( #e# e ) { throw new UnsupportedOperationException(); } public boolean remove( #e# o ) { throw new UnsupportedOperationException(); } public boolean containsAll( Collection<?> coll ) { return c.containsAll( coll ); } public boolean containsAll( T#E#Collection coll ) { return c.containsAll( coll ); } public boolean containsAll( #e#[] array ) { return c.containsAll( array ); } public boolean addAll( T#E#Collection coll ) { throw new UnsupportedOperationException(); } public boolean addAll( Collection<? extends #ET#> coll ) { throw new UnsupportedOperationException(); } public boolean addAll( #e#[] array ) { throw new UnsupportedOperationException(); } public boolean removeAll( Collection<?> coll ) { throw new UnsupportedOperationException(); } public boolean removeAll( T#E#Collection coll ) { throw new UnsupportedOperationException(); } public boolean removeAll( #e#[] array ) { throw new UnsupportedOperationException(); } public boolean retainAll( Collection<?> coll ) { throw new UnsupportedOperationException(); } public boolean retainAll( T#E#Collection coll ) { throw new UnsupportedOperationException(); } public boolean retainAll( #e#[] array ) { throw new UnsupportedOperationException(); } public void clear() { throw new UnsupportedOperationException(); } } =====END_REPLICATED_CONTENT #1===== ====START_REPLICATED_CONTENT #2==== /** * @serial include */ public static class TUnmodifiable#E#Set extends TUnmodifiable#E#Collection implements T#E#Set, Serializable { private static final long serialVersionUID = -9215047833775013803L; public TUnmodifiable#E#Set( T#E#Set s ) { super( s ); } public boolean equals( Object o ) { return o == this || c.equals(o); } public int hashCode() { return c.hashCode(); } } =====END_REPLICATED_CONTENT #2===== ====START_REPLICATED_CONTENT #3==== // /** // * @serial include // */ // public static class TUnmodifiableSorted#E#Set // extends TUnmodifiable#E#Set // implements TSorted#E#Set, Serializable { // private static final long serialVersionUID = -4929149591599911165L; // private final TSorted#E#Set ss; // // public TUnmodifiableSorted#E#Set( TSorted#E#Set s ) { super( s ); ss = s; } // // public T#E#Comparator comparator() { return ss.comparator(); } // // public TSorted#E#Set subSet( int fromElement, int toElement ) { // return new TUnmodifiableSorted#E#Set( ss.subSet( fromElement, toElement ) ); // } // public TSorted#E#Set headSet( #e# toElement ) { // return new TUnmodifiableSorted#E#Set( ss.headSet( toElement ) ); // } // public TSorted#E#Set tailSet( #e# fromElement ) { // return new TUnmodifiableSortedIntSet( ss.tailSet( fromElement ) ); // } // // public #e# first() { return ss.first(); } // public #e# last() { return ss.last(); } // } =====END_REPLICATED_CONTENT #3===== ====START_REPLICATED_CONTENT #4==== /** * @serial include */ public static class TUnmodifiable#E#List extends TUnmodifiable#E#Collection implements T#E#List { static final long serialVersionUID = -283967356065247728L; final T#E#List list; public TUnmodifiable#E#List( T#E#List list ) { super( list ); this.list = list; } public boolean equals( Object o ) { return o == this || list.equals( o ); } public int hashCode() { return list.hashCode(); } public #e# get( int index ) { return list.get( index ); } public int indexOf( #e# o ) { return list.indexOf( o ); } public int lastIndexOf( #e# o ) { return list.lastIndexOf( o ); } public #e#[] toArray( int offset, int len ) { return list.toArray( offset, len ); } public #e#[] toArray( #e#[] dest, int offset, int len ) { return list.toArray( dest, offset, len ); } public boolean forEachDescending( T#E#Procedure procedure ) { return list.forEachDescending( procedure ); } public int binarySearch( #e# value ) { return list.binarySearch( value ); } public int binarySearch( #e# value, int fromIndex, int toIndex ) { return list.binarySearch( value, fromIndex, toIndex ); } public int indexOf( int offset, #e# value ) { return list.indexOf( offset, value ); } public int lastIndexOf( int offset, #e# value ) { return list.lastIndexOf( offset, value ); } public T#E#List grep( T#E#Procedure condition ) { return list.grep( condition ); } public T#E#List inverseGrep( T#E#Procedure condition ) { return list.inverseGrep( condition ); } public #e# max() { return list.max(); } public #e# min() { return list.min(); } public T#E#List subList( int fromIndex, int toIndex ) { return new TUnmodifiable#E#List( list.subList( fromIndex, toIndex ) ); } // TODO: Do we want to fullt implement ListIterator? // public TIntListIterator listIterator() {return listIterator(0);} // // public ListIterator<E> listIterator(final int index) { // return new ListIterator<E>() { // ListIterator<? extends E> i = list.listIterator(index); // // public boolean hasNext() {return i.hasNext();} // public E next() {return i.next();} // public boolean hasPrevious() {return i.hasPrevious();} // public E previous() {return i.previous();} // public int nextIndex() {return i.nextIndex();} // public int previousIndex() {return i.previousIndex();} // // public void remove() { // throw new UnsupportedOperationException(); // } // public void set(E e) { // throw new UnsupportedOperationException(); // } // public void add(E e) { // throw new UnsupportedOperationException(); // } // }; // } /** * UnmodifiableRandomAccessList instances are serialized as * UnmodifiableList instances to allow them to be deserialized * in pre-1.4 JREs (which do not have UnmodifiableRandomAccessList). * This method inverts the transformation. As a beneficial * side-effect, it also grafts the RandomAccess marker onto * UnmodifiableList instances that were serialized in pre-1.4 JREs. * * Note: Unfortunately, UnmodifiableRandomAccessList instances * serialized in 1.4.1 and deserialized in 1.4 will become * UnmodifiableList instances, as this method was missing in 1.4. */ private Object readResolve() { return ( list instanceof RandomAccess ? new TUnmodifiableRandomAccess#E#List( list ) : this); } public void add( #e#[] vals ) { throw new UnsupportedOperationException(); } public void add( #e#[] vals, int offset, int length ) { throw new UnsupportedOperationException(); } public #e# removeAt( int offset ) { throw new UnsupportedOperationException(); } public void remove( int offset, int length ) { throw new UnsupportedOperationException(); } public void insert( int offset, #e# value ) { throw new UnsupportedOperationException(); } public void insert( int offset, #e#[] values ) { throw new UnsupportedOperationException(); } public void insert( int offset, #e#[] values, int valOffset, int len ) { throw new UnsupportedOperationException(); } public void set( int offset, #e# val ) { throw new UnsupportedOperationException(); } public void set( int offset, #e#[] values ) { throw new UnsupportedOperationException(); } public void set( int offset, #e#[] values, int valOffset, int length ) { throw new UnsupportedOperationException(); } public #e# replace( int offset, #e# val ) { throw new UnsupportedOperationException(); } public void transformValues( T#E#Function function ) { throw new UnsupportedOperationException(); } public void reverse() { throw new UnsupportedOperationException(); } public void reverse( int from, int to ) { throw new UnsupportedOperationException(); } public void shuffle( Random rand ) { throw new UnsupportedOperationException(); } public void sort() { throw new UnsupportedOperationException(); } public void sort( int fromIndex, int toIndex ) { throw new UnsupportedOperationException(); } public void fill( #e# val ) { throw new UnsupportedOperationException(); } public void fill( int fromIndex, int toIndex, #e# val ) { throw new UnsupportedOperationException(); } } /** * @serial include */ public static class TUnmodifiableRandomAccess#E#List extends TUnmodifiable#E#List implements RandomAccess { public TUnmodifiableRandomAccess#E#List( T#E#List list ) { super( list ); } public T#E#List subList( int fromIndex, int toIndex ) { return new TUnmodifiableRandomAccess#E#List( list.subList( fromIndex, toIndex ) ); } private static final long serialVersionUID = -2542308836966382001L; /** * Allows instances to be deserialized in pre-1.4 JREs (which do * not have UnmodifiableRandomAccessList). UnmodifiableList has * a readResolve method that inverts this transformation upon * deserialization. */ private Object writeReplace() { return new TUnmodifiable#E#List( list ); } } =====END_REPLICATED_CONTENT #4===== ====START_REPLICATED_CONTENT #5==== /** * @serial include */ public static class TUnmodifiable#K##V#Map implements T#K##V#Map, Serializable { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = -1034234728574286014L; private final T#K##V#Map m; public TUnmodifiable#K##V#Map( T#K##V#Map m ) { if ( m == null ) throw new NullPointerException(); this.m = m; } public int size() { return m.size(); } public boolean isEmpty() { return m.isEmpty(); } public boolean containsKey( #k# key ) { return m.containsKey( key ); } public boolean containsValue( #v# val ) { return m.containsValue( val ); } public #v# get( #k# key) { return m.get( key ); } public #v# put( #k# key, #v# value ) { throw new UnsupportedOperationException(); } public #v# remove( #k# key ) { throw new UnsupportedOperationException(); } public void putAll( T#K##V#Map m ) { throw new UnsupportedOperationException(); } public void putAll( Map<? extends #KT#, ? extends #VT#> map ) { throw new UnsupportedOperationException(); } public void clear() { throw new UnsupportedOperationException(); } private transient T#K#Set keySet = null; private transient T#V#Collection values = null; public T#K#Set keySet() { if ( keySet == null ) keySet = TCollections.unmodifiableSet( m.keySet() ); return keySet; } public #k#[] keys() { return m.keys(); } public #k#[] keys( #k#[] array ) { return m.keys( array ); } public T#V#Collection valueCollection() { if ( values == null ) values = TCollections.unmodifiableCollection( m.valueCollection() ); return values; } public #v#[] values() { return m.values(); } public #v#[] values( #v#[] array ) { return m.values( array ); } public boolean equals(Object o) { return o == this || m.equals(o); } public int hashCode() { return m.hashCode(); } public String toString() { return m.toString(); } public #k# getNoEntryKey() { return m.getNoEntryKey(); } public #v# getNoEntryValue() { return m.getNoEntryValue(); } public boolean forEachKey( T#K#Procedure procedure ) { return m.forEachKey( procedure ); } public boolean forEachValue( T#V#Procedure procedure ) { return m.forEachValue( procedure ); } public boolean forEachEntry( T#K##V#Procedure procedure ) { return m.forEachEntry( procedure ); } public T#K##V#Iterator iterator() { return new T#K##V#Iterator() { T#K##V#Iterator iter = m.iterator(); public #k# key() { return iter.key(); } public #v# value() { return iter.value(); } public void advance() { iter.advance(); } public boolean hasNext() { return iter.hasNext(); } public #v# setValue( #v# val ) { throw new UnsupportedOperationException(); } public void remove() { throw new UnsupportedOperationException(); } }; } public #v# putIfAbsent( #k# key, #v# value ) { throw new UnsupportedOperationException(); } public void transformValues( T#V#Function function ) { throw new UnsupportedOperationException(); } public boolean retainEntries( T#K##V#Procedure procedure ) { throw new UnsupportedOperationException(); } public boolean increment( #k# key ) { throw new UnsupportedOperationException(); } public boolean adjustValue( #k# key, #v# amount ) { throw new UnsupportedOperationException(); } public #v# adjustOrPutValue( #k# key, #v# adjust_amount, #v# put_amount ) { throw new UnsupportedOperationException(); } } =====END_REPLICATED_CONTENT #5===== ====START_REPLICATED_CONTENT #6==== /** * @serial include */ public static class TUnmodifiable#E#ObjectMap<V> implements T#E#ObjectMap<V>, Serializable { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = -1034234728574286014L; private final T#E#ObjectMap<V> m; public TUnmodifiable#E#ObjectMap( T#E#ObjectMap<V> m ) { if ( m == null ) throw new NullPointerException(); this.m = m; } public int size() { return m.size(); } public boolean isEmpty() { return m.isEmpty(); } public boolean containsKey( #e# key ) { return m.containsKey( key ); } public boolean containsValue( Object val ) { return m.containsValue( val ); } public V get( #e# key) { return m.get( key ); } public V put( #e# key, V value ) { throw new UnsupportedOperationException(); } public V remove( #e# key ) { throw new UnsupportedOperationException(); } public void putAll( T#E#ObjectMap<V> m ) { throw new UnsupportedOperationException(); } public void putAll( Map<? extends #KT#, ? extends V> map ) { throw new UnsupportedOperationException(); } public void clear() { throw new UnsupportedOperationException(); } private transient T#E#Set keySet = null; private transient Collection<V> values = null; public T#E#Set keySet() { if ( keySet == null ) keySet = TCollections.unmodifiableSet( m.keySet() ); return keySet; } public #e#[] keys() { return m.keys(); } public #e#[] keys( #e#[] array ) { return m.keys( array ); } public Collection<V> valueCollection() { if ( values == null ) values = Collections.unmodifiableCollection( m.valueCollection() ); return values; } public V[] values() { return m.values(); } public <T> T[] values( T[] array ) { return m.values( array ); } public boolean equals(Object o) { return o == this || m.equals(o); } public int hashCode() { return m.hashCode(); } public String toString() { return m.toString(); } public #e# getNoEntryKey() { return m.getNoEntryKey(); } public boolean forEachKey( T#E#Procedure procedure ) { return m.forEachKey( procedure ); } public boolean forEachValue( TObjectProcedure<V> procedure ) { return m.forEachValue( procedure ); } public boolean forEachEntry( T#E#ObjectProcedure<V> procedure ) { return m.forEachEntry( procedure ); } public T#E#ObjectIterator<V> iterator() { return new T#E#ObjectIterator<V>() { T#E#ObjectIterator<V> iter = m.iterator(); public #e# key() { return iter.key(); } public V value() { return iter.value(); } public void advance() { iter.advance(); } public boolean hasNext() { return iter.hasNext(); } public V setValue( V val ) { throw new UnsupportedOperationException(); } public void remove() { throw new UnsupportedOperationException(); } }; } public V putIfAbsent( #e# key, V value ) { throw new UnsupportedOperationException(); } public void transformValues( TObjectFunction<V,V> function ) { throw new UnsupportedOperationException(); } public boolean retainEntries( T#E#ObjectProcedure<V> procedure ) { throw new UnsupportedOperationException(); } } =====END_REPLICATED_CONTENT #6===== ====START_REPLICATED_CONTENT #7==== /** * @serial include */ public static class TUnmodifiableObject#E#Map<K> implements TObject#E#Map<K>, Serializable { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = -1034234728574286014L; private final TObject#E#Map<K> m; public TUnmodifiableObject#E#Map( TObject#E#Map<K> m ) { if ( m == null ) throw new NullPointerException(); this.m = m; } public int size() { return m.size(); } public boolean isEmpty() { return m.isEmpty(); } public boolean containsKey( Object key ){ return m.containsKey( key ); } public boolean containsValue( #e# val ) { return m.containsValue( val ); } public #e# get( Object key ) { return m.get( key ); } public #e# put( K key, #e# value ) { throw new UnsupportedOperationException(); } public #e# remove( Object key ) { throw new UnsupportedOperationException(); } public void putAll( TObject#E#Map m ) { throw new UnsupportedOperationException(); } public void putAll( Map<? extends K, ? extends #ET#> map ) { throw new UnsupportedOperationException(); } public void clear() { throw new UnsupportedOperationException(); } private transient Set<K> keySet = null; private transient T#E#Collection values = null; public Set<K> keySet() { if ( keySet == null ) keySet = Collections.unmodifiableSet( m.keySet() ); return keySet; } public Object[] keys() { return m.keys(); } public K[] keys( K[] array ) { return m.keys( array ); } public T#E#Collection valueCollection() { if ( values == null ) values = TCollections.unmodifiableCollection( m.valueCollection() ); return values; } public #e#[] values() { return m.values(); } public #e#[] values( #e#[] array ) { return m.values( array ); } public boolean equals(Object o) { return o == this || m.equals(o); } public int hashCode() { return m.hashCode(); } public String toString() { return m.toString(); } public #e# getNoEntryValue() { return m.getNoEntryValue(); } public boolean forEachKey( TObjectProcedure<K> procedure ) { return m.forEachKey( procedure ); } public boolean forEachValue( T#E#Procedure procedure ) { return m.forEachValue( procedure ); } public boolean forEachEntry( TObject#E#Procedure<K> procedure ) { return m.forEachEntry( procedure ); } public TObject#E#Iterator<K> iterator() { return new TObject#E#Iterator<K>() { TObject#E#Iterator<K> iter = m.iterator(); public K key() { return iter.key(); } public #e# value() { return iter.value(); } public void advance() { iter.advance(); } public boolean hasNext() { return iter.hasNext(); } public #e# setValue( #e# val ) { throw new UnsupportedOperationException(); } public void remove() { throw new UnsupportedOperationException(); } }; } public #e# putIfAbsent( K key, #e# value ) { throw new UnsupportedOperationException(); } public void transformValues( T#E#Function function ) { throw new UnsupportedOperationException(); } public boolean retainEntries( TObject#E#Procedure procedure ) { throw new UnsupportedOperationException(); } public boolean increment( K key ) { throw new UnsupportedOperationException(); } public boolean adjustValue( K key, #e# amount ) { throw new UnsupportedOperationException(); } public #e# adjustOrPutValue( K key, #e# adjust_amount, #e# put_amount ) { throw new UnsupportedOperationException(); } } =====END_REPLICATED_CONTENT #7===== |
From: Jeff R. <uph...@us...> - 2009-10-02 00:37:46
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/map/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5859/templates/gnu/trove/map/hash Modified Files: Tag: TROVE_3_WORKING _K__V_HashMap.template Log Message: Fix test and code errors exposed when NoEntryKey/NoEntryValue are not 0 Index: _K__V_HashMap.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/map/hash/Attic/_K__V_HashMap.template,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -C2 -d -r1.1.2.8 -r1.1.2.9 *** _K__V_HashMap.template 30 Sep 2009 05:36:53 -0000 1.1.2.8 --- _K__V_HashMap.template 2 Oct 2009 00:37:31 -0000 1.1.2.9 *************** *** 251,255 **** /** {@inheritDoc} */ public #v# remove( #k# key ) { ! #v# prev = (#v#) 0; int index = index( key ); if ( index >= 0 ) { --- 251,255 ---- /** {@inheritDoc} */ public #v# remove( #k# key ) { ! #v# prev = no_entry_value; int index = index( key ); if ( index >= 0 ) { |
From: Jeff R. <uph...@us...> - 2009-10-02 00:37:46
|
Update of /cvsroot/trove4j/trove/test/gnu/trove/map/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5859/test/gnu/trove/map/hash Modified Files: Tag: TROVE_3_WORKING TPrimitivePrimitiveHashMapTest.java Log Message: Fix test and code errors exposed when NoEntryKey/NoEntryValue are not 0 Index: TPrimitivePrimitiveHashMapTest.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/map/hash/Attic/TPrimitivePrimitiveHashMapTest.java,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** TPrimitivePrimitiveHashMapTest.java 27 Sep 2009 06:23:58 -0000 1.1.2.6 --- TPrimitivePrimitiveHashMapTest.java 2 Oct 2009 00:37:31 -0000 1.1.2.7 *************** *** 781,785 **** TIntList list = new TIntArrayList( null, keys ); TIntSet set = map.keySet(); ! assertEquals( map.getNoEntryValue(), set.getNoEntryValue() ); // test basic iterator function. --- 781,785 ---- TIntList list = new TIntArrayList( null, keys ); TIntSet set = map.keySet(); ! assertEquals( map.getNoEntryKey(), set.getNoEntryValue() ); // test basic iterator function. *************** *** 1901,1905 **** assertEquals( 10, map.putIfAbsent( 1, 111 ) ); assertEquals( 10, map.get( 1 ) ); ! assertEquals( 0, map.putIfAbsent( 9, 90 ) ); assertEquals( 90, map.get( 9 ) ); } --- 1901,1905 ---- assertEquals( 10, map.putIfAbsent( 1, 111 ) ); assertEquals( 10, map.get( 1 ) ); ! assertEquals( map.getNoEntryValue(), map.putIfAbsent( 9, 90 ) ); assertEquals( 90, map.get( 9 ) ); } |
From: Jeff R. <uph...@us...> - 2009-09-30 05:45:46
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14682/templates/gnu/trove Modified Files: Tag: TROVE_3_WORKING TCollections.template Log Message: Update method names to remove unneeded specification of the primitive types Index: TCollections.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/Attic/TCollections.template,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** TCollections.template 30 Sep 2009 05:40:06 -0000 1.1.2.1 --- TCollections.template 30 Sep 2009 05:45:35 -0000 1.1.2.2 *************** *** 120,124 **** // * @return an unmodifiable view of the specified Trove primitive sorted set. // */ ! // public static TSorted#E#Set unmodifiableSorted#E#Set( TSorted#E#Set s ) { // return new TUnmodifiableCollections.TUnmodifiableSorted#E#Set( s ); // } --- 120,124 ---- // * @return an unmodifiable view of the specified Trove primitive sorted set. // */ ! // public static TSorted#E#Set unmodifiableSortedTSet( TSorted#E#Set s ) { // return new TUnmodifiableCollections.TUnmodifiableSorted#E#Set( s ); // } *************** *** 140,144 **** * @return an unmodifiable view of the specified Trove primitive list. */ ! public static T#E#List unmodifiableIntList( T#E#List list) { return ( list instanceof RandomAccess ? new TUnmodifiableCollections.TUnmodifiableRandomAccess#E#List( list ) : --- 140,144 ---- * @return an unmodifiable view of the specified Trove primitive list. */ ! public static T#E#List unmodifiableTList( T#E#List list) { return ( list instanceof RandomAccess ? new TUnmodifiableCollections.TUnmodifiableRandomAccess#E#List( list ) : *************** *** 161,165 **** * @return an unmodifiable view of the specified Trove primitive/primitive map. */ ! public static T#K##V#Map unmodifiableIntLongMap( T#K##V#Map m ) { return new TUnmodifiableCollections.TUnmodifiable#K##V#Map( m ); } --- 161,165 ---- * @return an unmodifiable view of the specified Trove primitive/primitive map. */ ! public static T#K##V#Map unmodifiableTMap( T#K##V#Map m ) { return new TUnmodifiableCollections.TUnmodifiable#K##V#Map( m ); } |
From: Jeff R. <uph...@us...> - 2009-09-30 05:40:20
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12795/templates/gnu/trove Added Files: Tag: TROVE_3_WORKING TCollections.template TUnmodifiableCollections.template Log Message: Unmodifiable collections --- NEW FILE: TCollections.template --- /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2008, Robert D. Eden All Rights Reserved. // Copyright (c) 2009, Jeff Randall 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; ////////////////////////////////////////////////// // THIS IS A GENERATED CLASS. DO NOT HAND EDIT! // ////////////////////////////////////////////////// import gnu.trove.set.*; import gnu.trove.list.*; import gnu.trove.map.*; import java.util.RandomAccess; /** * Trove equivalent of the {@link java.util.Collections} class. */ @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass", "JavaDoc"}) public class TCollections { // Disallow creation of instances of this class private TCollections() { } #REPLICATED1# #REPLICATED2# #REPLICATED3# #REPLICATED4# #REPLICATED5# } ====START_REPLICATED_CONTENT #1==== /** * Returns an unmodifiable view of the specified Trove primitive collection. This method * allows modules to provide users with "read-only" access to internal * collections. Query operations on the returned collection "read through" * to the specified collection, and attempts to modify the returned * collection, whether direct or via its iterator, result in an * <tt>UnsupportedOperationException</tt>.<p> * * The returned collection does <i>not</i> pass the hashCode and equals * operations through to the backing collection, but relies on * <tt>Object</tt>'s <tt>equals</tt> and <tt>hashCode</tt> methods. This * is necessary to preserve the contracts of these operations in the case * that the backing collection is a set or a list.<p> * * The returned collection will be serializable if the specified collection * is serializable. * * @param c the collection for which an unmodifiable view is to be * returned. * @return an unmodifiable view of the specified Trove primitive collection. */ public static T#E#Collection unmodifiableTCollection( T#E#Collection c ) { return new TUnmodifiableCollections.TUnmodifiable#E#Collection( c ); } =====END_REPLICATED_CONTENT #1===== ====START_REPLICATED_CONTENT #2==== /** * Returns an unmodifiable view of the specified Trove primitive set. This method allows * modules to provide users with "read-only" access to internal sets. * Query operations on the returned set "read through" to the specified * set, and attempts to modify the returned set, whether direct or via its * iterator, result in an <tt>UnsupportedOperationException</tt>.<p> * * The returned set will be serializable if the specified set * is serializable. * * @param s the set for which an unmodifiable view is to be returned. * @return an unmodifiable view of the specified Trove primitive set. */ public static T#E#Set unmodifiableTSet( T#E#Set s ) { return new TUnmodifiableCollections.TUnmodifiable#E#Set( s ); } =====END_REPLICATED_CONTENT #2===== ====START_REPLICATED_CONTENT #3==== // TODO: Uncomment when we have implemented Sorted primitive sets. // /** // * Returns an unmodifiable view of the specified Trove primitive sorted set. This method // * allows modules to provide users with "read-only" access to internal // * sorted sets. Query operations on the returned sorted set "read // * through" to the specified sorted set. Attempts to modify the returned // * sorted set, whether direct, via its iterator, or via its // * <tt>subSet</tt>, <tt>headSet</tt>, or <tt>tailSet</tt> views, result in // * an <tt>UnsupportedOperationException</tt>.<p> // * // * The returned sorted set will be serializable if the specified sorted set // * is serializable. // * // * @param s the sorted set for which an unmodifiable view is to be // * returned. // * @return an unmodifiable view of the specified Trove primitive sorted set. // */ // public static TSorted#E#Set unmodifiableSorted#E#Set( TSorted#E#Set s ) { // return new TUnmodifiableCollections.TUnmodifiableSorted#E#Set( s ); // } =====END_REPLICATED_CONTENT #3===== ====START_REPLICATED_CONTENT #4==== /** * Returns an unmodifiable view of the specified Trove primitive list. This method allows * modules to provide users with "read-only" access to internal * lists. Query operations on the returned list "read through" to the * specified list, and attempts to modify the returned list, whether * direct or via its iterator, result in an * <tt>UnsupportedOperationException</tt>.<p> * * The returned list will be serializable if the specified list * is serializable. Similarly, the returned list will implement * {@link RandomAccess} if the specified list does. * * @param list the list for which an unmodifiable view is to be returned. * @return an unmodifiable view of the specified Trove primitive list. */ public static T#E#List unmodifiableIntList( T#E#List list) { return ( list instanceof RandomAccess ? new TUnmodifiableCollections.TUnmodifiableRandomAccess#E#List( list ) : new TUnmodifiableCollections.TUnmodifiable#E#List( list ) ); } =====END_REPLICATED_CONTENT #4===== ====START_REPLICATED_CONTENT #5==== /** * Returns an unmodifiable view of the specified Trove primitive/primitive map. This method * allows modules to provide users with "read-only" access to internal * maps. Query operations on the returned map "read through" * to the specified map, and attempts to modify the returned * map, whether direct or via its collection views, result in an * <tt>UnsupportedOperationException</tt>.<p> * * The returned map will be serializable if the specified map * is serializable. * * @param m the map for which an unmodifiable view is to be returned. * @return an unmodifiable view of the specified Trove primitive/primitive map. */ public static T#K##V#Map unmodifiableIntLongMap( T#K##V#Map m ) { return new TUnmodifiableCollections.TUnmodifiable#K##V#Map( m ); } =====END_REPLICATED_CONTENT #5===== --- NEW FILE: TUnmodifiableCollections.template --- /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2008, Robert D. Eden All Rights Reserved. // Copyright (c) 2009, Jeff Randall 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; ////////////////////////////////////////////////// // THIS IS A GENERATED CLASS. DO NOT HAND EDIT! // ////////////////////////////////////////////////// import gnu.trove.iterator.*; import gnu.trove.procedure.*; import gnu.trove.set.*; import gnu.trove.list.*; import gnu.trove.function.*; import gnu.trove.map.*; import java.util.Collection; import java.util.RandomAccess; import java.util.Random; import java.util.Map; import java.io.Serializable; /** * The unmodifiable collections implementations. */ @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass", "JavaDoc"}) class TUnmodifiableCollections { // Disallow creation of instances of this class private TUnmodifiableCollections() { } #REPLICATED1# #REPLICATED2# #REPLICATED3# #REPLICATED4# #REPLICATED5# } ====START_REPLICATED_CONTENT #1==== /** * @serial include */ static class TUnmodifiable#E#Collection implements T#E#Collection, Serializable { // TODO: use a correctly formulated serialVersionUID private static final long serialVersionUID = 1820017752578914078L; final T#E#Collection c; TUnmodifiable#E#Collection( T#E#Collection c ) { if ( c == null ) throw new NullPointerException(); this.c = c; } public int size() { return c.size(); } public boolean isEmpty() { return c.isEmpty(); } public boolean contains( #e# o ) { return c.contains( o ); } public #e#[] toArray() { return c.toArray(); } public #e#[] toArray( #e#[] a ) { return c.toArray( a ); } public String toString() { return c.toString(); } public #e# getNoEntryValue() { return c.getNoEntryValue(); } public boolean forEach( T#E#Procedure procedure ) { return c.forEach( procedure ); } public T#E#Iterator iterator() { return new T#E#Iterator() { T#E#Iterator i = c.iterator(); public boolean hasNext() { return i.hasNext(); } public #e# next() { return i.next(); } public void remove() { throw new UnsupportedOperationException(); } }; } public boolean add( #e# e ) { throw new UnsupportedOperationException(); } public boolean remove( #e# o ) { throw new UnsupportedOperationException(); } public boolean containsAll( Collection<?> coll ) { return c.containsAll( coll ); } public boolean containsAll( T#E#Collection coll ) { return c.containsAll( coll ); } public boolean containsAll( #e#[] array ) { return c.containsAll( array ); } public boolean addAll( T#E#Collection coll ) { throw new UnsupportedOperationException(); } public boolean addAll( Collection<? extends #ET#> coll ) { throw new UnsupportedOperationException(); } public boolean addAll( #e#[] array ) { throw new UnsupportedOperationException(); } public boolean removeAll( Collection<?> coll ) { throw new UnsupportedOperationException(); } public boolean removeAll( T#E#Collection coll ) { throw new UnsupportedOperationException(); } public boolean removeAll( #e#[] array ) { throw new UnsupportedOperationException(); } public boolean retainAll( Collection<?> coll ) { throw new UnsupportedOperationException(); } public boolean retainAll( T#E#Collection coll ) { throw new UnsupportedOperationException(); } public boolean retainAll( #e#[] array ) { throw new UnsupportedOperationException(); } public void clear() { throw new UnsupportedOperationException(); } } =====END_REPLICATED_CONTENT #1===== ====START_REPLICATED_CONTENT #2==== /** * @serial include */ static class TUnmodifiable#E#Set extends TUnmodifiable#E#Collection implements T#E#Set, Serializable { private static final long serialVersionUID = -9215047833775013803L; TUnmodifiable#E#Set( T#E#Set s ) { super( s ); } public boolean equals( Object o ) { return o == this || c.equals(o); } public int hashCode() { return c.hashCode(); } } =====END_REPLICATED_CONTENT #2===== ====START_REPLICATED_CONTENT #3==== // /** // * @serial include // */ // static class TUnmodifiableSorted#E#Set // extends TUnmodifiable#E#Set // implements TSorted#E#Set, Serializable { // private static final long serialVersionUID = -4929149591599911165L; // private final TSorted#E#Set ss; // // TUnmodifiableSorted#E#Set( TSorted#E#Set s ) { super( s ); ss = s; } // // public T#E#Comparator comparator() { return ss.comparator(); } // // public TSorted#E#Set subSet( int fromElement, int toElement ) { // return new TUnmodifiableSorted#E#Set( ss.subSet( fromElement, toElement ) ); // } // public TSorted#E#Set headSet( #e# toElement ) { // return new TUnmodifiableSorted#E#Set( ss.headSet( toElement ) ); // } // public TSorted#E#Set tailSet( #e# fromElement ) { // return new TUnmodifiableSortedIntSet( ss.tailSet( fromElement ) ); // } // // public #e# first() { return ss.first(); } // public #e# last() { return ss.last(); } // } =====END_REPLICATED_CONTENT #3===== ====START_REPLICATED_CONTENT #4==== /** * @serial include */ static class TUnmodifiable#E#List extends TUnmodifiable#E#Collection implements T#E#List { static final long serialVersionUID = -283967356065247728L; final T#E#List list; TUnmodifiable#E#List( T#E#List list ) { super( list ); this.list = list; } public boolean equals( Object o ) { return o == this || list.equals( o ); } public int hashCode() { return list.hashCode(); } public #e# get( int index ) { return list.get( index ); } public int indexOf( #e# o ) { return list.indexOf( o ); } public int lastIndexOf( #e# o ) { return list.lastIndexOf( o ); } public #e#[] toArray( int offset, int len ) { return list.toArray( offset, len ); } public #e#[] toArray( #e#[] dest, int offset, int len ) { return list.toArray( dest, offset, len ); } public boolean forEachDescending( T#E#Procedure procedure ) { return list.forEachDescending( procedure ); } public int binarySearch( #e# value ) { return list.binarySearch( value ); } public int binarySearch( #e# value, int fromIndex, int toIndex ) { return list.binarySearch( value, fromIndex, toIndex ); } public int indexOf( int offset, #e# value ) { return list.indexOf( offset, value ); } public int lastIndexOf( int offset, #e# value ) { return list.lastIndexOf( offset, value ); } public T#E#List grep( T#E#Procedure condition ) { return list.grep( condition ); } public T#E#List inverseGrep( T#E#Procedure condition ) { return list.inverseGrep( condition ); } public #e# max() { return list.max(); } public #e# min() { return list.min(); } public T#E#List subList( int fromIndex, int toIndex ) { return new TUnmodifiable#E#List( list.subList( fromIndex, toIndex ) ); } // TODO: Do we want to fullt implement ListIterator? // public TIntListIterator listIterator() {return listIterator(0);} // // public ListIterator<E> listIterator(final int index) { // return new ListIterator<E>() { // ListIterator<? extends E> i = list.listIterator(index); // // public boolean hasNext() {return i.hasNext();} // public E next() {return i.next();} // public boolean hasPrevious() {return i.hasPrevious();} // public E previous() {return i.previous();} // public int nextIndex() {return i.nextIndex();} // public int previousIndex() {return i.previousIndex();} // // public void remove() { // throw new UnsupportedOperationException(); // } // public void set(E e) { // throw new UnsupportedOperationException(); // } // public void add(E e) { // throw new UnsupportedOperationException(); // } // }; // } /** * UnmodifiableRandomAccessList instances are serialized as * UnmodifiableList instances to allow them to be deserialized * in pre-1.4 JREs (which do not have UnmodifiableRandomAccessList). * This method inverts the transformation. As a beneficial * side-effect, it also grafts the RandomAccess marker onto * UnmodifiableList instances that were serialized in pre-1.4 JREs. * * Note: Unfortunately, UnmodifiableRandomAccessList instances * serialized in 1.4.1 and deserialized in 1.4 will become * UnmodifiableList instances, as this method was missing in 1.4. */ private Object readResolve() { return ( list instanceof RandomAccess ? new TUnmodifiableRandomAccess#E#List( list ) : this); } public void add( #e#[] vals ) { throw new UnsupportedOperationException(); } public void add( #e#[] vals, int offset, int length ) { throw new UnsupportedOperationException(); } public #e# removeAt( int offset ) { throw new UnsupportedOperationException(); } public void remove( int offset, int length ) { throw new UnsupportedOperationException(); } public void insert( int offset, #e# value ) { throw new UnsupportedOperationException(); } public void insert( int offset, #e#[] values ) { throw new UnsupportedOperationException(); } public void insert( int offset, #e#[] values, int valOffset, int len ) { throw new UnsupportedOperationException(); } public void set( int offset, #e# val ) { throw new UnsupportedOperationException(); } public void set( int offset, #e#[] values ) { throw new UnsupportedOperationException(); } public void set( int offset, #e#[] values, int valOffset, int length ) { throw new UnsupportedOperationException(); } public #e# replace( int offset, #e# val ) { throw new UnsupportedOperationException(); } public void transformValues( T#E#Function function ) { throw new UnsupportedOperationException(); } public void reverse() { throw new UnsupportedOperationException(); } public void reverse( int from, int to ) { throw new UnsupportedOperationException(); } public void shuffle( Random rand ) { throw new UnsupportedOperationException(); } public void sort() { throw new UnsupportedOperationException(); } public void sort( int fromIndex, int toIndex ) { throw new UnsupportedOperationException(); } public void fill( #e# val ) { throw new UnsupportedOperationException(); } public void fill( int fromIndex, int toIndex, #e# val ) { throw new UnsupportedOperationException(); } } /** * @serial include */ static class TUnmodifiableRandomAccess#E#List extends TUnmodifiable#E#List implements RandomAccess { TUnmodifiableRandomAccess#E#List( T#E#List list ) { super( list ); } public T#E#List subList( int fromIndex, int toIndex ) { return new TUnmodifiableRandomAccess#E#List( list.subList( fromIndex, toIndex ) ); } private static final long serialVersionUID = -2542308836966382001L; /** * Allows instances to be deserialized in pre-1.4 JREs (which do * not have UnmodifiableRandomAccessList). UnmodifiableList has * a readResolve method that inverts this transformation upon * deserialization. */ private Object writeReplace() { return new TUnmodifiable#E#List( list ); } } =====END_REPLICATED_CONTENT #4===== ====START_REPLICATED_CONTENT #5==== /** * @serial include */ static class TUnmodifiable#K##V#Map implements T#K##V#Map, Serializable { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = -1034234728574286014L; private final T#K##V#Map m; TUnmodifiable#K##V#Map( T#K##V#Map m ) { if ( m == null ) throw new NullPointerException(); this.m = m; } public int size() { return m.size(); } public boolean isEmpty() { return m.isEmpty(); } public boolean containsKey( #k# key ) { return m.containsKey( key ); } public boolean containsValue( #v# val ) { return m.containsValue( val ); } public #v# get( #k# key) { return m.get( key ); } public #v# put( #k# key, #v# value ) { throw new UnsupportedOperationException(); } public #v# remove( #k# key ) { throw new UnsupportedOperationException(); } public void putAll( T#K##V#Map m ) { throw new UnsupportedOperationException(); } public void putAll( Map<? extends #KT#, ? extends #VT#> map ) { throw new UnsupportedOperationException(); } public void clear() { throw new UnsupportedOperationException(); } private transient T#K#Set keySet = null; private transient T#V#Collection values = null; public T#K#Set keySet() { if ( keySet == null ) keySet = TCollections.unmodifiableTSet( m.keySet() ); return keySet; } public #k#[] keys() { return m.keys(); } public #k#[] keys( #k#[] array ) { return m.keys( array ); } public T#V#Collection valueCollection() { if ( values == null ) values = TCollections.unmodifiableTCollection( m.valueCollection() ); return values; } public #v#[] values() { return m.values(); } public #v#[] values( #v#[] array ) { return m.values( array ); } public boolean equals(Object o) { return o == this || m.equals(o); } public int hashCode() { return m.hashCode(); } public String toString() { return m.toString(); } public #k# getNoEntryKey() { return m.getNoEntryKey(); } public #v# getNoEntryValue() { return m.getNoEntryValue(); } public boolean forEachKey( T#K#Procedure procedure ) { return m.forEachKey( procedure ); } public boolean forEachValue( T#V#Procedure procedure ) { return m.forEachValue( procedure ); } public boolean forEachEntry( T#K##V#Procedure procedure ) { return m.forEachEntry( procedure ); } public T#K##V#Iterator iterator() { return new T#K##V#Iterator() { T#K##V#Iterator iter = m.iterator(); public #k# key() { return iter.key(); } public #v# value() { return iter.value(); } public void advance() { iter.advance(); } public boolean hasNext() { return iter.hasNext(); } public #v# setValue( #v# val ) { throw new UnsupportedOperationException(); } public void remove() { throw new UnsupportedOperationException(); } }; } public #v# putIfAbsent( #k# key, #v# value ) { throw new UnsupportedOperationException(); } public void transformValues( T#V#Function function ) { throw new UnsupportedOperationException(); } public boolean retainEntries( T#K##V#Procedure procedure ) { throw new UnsupportedOperationException(); } public boolean increment( #k# key ) { throw new UnsupportedOperationException(); } public boolean adjustValue( #k# key, #v# amount ) { throw new UnsupportedOperationException(); } public #v# adjustOrPutValue( #k# key, #v# adjust_amount, #v# put_amount ) { throw new UnsupportedOperationException(); } } =====END_REPLICATED_CONTENT #5===== |
From: Jeff R. <uph...@us...> - 2009-09-30 05:39:44
|
Update of /cvsroot/trove4j/trove/generator_src/gnu/trove/generator In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12570/generator_src/gnu/trove/generator Modified Files: Tag: TROVE_3_WORKING Generator.java Log Message: Add support for all caps abbreviations in the replicated patterns. Index: Generator.java =================================================================== RCS file: /cvsroot/trove4j/trove/generator_src/gnu/trove/generator/Attic/Generator.java,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -C2 -d -r1.1.2.9 -r1.1.2.10 *** Generator.java 24 Sep 2009 04:18:05 -0000 1.1.2.9 --- Generator.java 30 Sep 2009 05:39:33 -0000 1.1.2.10 *************** *** 292,295 **** --- 292,296 ---- String KT = info.class_name; String K = abbreviate( KT ); + String KC = K.toUpperCase(); String KMAX = info.max_value; String KMIN = info.min_value; *************** *** 301,304 **** --- 302,306 ---- String VT = jinfo.class_name; String V = abbreviate( VT ); + String VC = V.toUpperCase(); String VMAX = jinfo.max_value; String VMIN = jinfo.min_value; *************** *** 309,312 **** --- 311,315 ---- out = Pattern.compile( "#E#" ).matcher( out ).replaceAll( K ); out = Pattern.compile( "#ET#" ).matcher( out ).replaceAll( KT ); + out = Pattern.compile( "#EC#" ).matcher( out ).replaceAll( KC ); out = Pattern.compile( "#EMAX#" ).matcher( out ).replaceAll( KMAX ); out = Pattern.compile( "#EMIN#" ).matcher( out ).replaceAll( KMIN ); *************** *** 320,323 **** --- 323,327 ---- out = Pattern.compile( "#V#" ).matcher( out ).replaceAll( V ); out = Pattern.compile( "#VT#" ).matcher( out ).replaceAll( VT ); + out = Pattern.compile( "#VC#" ).matcher( out ).replaceAll( VC ); out = Pattern.compile( "#VMAX#" ).matcher( out ).replaceAll( VMAX ); out = Pattern.compile( "#VMIN#" ).matcher( out ).replaceAll( VMIN ); *************** *** 326,329 **** --- 330,334 ---- out = Pattern.compile( "#K#" ).matcher( out ).replaceAll( K ); out = Pattern.compile( "#KT#" ).matcher( out ).replaceAll( KT ); + out = Pattern.compile( "#KC#" ).matcher( out ).replaceAll( KC ); out = Pattern.compile( "#KMAX#" ).matcher( out ).replaceAll( KMAX ); out = Pattern.compile( "#KMIN#" ).matcher( out ).replaceAll( KMIN ); |
From: Jeff R. <uph...@us...> - 2009-09-30 05:37:17
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/map/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11675/templates/gnu/trove/map/hash Modified Files: Tag: TROVE_3_WORKING _K__V_HashMap.template Log Message: Expand the capture domain of the generics used for putAll() to match those used in Collections. Index: _K__V_HashMap.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/map/hash/Attic/_K__V_HashMap.template,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** _K__V_HashMap.template 27 Sep 2009 06:23:59 -0000 1.1.2.7 --- _K__V_HashMap.template 30 Sep 2009 05:36:53 -0000 1.1.2.8 *************** *** 207,214 **** /** {@inheritDoc} */ ! public void putAll( Map<#KT#, #VT#> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap ! for ( Map.Entry<#KT#, #VT#> entry : map.entrySet() ) { this.put( entry.getKey().#k#Value(), entry.getValue().#v#Value() ); } --- 207,214 ---- /** {@inheritDoc} */ ! public void putAll( Map<? extends #KT#, ? extends #VT#> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap ! for ( Map.Entry<? extends #KT#, ? extends #VT#> entry : map.entrySet() ) { this.put( entry.getKey().#k#Value(), entry.getValue().#v#Value() ); } |
From: Jeff R. <uph...@us...> - 2009-09-30 05:37:06
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/map In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11675/templates/gnu/trove/map Modified Files: Tag: TROVE_3_WORKING _K__V_Map.template Log Message: Expand the capture domain of the generics used for putAll() to match those used in Collections. Index: _K__V_Map.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/map/Attic/_K__V_Map.template,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** _K__V_Map.template 14 Sep 2009 19:02:20 -0000 1.1.2.4 --- _K__V_Map.template 30 Sep 2009 05:36:54 -0000 1.1.2.5 *************** *** 89,93 **** * @param map The Map from which entries will be obtained to put into this map. */ ! public void putAll( Map<#KT#, #VT#> map ); --- 89,93 ---- * @param map The Map from which entries will be obtained to put into this map. */ ! public void putAll( Map<? extends #KT#, ? extends #VT#> map ); |
From: Rob E. <ro...@us...> - 2009-09-27 22:10:48
|
Update of /cvsroot/trove4j/trove/test/gnu/trove/benchmark In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18162/trove/test/gnu/trove/benchmark Modified Files: Tag: TROVE_3_WORKING BenchmarkRunner.java Log Message: cleanup commented out line Index: BenchmarkRunner.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/BenchmarkRunner.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** BenchmarkRunner.java 27 Sep 2009 22:07:16 -0000 1.1.2.4 --- BenchmarkRunner.java 27 Sep 2009 22:10:35 -0000 1.1.2.5 *************** *** 35,39 **** new BenchmarkSet( "Map Iteration", new JavaHashMapIteration(), new TroveHashMapIteration(), new TroveHashMapForEach() ) - // new TroveHashMapGet() }; --- 35,38 ---- |
Update of /cvsroot/trove4j/trove/test/gnu/trove/benchmark In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17846/trove/test/gnu/trove/benchmark Modified Files: Tag: TROVE_3_WORKING JavaHashMapIteration.java TroveHashMapPut.java Benchmark.java JavaHashMapPut.java TroveHashMapGet.java TroveHashMapIteration.java BenchmarkSet.java TroveHashMapForEach.java BenchmarkRunner.java JavaHashMapGet.java Log Message: Benchmark additions Index: JavaHashMapIteration.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/JavaHashMapIteration.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** JavaHashMapIteration.java 18 Sep 2009 03:55:32 -0000 1.1.2.1 --- JavaHashMapIteration.java 27 Sep 2009 22:07:16 -0000 1.1.2.2 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 30,33 **** --- 28,35 ---- private Map<Integer,Integer> map = new HashMap<Integer,Integer>(); + public boolean isAvailable() { + return true; + } + public void setUp() { if ( !map.isEmpty() ) return; Index: TroveHashMapPut.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/TroveHashMapPut.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** TroveHashMapPut.java 18 Sep 2009 03:55:32 -0000 1.1.2.1 --- TroveHashMapPut.java 27 Sep 2009 22:07:16 -0000 1.1.2.2 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 30,33 **** --- 28,35 ---- private TIntObjectMap<Integer> map; + public boolean isAvailable() { + return true; + } + public void setUp() { if ( map != null ) return; Index: Benchmark.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/Benchmark.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Benchmark.java 15 Sep 2009 04:01:30 -0000 1.1.2.1 --- Benchmark.java 27 Sep 2009 22:07:16 -0000 1.1.2.2 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 23,27 **** * */ ! interface Benchmark extends Runnable { public void setUp(); public void tearDown(); --- 21,27 ---- * */ ! public interface Benchmark extends Runnable { ! public boolean isAvailable(); ! public void setUp(); public void tearDown(); Index: JavaHashMapPut.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/JavaHashMapPut.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** JavaHashMapPut.java 18 Sep 2009 03:55:32 -0000 1.1.2.1 --- JavaHashMapPut.java 27 Sep 2009 22:07:16 -0000 1.1.2.2 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 30,33 **** --- 28,35 ---- private Map<Integer,Integer> map = new HashMap<Integer,Integer>(); + public boolean isAvailable() { + return true; + } + public void setUp() {} Index: TroveHashMapGet.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/TroveHashMapGet.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** TroveHashMapGet.java 18 Sep 2009 03:55:32 -0000 1.1.2.1 --- TroveHashMapGet.java 27 Sep 2009 22:07:16 -0000 1.1.2.2 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 30,33 **** --- 28,35 ---- private TIntObjectMap<Integer> map = new TIntObjectHashMap<Integer>(); + public boolean isAvailable() { + return true; + } + public void setUp() { if ( !map.isEmpty() ) return; Index: TroveHashMapIteration.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/TroveHashMapIteration.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** TroveHashMapIteration.java 18 Sep 2009 03:55:32 -0000 1.1.2.1 --- TroveHashMapIteration.java 27 Sep 2009 22:07:16 -0000 1.1.2.2 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 32,35 **** --- 30,37 ---- private TIntObjectMap<Integer> map = new TIntObjectHashMap<Integer>(); + public boolean isAvailable() { + return true; + } + public void setUp() { if ( !map.isEmpty() ) return; Index: BenchmarkSet.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/BenchmarkSet.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** BenchmarkSet.java 18 Sep 2009 03:55:32 -0000 1.1.2.3 --- BenchmarkSet.java 27 Sep 2009 22:07:16 -0000 1.1.2.4 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 33,48 **** } public void setUp() { ! //noinspection ForLoopReplaceableByForEach ! for( int i = 0; i < cases.length; i++ ) { ! cases[ i ].setUp(); } } public void tearDown() { ! //noinspection ForLoopReplaceableByForEach ! for( int i = 0; i < cases.length; i++ ) { ! cases[ i ].tearDown(); } } --- 31,51 ---- } + public boolean isAvailable() { + // Available if any test is available + for( Benchmark mark : cases ) { + if ( mark.isAvailable() ) return true; + } + return false; + } public void setUp() { ! for ( Benchmark benchmark : cases ) { ! if ( benchmark.isAvailable() ) benchmark.setUp(); } } public void tearDown() { ! for ( Benchmark benchmark : cases ) { ! if ( benchmark.isAvailable() ) benchmark.tearDown(); } } Index: TroveHashMapForEach.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/TroveHashMapForEach.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** TroveHashMapForEach.java 18 Sep 2009 03:55:32 -0000 1.1.2.1 --- TroveHashMapForEach.java 27 Sep 2009 22:07:16 -0000 1.1.2.2 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 33,36 **** --- 31,38 ---- private Totaler totaler = new Totaler(); + public boolean isAvailable() { + return true; + } + public void setUp() { if ( !map.isEmpty() ) return; Index: BenchmarkRunner.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/BenchmarkRunner.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** BenchmarkRunner.java 18 Sep 2009 03:55:32 -0000 1.1.2.3 --- BenchmarkRunner.java 27 Sep 2009 22:07:16 -0000 1.1.2.4 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 29,43 **** * */ ! class BenchmarkRunner { private static final Benchmark[] CASES = { new BenchmarkSet( "Map Puts", new JavaHashMapPut(), new TroveHashMapPut() ), new BenchmarkSet( "Map Gets", new JavaHashMapGet(), new TroveHashMapGet() ), new BenchmarkSet( "Map Iteration", new JavaHashMapIteration(), new TroveHashMapIteration(), new TroveHashMapForEach() ) }; private static final Runtime RUNTIME = Runtime.getRuntime(); ! static final Integer INTEGERS[] = new Integer[ 10000 ]; private static int warmup_times = 10; --- 27,44 ---- * */ ! public class BenchmarkRunner { private static final Benchmark[] CASES = { new BenchmarkSet( "Map Puts", new JavaHashMapPut(), new TroveHashMapPut() ), + // new ColtHashMapPut() ), new BenchmarkSet( "Map Gets", new JavaHashMapGet(), new TroveHashMapGet() ), + // new ColtHashMapGet() ), new BenchmarkSet( "Map Iteration", new JavaHashMapIteration(), new TroveHashMapIteration(), new TroveHashMapForEach() ) + // new TroveHashMapGet() }; private static final Runtime RUNTIME = Runtime.getRuntime(); ! public static final Integer INTEGERS[] = new Integer[ 10000 ]; private static int warmup_times = 10; *************** *** 63,70 **** --- 64,83 ---- for( Benchmark benchmark : CASES ) { + if ( !benchmark.isAvailable() ) continue; + String indent_level = ""; runBenchmark( benchmark, indent_level, collectors ); } + + // Object shutdown_lock = new Object(); + // synchronized ( shutdown_lock ) { + // try { + // shutdown_lock.wait(); + // } + // catch ( InterruptedException e ) { + // // ignore + // } + // } } *************** *** 87,90 **** --- 100,105 ---- Benchmark[] child_cases = ( ( BenchmarkSet ) mark ).getCases(); for( Benchmark child : child_cases ) { + if ( !child.isAvailable() ) continue; + runBenchmark( child, child_indent, collectors ); } Index: JavaHashMapGet.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/benchmark/Attic/JavaHashMapGet.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** JavaHashMapGet.java 18 Sep 2009 03:55:32 -0000 1.1.2.1 --- JavaHashMapGet.java 27 Sep 2009 22:07:16 -0000 1.1.2.2 *************** *** 1,21 **** ! /* ! * /////////////////////////////////////////////////////////////////////////////// ! * // Copyright (c) 2009, Rob Eden 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.benchmark; --- 1,19 ---- ! // //////////////////////////////////////////////////////////////////////////// ! // Copyright (c) 2009, Rob Eden 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.benchmark; *************** *** 31,34 **** --- 29,36 ---- private Map<Integer,Integer> map = new HashMap<Integer,Integer>(); + public boolean isAvailable() { + return true; + } + public void setUp() { if ( !map.isEmpty() ) return; |
From: Rob E. <ro...@us...> - 2009-09-27 21:25:58
|
Update of /cvsroot/trove4j/trove/test/gnu/trove/benchmark/colt In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12539/trove/test/gnu/trove/benchmark/colt Log Message: Directory /cvsroot/trove4j/trove/test/gnu/trove/benchmark/colt added to the repository |
From: Jeff R. <uph...@us...> - 2009-09-27 06:24:19
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28043/templates/gnu/trove/impl/hash Modified Files: Tag: TROVE_3_WORKING _E_Hash.template _K__V_Hash.template Log Message: Builder pattern initial implementation and associated changes. Index: _E_Hash.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/impl/hash/Attic/_E_Hash.template,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** _E_Hash.template 15 Sep 2009 18:40:57 -0000 1.1.2.3 --- _E_Hash.template 27 Sep 2009 06:23:59 -0000 1.1.2.4 *************** *** 56,108 **** /** - * Creates a new <code>T#E#Hash</code> instance with the default - * capacity and load factor. - */ - public T#E#Hash() { - super(); - no_entry_value = Constants.DEFAULT_#EC#_NO_ENTRY_VALUE; - //noinspection RedundantCast - if ( no_entry_value != ( #e# ) 0 ) { - Arrays.fill( _set, no_entry_value ); - } - } - - - /** - * Creates a new <code>T#E#Hash</code> instance whose capacity - * is the next highest prime above <tt>initialCapacity + 1</tt> - * unless that value is already prime. - * - * @param initialCapacity an <code>int</code> value - */ - public T#E#Hash( int initialCapacity ) { - super( initialCapacity ); - no_entry_value = Constants.DEFAULT_#EC#_NO_ENTRY_VALUE; - //noinspection RedundantCast - if ( no_entry_value != ( #e# ) 0 ) { - Arrays.fill( _set, no_entry_value ); - } - } - - - /** - * Creates a new <code>T#E#Hash</code> instance with a prime - * value at or near the specified capacity and load factor. - * - * @param initialCapacity used to find a prime capacity for the table. - * @param loadFactor used to calculate the threshold over which - * rehashing takes place. - */ - public T#E#Hash( int initialCapacity, float loadFactor ) { - super(initialCapacity, loadFactor); - no_entry_value = Constants.DEFAULT_#EC#_NO_ENTRY_VALUE; - //noinspection RedundantCast - if ( no_entry_value != ( #e# ) 0 ) { - Arrays.fill( _set, no_entry_value ); - } - } - - - /** * Creates a new <code>T#E#Hash</code> instance with a prime * value at or near the specified capacity and load factor. --- 56,59 ---- Index: _K__V_Hash.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/impl/hash/Attic/_K__V_Hash.template,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** _K__V_Hash.template 15 Sep 2009 18:40:57 -0000 1.1.2.3 --- _K__V_Hash.template 27 Sep 2009 06:23:59 -0000 1.1.2.4 *************** *** 71,99 **** /** - * Creates a new <code>T#E#Hash</code> instance with the default - * capacity and load factor. - */ - public T#K##V#Hash() { - super(); - no_entry_key = ( #k# ) 0; - no_entry_value = ( #v# ) 0; - } - - - /** - * Creates a new <code>T#E#Hash</code> instance whose capacity - * is the next highest prime above <tt>initialCapacity + 1</tt> - * unless that value is already prime. - * - * @param initialCapacity an <code>int</code> value - */ - public T#K##V#Hash( int initialCapacity ) { - super( initialCapacity ); - no_entry_key = ( #k# ) 0; - no_entry_value = ( #v# ) 0; - } - - - /** * Creates a new <code>T#K##V#Hash</code> instance with a prime * value at or near the specified capacity and load factor. --- 71,74 ---- *************** *** 102,121 **** * @param loadFactor used to calculate the threshold over which * rehashing takes place. ! */ ! public T#K##V#Hash( int initialCapacity, float loadFactor ) { ! super(initialCapacity, loadFactor); ! no_entry_key = ( #k# ) 0; ! no_entry_value = ( #v# ) 0; ! } ! ! ! /** ! * Creates a new <code>T#K##V#Hash</code> instance with a prime ! * value at or near the specified capacity and load factor. ! * ! * @param initialCapacity used to find a prime capacity for the table. ! * @param loadFactor used to calculate the threshold over which ! * rehashing takes place. ! * @param no_entry_value value that represents null */ public T#K##V#Hash( int initialCapacity, float loadFactor, --- 77,82 ---- * @param loadFactor used to calculate the threshold over which * rehashing takes place. ! * @param no_entry_key value that represents null for keys ! * @param no_entry_value value that represents null for values */ public T#K##V#Hash( int initialCapacity, float loadFactor, |