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-11-07 03:13:11
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl/unmodifiable In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20622/trove/templates/gnu/trove/impl/unmodifiable Added Files: Tag: TROVE_3_WORKING UnmodifiableRandomAccess_E_List.template Unmodifiable_E_ObjectMap.template Unmodifiable_E_Collection.template Unmodifiable_E_Set.template Unmodifiable_K__V_Map.template UnmodifiableObject_E_Map.template Unmodifiable_E_List.template Log Message: Move synchronized and unmodifiable classes into separate files. --- NEW FILE: UnmodifiableRandomAccess_E_List.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.unmodifiable; ////////////////////////////////////////////////// // 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.Iterator; 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; public 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 ); } } --- NEW FILE: Unmodifiable_E_ObjectMap.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.unmodifiable; ////////////////////////////////////////////////// // 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.*; import java.io.Serializable; import java.io.ObjectOutputStream; import java.io.IOException; public class TUnmodifiable#E#ObjectMap<V> implements T#E#ObjectMap<V>, Serializable { 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 #ET#, ? 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(); } } --- NEW FILE: Unmodifiable_E_Collection.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.unmodifiable; ////////////////////////////////////////////////// // 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.Iterator; 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; public class TUnmodifiable#E#Collection implements T#E#Collection, Serializable { 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(); } } --- NEW FILE: Unmodifiable_E_Set.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.unmodifiable; ////////////////////////////////////////////////// // 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.Iterator; 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; public 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(); } } --- NEW FILE: Unmodifiable_K__V_Map.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.unmodifiable; ////////////////////////////////////////////////// // 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.Iterator; 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; public class TUnmodifiable#K##V#Map implements T#K##V#Map, Serializable { 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(); } } --- NEW FILE: UnmodifiableObject_E_Map.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.unmodifiable; ////////////////////////////////////////////////// // 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.*; import java.io.Serializable; import java.io.ObjectOutputStream; import java.io.IOException; public class TUnmodifiableObject#E#Map<K> implements TObject#E#Map<K>, Serializable { 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(); } } --- NEW FILE: Unmodifiable_E_List.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.unmodifiable; ////////////////////////////////////////////////// // 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.Iterator; 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; public 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 #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 ) { 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 #e# 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(); } } |
From: Rob E. <ro...@us...> - 2009-11-07 03:13:08
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20622/trove/templates/gnu/trove/impl Removed Files: Tag: TROVE_3_WORKING TUnmodifiableCollections.template TSynchronizedCollections.template Log Message: Move synchronized and unmodifiable classes into separate files. --- TUnmodifiableCollections.template DELETED --- --- TSynchronizedCollections.template DELETED --- |
From: Rob E. <ro...@us...> - 2009-11-07 03:13:06
|
Update of /cvsroot/trove4j/trove/src/gnu/trove/impl/sync In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20622/trove/src/gnu/trove/impl/sync Added Files: Tag: TROVE_3_WORKING SynchronizedSet.java SynchronizedCollection.java Log Message: Move synchronized and unmodifiable classes into separate files. --- NEW FILE: SynchronizedSet.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.sync; import java.util.Set; /** Local implementation of SynchronizedSet so we can set the mutex explicitly. */ 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(); } } } --- NEW FILE: SynchronizedCollection.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.sync; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Collection; import java.util.Iterator; /** * */ class SynchronizedCollection<E> implements Collection<E>, Serializable { 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(); } } } |
From: Rob E. <ro...@us...> - 2009-11-07 03:13:06
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl/sync In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20622/trove/templates/gnu/trove/impl/sync Added Files: Tag: TROVE_3_WORKING SynchronizedObject_E_Map.template Synchronized_E_Collection.template SynchronizedRandomAccess_E_List.template Synchronized_E_List.template Synchronized_K__V_Map.template Synchronized_E_Set.template Synchronized_E_ObjectMap.template Log Message: Move synchronized and unmodifiable classes into separate files. --- NEW FILE: SynchronizedObject_E_Map.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.sync; ////////////////////////////////////////////////// // 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.Iterator; 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; public class TSynchronizedObject#E#Map<K> implements TObject#E#Map<K>, Serializable { 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 ) { keySet = new SynchronizedSet<K>( m.keySet(), mutex ); } 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(); } } } --- NEW FILE: Synchronized_E_Collection.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.sync; ////////////////////////////////////////////////// // 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.Iterator; 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; public class TSynchronized#E#Collection implements T#E#Collection, Serializable { 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(); } } } --- NEW FILE: SynchronizedRandomAccess_E_List.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.sync; ////////////////////////////////////////////////// // 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.Iterator; 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; public 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 ); } } --- NEW FILE: Synchronized_E_List.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.sync; ////////////////////////////////////////////////// // 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.Iterator; 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; public class TSynchronized#E#List extends TSynchronized#E#Collection implements T#E#List { 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 #e# set( int index, #e# element) { synchronized( mutex ) { return 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 #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 ) { 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 ); } } --- NEW FILE: Synchronized_K__V_Map.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.sync; ////////////////////////////////////////////////// // 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.Iterator; 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; public class TSynchronized#K##V#Map implements T#K##V#Map, Serializable { 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(); } } } --- NEW FILE: Synchronized_E_Set.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.sync; ////////////////////////////////////////////////// // 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.Iterator; 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; public 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(); } } } --- NEW FILE: Synchronized_E_ObjectMap.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.sync; ////////////////////////////////////////////////// // 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.Iterator; 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; public 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 ) { values = new SynchronizedCollection<V>( m.valueCollection(), mutex ); } 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(); } } } |
From: Rob E. <ro...@us...> - 2009-11-07 03:13:04
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20622/trove/templates/gnu/trove Modified Files: Tag: TROVE_3_WORKING TCollections.template Log Message: Move synchronized and unmodifiable classes into separate files. Index: TCollections.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/Attic/TCollections.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 *** TCollections.template 9 Oct 2009 01:45:00 -0000 1.1.2.4 --- TCollections.template 7 Nov 2009 03:12:53 -0000 1.1.2.5 *************** *** 29,34 **** import gnu.trove.list.*; import gnu.trove.map.*; ! import gnu.trove.impl.TUnmodifiableCollections; ! import gnu.trove.impl.TSynchronizedCollections; import java.util.RandomAccess; --- 29,34 ---- import gnu.trove.list.*; import gnu.trove.map.*; ! import gnu.trove.impl.unmodifiable.*; ! import gnu.trove.impl.sync.*; import java.util.RandomAccess; *************** *** 66,76 **** - #REPLICATED7# - - /////////////////////////// // TSynchronizedCollections #REPLICATED8# --- 66,76 ---- /////////////////////////// // TSynchronizedCollections + #REPLICATED7# + + #REPLICATED8# *************** *** 86,98 **** #REPLICATED12# - - - #REPLICATED13# - - - #REPLICATED14# - - - #REPLICATED15# } ====START_REPLICATED_CONTENT #1==== --- 86,89 ---- *************** *** 119,123 **** */ public static T#E#Collection unmodifiableCollection( T#E#Collection c ) { ! return new TUnmodifiableCollections.TUnmodifiable#E#Collection( c ); } --- 110,114 ---- */ public static T#E#Collection unmodifiableCollection( T#E#Collection c ) { ! return new TUnmodifiable#E#Collection( c ); } *************** *** 138,167 **** */ public static T#E#Set unmodifiableSet( 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 unmodifiableSortedSet( 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 --- 129,136 ---- */ public static T#E#Set unmodifiableSet( T#E#Set s ) { ! return new TUnmodifiable#E#Set( s ); } =====END_REPLICATED_CONTENT #2===== ====START_REPLICATED_CONTENT #3==== /** * Returns an unmodifiable view of the specified Trove primitive list. This method allows *************** *** 181,189 **** public static T#E#List unmodifiableList( 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 --- 150,158 ---- public static T#E#List unmodifiableList( T#E#List list) { return ( list instanceof RandomAccess ? ! new TUnmodifiableRandomAccess#E#List( list ) : ! new TUnmodifiable#E#List( list ) ); } ! =====END_REPLICATED_CONTENT #3===== ! ====START_REPLICATED_CONTENT #4==== /** * Returns an unmodifiable view of the specified Trove primitive/primitive map. This method *************** *** 201,208 **** */ 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 --- 170,177 ---- */ public static T#K##V#Map unmodifiableMap( T#K##V#Map m ) { ! return new TUnmodifiable#K##V#Map( m ); } ! =====END_REPLICATED_CONTENT #4===== ! ====START_REPLICATED_CONTENT #5==== /** * Returns an unmodifiable view of the specified Trove primitive/Object map. This method *************** *** 220,227 **** */ 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 --- 189,196 ---- */ public static <V> T#E#ObjectMap<V> unmodifiableMap( T#E#ObjectMap<V> m ) { ! return new TUnmodifiable#E#ObjectMap<V>( m ); } ! =====END_REPLICATED_CONTENT #5===== ! ====START_REPLICATED_CONTENT #6==== /** * Returns an unmodifiable view of the specified Trove Object/primitive map. This method *************** *** 239,246 **** */ 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 --- 208,215 ---- */ public static <K> TObject#E#Map<K> unmodifiableMap( TObject#E#Map<K> m ) { ! return new TUnmodifiableObject#E#Map<K>( m ); } ! =====END_REPLICATED_CONTENT #6===== ! ====START_REPLICATED_CONTENT #7==== /** * Returns a synchronized (thread-safe) Trove collection backed by the specified *************** *** 275,286 **** */ 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 --- 244,255 ---- */ public static T#E#Collection synchronizedCollection( T#E#Collection c ) { ! return new TSynchronized#E#Collection(c); } static T#E#Collection synchronizedCollection( T#E#Collection c, Object mutex ) { ! return new TSynchronized#E#Collection( c, mutex ); } ! =====END_REPLICATED_CONTENT #7===== ! ====START_REPLICATED_CONTENT #8==== /** * Returns a synchronized (thread-safe) Trove set backed by the specified *************** *** 309,363 **** */ 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 --- 278,289 ---- */ public static T#E#Set synchronizedSet( T#E#Set s ) { ! return new TSynchronized#E#Set( s ); } static T#E#Set synchronizedSet( T#E#Set s, Object mutex ) { ! return new TSynchronized#E#Set( s, mutex ); } ! =====END_REPLICATED_CONTENT #8===== ! ====START_REPLICATED_CONTENT #9==== /** * Returns a synchronized (thread-safe) Trove list backed by the specified *************** *** 387,401 **** 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 --- 313,327 ---- public static T#E#List synchronizedList( T#E#List list ) { return ( list instanceof RandomAccess ? ! new TSynchronizedRandomAccess#E#List( list ) : ! new TSynchronized#E#List( list ) ); } static T#E#List synchronizedList( T#E#List list, Object mutex ) { return ( list instanceof RandomAccess ? ! new TSynchronizedRandomAccess#E#List( list, mutex ) : ! new TSynchronized#E#List( list, mutex ) ); } ! =====END_REPLICATED_CONTENT #9===== ! ====START_REPLICATED_CONTENT #10==== /** * Returns a synchronized (thread-safe) Trove map backed by the specified *************** *** 426,433 **** */ 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 --- 352,359 ---- */ public static T#K##V#Map synchronizedMap( T#K##V#Map m ) { ! return new TSynchronized#K##V#Map( m ); } ! =====END_REPLICATED_CONTENT #10===== ! ====START_REPLICATED_CONTENT #11==== /** * Returns a synchronized (thread-safe) Trove map backed by the specified *************** *** 458,465 **** */ 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 --- 384,391 ---- */ public static <V> T#E#ObjectMap<V> synchronizedMap( T#E#ObjectMap<V> m ) { ! return new TSynchronized#E#ObjectMap<V>( m ); } ! =====END_REPLICATED_CONTENT #11===== ! ====START_REPLICATED_CONTENT #12==== /** * Returns a synchronized (thread-safe) Trove map backed by the specified *************** *** 490,640 **** */ 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 --- 416,420 ---- */ public static <K> TObject#E#Map<K> synchronizedMap( TObject#E#Map<K> m ) { ! return new TSynchronizedObject#E#Map<K>( m ); } ! =====END_REPLICATED_CONTENT #12===== \ No newline at end of file |
From: Rob E. <ro...@us...> - 2009-11-07 02:39:47
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl/unmodifiable In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16249/trove/templates/gnu/trove/impl/unmodifiable Log Message: Directory /cvsroot/trove4j/trove/templates/gnu/trove/impl/unmodifiable added to the repository |
From: Rob E. <ro...@us...> - 2009-11-07 02:14:01
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl/sync In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13854/trove/templates/gnu/trove/impl/sync Log Message: Directory /cvsroot/trove4j/trove/templates/gnu/trove/impl/sync added to the repository |
From: Rob E. <ro...@us...> - 2009-11-07 02:09:31
|
Update of /cvsroot/trove4j/trove/src/gnu/trove/impl/sync In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13355/trove/src/gnu/trove/impl/sync Log Message: Directory /cvsroot/trove4j/trove/src/gnu/trove/impl/sync added to the repository |
From: Rob E. <ro...@us...> - 2009-11-06 21:41:39
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl/synchronized In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17082/trove/templates/gnu/trove/impl/synchronized Log Message: Directory /cvsroot/trove4j/trove/templates/gnu/trove/impl/synchronized added to the repository |
From: Rob E. <ro...@us...> - 2009-11-03 04:41:55
|
Update of /cvsroot/trove4j/trove/test/gnu/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17448/trove/test/gnu/trove Modified Files: Tag: TROVE_3_WORKING TDecoratorTest.java Log Message: Add test for subList() of wrapper list. Index: TDecoratorTest.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/Attic/TDecoratorTest.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 *** TDecoratorTest.java 3 Nov 2009 04:09:26 -0000 1.1.2.1 --- TDecoratorTest.java 3 Nov 2009 04:41:42 -0000 1.1.2.2 *************** *** 99,101 **** --- 99,124 ---- assertEquals( 10, list.get( 1 ) ); } + + public void testIntListDecoratorSubList() { + TIntList list = new TIntArrayList(); + list.add( 2 ); + list.add( 3 ); + list.add( 4 ); + list.add( 5 ); + list.add( 6 ); + + List<Integer> wrapped_list = TDecorators.wrap( list ); + + List<Integer> sublist = wrapped_list.subList( 1, 4 ); + assertEquals( 3, sublist.size() ); + assertEquals( Integer.valueOf( 3 ), sublist.get( 0 ) ); + assertEquals( Integer.valueOf( 4 ), sublist.get( 1 ) ); + assertEquals( Integer.valueOf( 5 ), sublist.get( 2 ) ); + + sublist.clear(); + + assertEquals( 2, list.size() ); + assertEquals( 2, list.get( 0 ) ); + assertEquals( 6, list.get( 1 ) ); + } } |
From: Rob E. <ro...@us...> - 2009-11-03 04:35:48
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/queue In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16862/trove/templates/gnu/trove/queue Added Files: Tag: TROVE_3_WORKING _E_Queue.template Log Message: Queue interfaces --- NEW FILE: _E_Queue.template --- /////////////////////////////////////////////////////////////////////////////// // 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.queue; import gnu.trove.T#E#Collection; import java.io.Serializable; /** * Interface for Trove queue implementations. * * @see java.util.Queue */ public interface T#E#Queue extends T#E#Collection, Serializable { /** * Retrieves and removes the head of this queue. This method differs from * {@link #poll} only in that it throws an exception if this queue is empty. */ public #e# element(); /** * Inserts the specified element into this queue if it is possible to do so * immediately without violating capacity restrictions. When using a * capacity-restricted queue, this method is generally preferable to * {@link #add}, which can fail to insert an element only by throwing an exception. * * @param e The element to add. * * @return <tt>true</tt> if the element was added to this queue, else <tt>false</tt> */ public boolean offer( #e# e ); /** * Retrieves, but does not remove, the head of this queue, or returns * {@link #getNoEntryValue} if this queue is empty. * * @return the head of this queue, or {@link #getNoEntryValue} if this queue is empty */ public #e# peek(); /** * Retrieves and removes the head of this queue, or returns {@link #getNoEntryValue} * if this queue is empty. * * @return the head of this queue, or {@link #getNoEntryValue} if this queue is empty */ public #e# poll(); } |
From: Rob E. <ro...@us...> - 2009-11-03 04:21:25
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/queue In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15515/trove/templates/gnu/trove/queue Log Message: Directory /cvsroot/trove4j/trove/templates/gnu/trove/queue added to the repository |
From: Rob E. <ro...@us...> - 2009-11-03 04:09:36
|
Update of /cvsroot/trove4j/trove/test/gnu/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14126/trove/test/gnu/trove Added Files: Tag: TROVE_3_WORKING TDecoratorTest.java Log Message: Implement "wrap" methods in TDecorators for lists. --- NEW FILE: TDecoratorTest.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; import gnu.trove.list.TIntList; import gnu.trove.list.array.TIntArrayList; import junit.framework.TestCase; import java.util.Iterator; import java.util.List; /** * */ public class TDecoratorTest extends TestCase { public void testIntListDecorator() { TIntList list = new TIntArrayList(); list.add( 2 ); list.add( 3 ); list.add( 4 ); list.add( 5 ); list.add( 6 ); List<Integer> wrapped_list = TDecorators.wrap( list ); assertEquals( 5, wrapped_list.size() ); assertEquals( Integer.valueOf( 2 ), wrapped_list.get( 0 ) ); assertEquals( Integer.valueOf( 3 ), wrapped_list.get( 1 ) ); assertEquals( Integer.valueOf( 4 ), wrapped_list.get( 2 ) ); assertEquals( Integer.valueOf( 5 ), wrapped_list.get( 3 ) ); assertEquals( Integer.valueOf( 6 ), wrapped_list.get( 4 ) ); list.removeAt( 1 ); assertEquals( 4, list.size() ); assertEquals( Integer.valueOf( 2 ), wrapped_list.get( 0 ) ); assertEquals( Integer.valueOf( 4 ), wrapped_list.get( 1 ) ); assertEquals( Integer.valueOf( 5 ), wrapped_list.get( 2 ) ); assertEquals( Integer.valueOf( 6 ), wrapped_list.get( 3 ) ); wrapped_list.remove( 1 ); assertEquals( 3, list.size() ); assertEquals( 2, list.get( 0 ) ); assertEquals( 5, list.get( 1 ) ); assertEquals( 6, list.get( 2 ) ); list.clear(); assertTrue( wrapped_list.isEmpty() ); wrapped_list.add( Integer.valueOf( 7 ) ); assertEquals( 1, list.size() ); assertEquals( 7, list.get( 0 ) ); wrapped_list.clear(); assertTrue( list.isEmpty() ); list.add( 8 ); list.add( 9 ); list.add( 10 ); Iterator<Integer> wrapper_list_it = wrapped_list.iterator(); assertTrue( wrapper_list_it.hasNext() ); assertEquals( Integer.valueOf( 8 ), wrapper_list_it.next() ); assertTrue( wrapper_list_it.hasNext() ); assertEquals( Integer.valueOf( 9 ), wrapper_list_it.next() ); assertTrue( wrapper_list_it.hasNext() ); assertEquals( Integer.valueOf( 10 ), wrapper_list_it.next() ); assertFalse( wrapper_list_it.hasNext() ); wrapper_list_it = wrapped_list.iterator(); assertTrue( wrapper_list_it.hasNext() ); assertEquals( Integer.valueOf( 8 ), wrapper_list_it.next() ); wrapper_list_it.remove(); assertTrue( wrapper_list_it.hasNext() ); assertEquals( Integer.valueOf( 9 ), wrapper_list_it.next() ); assertTrue( wrapper_list_it.hasNext() ); assertEquals( Integer.valueOf( 10 ), wrapper_list_it.next() ); assertFalse( wrapper_list_it.hasNext() ); assertEquals( 2, list.size() ); assertEquals( 9, list.get( 0 ) ); assertEquals( 10, list.get( 1 ) ); } } |
From: Rob E. <ro...@us...> - 2009-11-03 04:09:36
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14126/trove/templates/gnu/trove Modified Files: Tag: TROVE_3_WORKING TDecorators.template Log Message: Implement "wrap" methods in TDecorators for lists. Index: TDecorators.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/Attic/TDecorators.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 *** TDecorators.template 18 Sep 2009 06:07:23 -0000 1.1.2.2 --- TDecorators.template 3 Nov 2009 04:09:26 -0000 1.1.2.3 *************** *** 24,27 **** --- 24,28 ---- import java.util.*; + import gnu.trove.list.*; import gnu.trove.map.*; import gnu.trove.set.*; *************** *** 53,56 **** --- 54,60 ---- #REPLICATED4# + + + #REPLICATED5# } ====START_REPLICATED_CONTENT #1==== *************** *** 101,103 **** return new T#E#SetDecorator( set ); } ! =====END_REPLICATED_CONTENT #4===== \ No newline at end of file --- 105,119 ---- return new T#E#SetDecorator( set ); } ! =====END_REPLICATED_CONTENT #4===== ! ====START_REPLICATED_CONTENT #5==== ! /** ! * Wrap the given list in a decorator that uses the standard {@link java.util.List List} ! * interface. ! * ! * @param list the <tt>T#E#List</tt> to be wrapped ! * @return the wrapped list. ! */ ! public static List<#ET#> wrap( T#E#List list ) { ! return new T#E#ListDecorator( list ); ! } ! =====END_REPLICATED_CONTENT #5===== \ No newline at end of file |
From: Rob E. <ro...@us...> - 2009-10-30 04:16:19
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/list In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15903/trove/templates/gnu/trove/list Modified Files: Tag: TROVE_3_WORKING _E_List.template Log Message: Add list decorator classes. Not in TDecorators yet. Index: _E_List.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/list/Attic/_E_List.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_List.template 6 Oct 2009 05:04:54 -0000 1.1.2.5 --- _E_List.template 30 Oct 2009 04:16:05 -0000 1.1.2.6 *************** *** 144,149 **** * @param offset an <code>int</code> value * @param val an <code>#e#</code> value */ ! public void set( int offset, #e# val ); --- 144,151 ---- * @param offset an <code>int</code> value * @param val an <code>#e#</code> value + * + * @return The value previously at the given index. */ ! public #e# set( int offset, #e# val ); |
From: Rob E. <ro...@us...> - 2009-10-30 04:16:17
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/decorator In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15903/trove/templates/gnu/trove/decorator Added Files: Tag: TROVE_3_WORKING _E_ListDecorator.template Log Message: Add list decorator classes. Not in TDecorators yet. --- NEW FILE: _E_ListDecorator.template --- /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2009, Robert D. 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.decorator; import gnu.trove.list.T#E#List; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.AbstractList; import java.util.List; ////////////////////////////////////////////////// // THIS IS A GENERATED CLASS. DO NOT HAND EDIT! // ////////////////////////////////////////////////// /** * Wrapper class to make a T#E#List conform to the <tt>java.util.List</tt> API. * This class simply decorates an underlying T#E#List and translates the Object-based * APIs into their Trove primitive analogs. * <p/> * Note that wrapping and unwrapping primitive values is extremely inefficient. If * possible, users of this class should override the appropriate methods in this class * and use a table of canonical values. * <p/> * * @author Robert D. Eden */ public class T#E#ListDecorator extends AbstractList<#ET#> implements List<#ET#>, Externalizable, Cloneable { /** the wrapped primitive list */ protected T#E#List list; /** * FOR EXTERNALIZATION ONLY!! */ public T#E#ListDecorator() {} /** * Creates a wrapper that decorates the specified primitive map. * * @param list the <tt>T#E#List</tt> to wrap. */ public T#E#ListDecorator( T#E#List list ) { super(); this.list = list; } /** * Returns a reference to the list wrapped by this decorator. * * @return the wrapped <tt>T#E#List</tt> instance. */ public T#E#List getList() { return list; } @Override public int size() { return list.size(); } @Override public #ET# get( int index ) { #e# value = list.get( index ); if ( value == list.getNoEntryValue() ) return null; else return #ET#.valueOf( value ); } @Override public #ET# set( int index, #ET# value ) { #e# previous_value = list.set( index, value ); if ( previous_value == list.getNoEntryValue() ) return null; else return #ET#.valueOf( previous_value ); } @Override public void add( int index, #ET# value ) { list.insert( index, value.#e#Value() ); } @Override public #ET# remove( int index ) { #e# previous_value = list.removeAt( index ); if ( previous_value == list.getNoEntryValue() ) return null; else return #ET#.valueOf( previous_value ); } // Implements Externalizable public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException { // VERSION in.readByte(); // LIST list = ( T#E#List ) in.readObject(); } // Implements Externalizable public void writeExternal( ObjectOutput out ) throws IOException { // VERSION out.writeByte(0); // LIST out.writeObject( list ); } } |
From: Rob E. <ro...@us...> - 2009-10-30 04:16:16
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/list/array In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15903/trove/templates/gnu/trove/list/array Modified Files: Tag: TROVE_3_WORKING _E_ArrayList.template Log Message: Add list decorator classes. Not in TDecorators yet. Index: _E_ArrayList.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/list/array/Attic/_E_ArrayList.template,v retrieving revision 1.1.2.19 retrieving revision 1.1.2.20 diff -C2 -d -r1.1.2.19 -r1.1.2.20 *** _E_ArrayList.template 9 Oct 2009 03:53:11 -0000 1.1.2.19 --- _E_ArrayList.template 30 Oct 2009 04:16:05 -0000 1.1.2.20 *************** *** 245,253 **** /** {@inheritDoc} */ ! public void set( int offset, #e# val ) { if ( offset >= _pos ) { throw new ArrayIndexOutOfBoundsException( offset ); } _data[ offset ] = val; } --- 245,256 ---- /** {@inheritDoc} */ ! public #e# set( int offset, #e# val ) { if ( offset >= _pos ) { throw new ArrayIndexOutOfBoundsException( offset ); } + + #e# prev_val = _data[ offset ]; _data[ offset ] = val; + return prev_val; } |
From: Rob E. <ro...@us...> - 2009-10-30 04:16:15
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/impl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15903/trove/templates/gnu/trove/impl Modified Files: Tag: TROVE_3_WORKING TUnmodifiableCollections.template TSynchronizedCollections.template Log Message: Add list decorator classes. Not in TDecorators yet. Index: TUnmodifiableCollections.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/impl/Attic/TUnmodifiableCollections.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 *** TUnmodifiableCollections.template 6 Oct 2009 05:04:54 -0000 1.1.2.2 --- TUnmodifiableCollections.template 30 Oct 2009 04:16:05 -0000 1.1.2.3 *************** *** 283,287 **** 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(); } --- 283,287 ---- public void insert( int offset, #e#[] values, int valOffset, int len ) { throw new UnsupportedOperationException(); } ! public #e# 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(); } Index: TSynchronizedCollections.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/impl/Attic/TSynchronizedCollections.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 *** TSynchronizedCollections.template 6 Oct 2009 05:04:54 -0000 1.1.2.3 --- TSynchronizedCollections.template 30 Oct 2009 04:16:05 -0000 1.1.2.4 *************** *** 371,376 **** 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 ) { --- 371,376 ---- synchronized( mutex ) { return list.get( index ); } } ! public #e# set( int index, #e# element) { ! synchronized( mutex ) { return list.set( index, element ); } } public void set( int offset, #e#[] values ) { |
From: Rob E. <ro...@us...> - 2009-10-17 21:45:04
|
Update of /cvsroot/trove4j/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26685/trove Modified Files: Tag: TROVE_3_WORKING build.xml Log Message: Back out previous change. Index: build.xml =================================================================== RCS file: /cvsroot/trove4j/trove/build.xml,v retrieving revision 1.61.2.10 retrieving revision 1.61.2.11 diff -C2 -d -r1.61.2.10 -r1.61.2.11 *** build.xml 17 Oct 2009 21:26:48 -0000 1.61.2.10 --- build.xml 17 Oct 2009 21:44:51 -0000 1.61.2.11 *************** *** 88,94 **** <classpath> <pathelement path="${output.generator_classes}"/> - - <!-- Allows TeamCity code coverage instrumentation. Ignored if not present. --> - <pathelement path="../../plugins/coveragePlugin/lib/emma.jar"/> </classpath> </java> --- 88,91 ---- *************** *** 230,240 **** <enable/> </assertions> ! <classpath> ! <pathelement path="${output.tests}"/> ! <pathelement path="${lib}/junit.jar"/> ! ! <!-- Allows TeamCity code coverage instrumentation. Ignored if not present. --> ! <pathelement path="../../plugins/coveragePlugin/lib/emma.jar"/> ! </classpath> <formatter type="brief" usefile="false"/> <batchtest fork="no" todir="${output.dir}"> --- 227,231 ---- <enable/> </assertions> ! <classpath path="${output.tests}:${output.dest}:${lib}/junit.jar"/> <formatter type="brief" usefile="false"/> <batchtest fork="no" todir="${output.dir}"> *************** *** 261,267 **** <pathelement path="${output.generator_classes}"/> <pathelement path="${output.tests}"/> - - <!-- Allows TeamCity code coverage instrumentation. Ignored if not present. --> - <pathelement path="../../plugins/coveragePlugin/lib/emma.jar"/> </classpath> </java> --- 252,255 ---- |
From: Rob E. <ro...@us...> - 2009-10-17 21:26:59
|
Update of /cvsroot/trove4j/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22299/trove Modified Files: Tag: TROVE_3_WORKING build.xml Log Message: Work on support code coverage in TeamCity Index: build.xml =================================================================== RCS file: /cvsroot/trove4j/trove/build.xml,v retrieving revision 1.61.2.9 retrieving revision 1.61.2.10 diff -C2 -d -r1.61.2.9 -r1.61.2.10 *** build.xml 17 Oct 2009 19:42:03 -0000 1.61.2.9 --- build.xml 17 Oct 2009 21:26:48 -0000 1.61.2.10 *************** *** 88,91 **** --- 88,94 ---- <classpath> <pathelement path="${output.generator_classes}"/> + + <!-- Allows TeamCity code coverage instrumentation. Ignored if not present. --> + <pathelement path="../../plugins/coveragePlugin/lib/emma.jar"/> </classpath> </java> *************** *** 227,231 **** <enable/> </assertions> ! <classpath path="${output.tests}:${output.dest}:${lib}/junit.jar"/> <formatter type="brief" usefile="false"/> <batchtest fork="no" todir="${output.dir}"> --- 230,240 ---- <enable/> </assertions> ! <classpath> ! <pathelement path="${output.tests}"/> ! <pathelement path="${lib}/junit.jar"/> ! ! <!-- Allows TeamCity code coverage instrumentation. Ignored if not present. --> ! <pathelement path="../../plugins/coveragePlugin/lib/emma.jar"/> ! </classpath> <formatter type="brief" usefile="false"/> <batchtest fork="no" todir="${output.dir}"> *************** *** 252,255 **** --- 261,267 ---- <pathelement path="${output.generator_classes}"/> <pathelement path="${output.tests}"/> + + <!-- Allows TeamCity code coverage instrumentation. Ignored if not present. --> + <pathelement path="../../plugins/coveragePlugin/lib/emma.jar"/> </classpath> </java> |
From: Rob E. <ro...@us...> - 2009-10-17 19:54:09
|
Update of /cvsroot/trove4j/trove/test/gnu/trove/map/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1229/trove/test/gnu/trove/map/hash Modified Files: Tag: TROVE_3_WORKING TPrimitiveObjectHashMapTest.java TPrimitivePrimitiveHashMapTest.java Log Message: Remove usage of Arrays.copyOf (added in 1.6) Index: TPrimitiveObjectHashMapTest.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/map/hash/Attic/TPrimitiveObjectHashMapTest.java,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** TPrimitiveObjectHashMapTest.java 9 Oct 2009 02:46:07 -0000 1.1.2.5 --- TPrimitiveObjectHashMapTest.java 17 Oct 2009 19:54:00 -0000 1.1.2.6 *************** *** 479,483 **** keyset.containsAll( keys ) ); ! int[] other_array = Arrays.copyOf( keys, keys.length + 1 ); other_array[other_array.length - 1] = 1138; assertFalse( "should not contain all. keyset: " + keyset + ", " + Arrays.toString( other_array ), --- 479,484 ---- keyset.containsAll( keys ) ); ! int[] other_array = new int[ keys.length + 1 ]; ! System.arraycopy( keys, 0, other_array, 0, keys.length ); other_array[other_array.length - 1] = 1138; assertFalse( "should not contain all. keyset: " + keyset + ", " + Arrays.toString( other_array ), Index: TPrimitivePrimitiveHashMapTest.java =================================================================== RCS file: /cvsroot/trove4j/trove/test/gnu/trove/map/hash/Attic/TPrimitivePrimitiveHashMapTest.java,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -C2 -d -r1.1.2.8 -r1.1.2.9 *** TPrimitivePrimitiveHashMapTest.java 9 Oct 2009 02:46:07 -0000 1.1.2.8 --- TPrimitivePrimitiveHashMapTest.java 17 Oct 2009 19:54:00 -0000 1.1.2.9 *************** *** 266,270 **** TIntSet set = map.keySet(); ! int[] sorted_keys = Arrays.copyOf( keys, keys.length ); Arrays.sort( sorted_keys ); int[] setarray = set.toArray(); --- 266,271 ---- TIntSet set = map.keySet(); ! int[] sorted_keys = new int[ keys.length ]; ! System.arraycopy( keys, 0, sorted_keys, 0, keys.length ); Arrays.sort( sorted_keys ); int[] setarray = set.toArray(); *************** *** 854,858 **** TLongCollection values = map.valueCollection(); ! long[] sorted_keys = Arrays.copyOf( vals, vals.length ); Arrays.sort( sorted_keys ); long[] setarray = values.toArray(); --- 855,860 ---- TLongCollection values = map.valueCollection(); ! long[] sorted_keys = new long[ vals.length ]; ! System.arraycopy( vals, 0, sorted_keys, 0, vals.length ); Arrays.sort( sorted_keys ); long[] setarray = values.toArray(); |
From: Rob E. <ro...@us...> - 2009-10-17 19:46:05
|
Update of /cvsroot/trove4j/trove/src/gnu/trove/impl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32684/trove/src/gnu/trove/impl Modified Files: Tag: TROVE_3_WORKING Constants.java Log Message: Inline field values that were introduced in 1.6 Index: Constants.java =================================================================== RCS file: /cvsroot/trove4j/trove/src/gnu/trove/impl/Attic/Constants.java,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** Constants.java 15 Sep 2009 18:40:57 -0000 1.1.2.5 --- Constants.java 17 Oct 2009 19:45:52 -0000 1.1.2.6 *************** *** 130,134 **** if ( "MAX_VALUE".equalsIgnoreCase( property ) ) value = Float.MAX_VALUE; else if ( "MIN_VALUE".equalsIgnoreCase( property ) ) value = Float.MIN_VALUE; ! else if ( "MIN_NORMAL".equalsIgnoreCase( property ) ) value = Float.MIN_NORMAL; else if ( "NEGATIVE_INFINITY".equalsIgnoreCase( property ) ) value = Float.NEGATIVE_INFINITY; else if ( "POSITIVE_INFINITY".equalsIgnoreCase( property ) ) value = Float.POSITIVE_INFINITY; --- 130,135 ---- if ( "MAX_VALUE".equalsIgnoreCase( property ) ) value = Float.MAX_VALUE; else if ( "MIN_VALUE".equalsIgnoreCase( property ) ) value = Float.MIN_VALUE; ! // Value from Float.MIN_NORMAL (introduced in 1.6) ! else if ( "MIN_NORMAL".equalsIgnoreCase( property ) ) value = 0x1.0p-126f; else if ( "NEGATIVE_INFINITY".equalsIgnoreCase( property ) ) value = Float.NEGATIVE_INFINITY; else if ( "POSITIVE_INFINITY".equalsIgnoreCase( property ) ) value = Float.POSITIVE_INFINITY; *************** *** 150,154 **** if ( "MAX_VALUE".equalsIgnoreCase( property ) ) value = Double.MAX_VALUE; else if ( "MIN_VALUE".equalsIgnoreCase( property ) ) value = Double.MIN_VALUE; ! else if ( "MIN_NORMAL".equalsIgnoreCase( property ) ) value = Double.MIN_NORMAL; else if ( "NEGATIVE_INFINITY".equalsIgnoreCase( property ) ) value = Double.NEGATIVE_INFINITY; else if ( "POSITIVE_INFINITY".equalsIgnoreCase( property ) ) value = Double.POSITIVE_INFINITY; --- 151,156 ---- if ( "MAX_VALUE".equalsIgnoreCase( property ) ) value = Double.MAX_VALUE; else if ( "MIN_VALUE".equalsIgnoreCase( property ) ) value = Double.MIN_VALUE; ! // Value from Double.MIN_NORMAL (introduced in 1.6) ! else if ( "MIN_NORMAL".equalsIgnoreCase( property ) ) value = 0x1.0p-1022; else if ( "NEGATIVE_INFINITY".equalsIgnoreCase( property ) ) value = Double.NEGATIVE_INFINITY; else if ( "POSITIVE_INFINITY".equalsIgnoreCase( property ) ) value = Double.POSITIVE_INFINITY; |
From: Rob E. <ro...@us...> - 2009-10-17 19:42:19
|
Update of /cvsroot/trove4j/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32166/trove Modified Files: Tag: TROVE_3_WORKING build.xml Log Message: Add echo message to display Java verison being used to compile. Index: build.xml =================================================================== RCS file: /cvsroot/trove4j/trove/build.xml,v retrieving revision 1.61.2.8 retrieving revision 1.61.2.9 diff -C2 -d -r1.61.2.8 -r1.61.2.9 *** build.xml 12 Oct 2009 03:56:01 -0000 1.61.2.8 --- build.xml 17 Oct 2009 19:42:03 -0000 1.61.2.9 *************** *** 273,276 **** --- 273,278 ---- <!-- =================================================================== --> <target name="-init"> + <echo message="Java version: ${java.version}"/> + <tstamp/> |
From: Rob E. <ro...@us...> - 2009-10-12 03:56:12
|
Update of /cvsroot/trove4j/trove In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27273/trove Modified Files: Tag: TROVE_3_WORKING build.xml Log Message: Add Trove2 benchmarks. More method cleanup. Index: build.xml =================================================================== RCS file: /cvsroot/trove4j/trove/build.xml,v retrieving revision 1.61.2.7 retrieving revision 1.61.2.8 diff -C2 -d -r1.61.2.7 -r1.61.2.8 *** build.xml 12 Oct 2009 03:35:21 -0000 1.61.2.7 --- build.xml 12 Oct 2009 03:56:01 -0000 1.61.2.8 *************** *** 297,300 **** --- 297,301 ---- <src path="${test_src}"/> <exclude name="gnu/trove/benchmark/colt/**"/> + <exclude name="gnu/trove/benchmark/trove2/**"/> <classpath> *************** *** 315,318 **** --- 316,330 ---- </available> <antcall target="-build_colt_benchmarks"/> + + <available classname="gnu.trove.TIntObjectHashMap" + property="trove2.available"> + + <classpath> + <fileset dir="${lib}"> + <include name="*.jar"/> + </fileset> + </classpath> + </available> + <antcall target="-build_trove2_benchmarks"/> </target> *************** *** 334,336 **** --- 346,364 ---- </javac> </target> + + <target name="-build_trove2_benchmarks" depends="-init" if="colt.available"> + <javac destdir="${output.tests}" debug="${debug}" target="1.5"> + <src path="${test_src}"/> + + <include name="gnu/trove/benchmark/trove2/**"/> + + <classpath> + <fileset dir="${lib}"> + <include name="*.jar"/> + </fileset> + <pathelement location="${output.dest}"/> + <pathelement location="${output.tests}"/> + </classpath> + </javac> + </target> </project> \ No newline at end of file |
Update of /cvsroot/trove4j/trove/test/gnu/trove/benchmark/trove2 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27273/trove/test/gnu/trove/benchmark/trove2 Added Files: Tag: TROVE_3_WORKING Trove2HashMapPut.java Trove2HashMapGet.java Trove2HashMapIteration.java Trove2HashMapForEach.java Log Message: Add Trove2 benchmarks. More method cleanup. --- NEW FILE: Trove2HashMapPut.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.benchmark.trove2; import gnu.trove.TIntObjectHashMap; import gnu.trove.benchmark.Benchmark; import gnu.trove.benchmark.BenchmarkRunner; /** * */ public class Trove2HashMapPut implements Benchmark { private TIntObjectHashMap<Integer> map; public void setUp() { if ( map != null ) return; map = new TIntObjectHashMap<Integer>(); map.ensureCapacity( BenchmarkRunner.INTEGERS.length ); } public void tearDown() { map.clear(); } public String getName() { return "Trove2 HashMap Put"; } public void run() { for( Integer i : BenchmarkRunner.INTEGERS ) { map.put( i.intValue(), i ); } } } --- NEW FILE: Trove2HashMapGet.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.benchmark.trove2; import gnu.trove.benchmark.Benchmark; import gnu.trove.benchmark.BenchmarkRunner; import gnu.trove.TIntObjectHashMap; /** * */ public class Trove2HashMapGet implements Benchmark { private TIntObjectHashMap<Integer> map = new TIntObjectHashMap<Integer>(); public void setUp() { if ( !map.isEmpty() ) return; for( Integer i : BenchmarkRunner.INTEGERS ) { map.put( i.intValue(), i ); } } public void tearDown() {} public String getName() { return "Trove2 HashMap Get"; } public void run() { for( int j = 0; j < 5; j++ ) { for( Integer i : BenchmarkRunner.INTEGERS ) { map.get( i.intValue() ); } } } } --- NEW FILE: Trove2HashMapIteration.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.benchmark.trove2; import gnu.trove.TIntObjectHashMap; import gnu.trove.TIntObjectIterator; import gnu.trove.benchmark.Benchmark; import gnu.trove.benchmark.BenchmarkRunner; /** * */ public class Trove2HashMapIteration implements Benchmark { private TIntObjectHashMap<Integer> map = new TIntObjectHashMap<Integer>(); public boolean isAvailable() { return true; } public void setUp() { if ( !map.isEmpty() ) return; for( int j = 0; j < 2; j++ ) { for( Integer i : BenchmarkRunner.INTEGERS ) { map.put( i.intValue(), i ); } } } public void tearDown() {} public String getName() { return "Trove2 HashMap Iteration"; } public void run() { int total = 0; for( int i = 0; i < 5; i++ ) { TIntObjectIterator<Integer> iterator = map.iterator(); while( iterator.hasNext() ) { iterator.advance(); total += iterator.key(); } } } } --- NEW FILE: Trove2HashMapForEach.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.benchmark.trove2; import gnu.trove.TIntObjectHashMap; import gnu.trove.TIntObjectProcedure; import gnu.trove.benchmark.Benchmark; import gnu.trove.benchmark.BenchmarkRunner; /** * */ public class Trove2HashMapForEach implements Benchmark { private TIntObjectHashMap<Integer> map = new TIntObjectHashMap<Integer>(); private Totaler totaler = new Totaler(); public boolean isAvailable() { return true; } public void setUp() { if ( !map.isEmpty() ) return; for( int j = 0; j < 2; j++ ) { for( Integer i : BenchmarkRunner.INTEGERS ) { map.put( i.intValue(), i ); } } } public void tearDown() {} public String getName() { return "Trove2 HashMap ForEach"; } public void run() { totaler.reset(); for( int i = 0; i < 5; i++ ) { map.forEachEntry( totaler ); } } class Totaler implements TIntObjectProcedure<Integer> { int total = 0; void reset() { total = 0; } public boolean execute( int a, Integer b ) { total += a; return true; } } } |