From: Jeff R. <uph...@us...> - 2009-09-15 18:41:16
|
Update of /cvsroot/trove4j/trove/templates/gnu/trove/set/hash In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9798/templates/gnu/trove/set/hash Modified Files: Tag: TROVE_3_WORKING _E_HashSet.template Log Message: Harmonize equals()/hashcode() for the collections and views. Call super for externalization for classes that extend other classes. Copy consutrctors copy more internals (load factor, no_entry value/key, etc) and add System properties to set default no_entry_value/key to be used. Index: _E_HashSet.template =================================================================== RCS file: /cvsroot/trove4j/trove/templates/gnu/trove/set/hash/Attic/_E_HashSet.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_HashSet.template 15 Sep 2009 02:38:30 -0000 1.1.2.5 --- _E_HashSet.template 15 Sep 2009 18:40:57 -0000 1.1.2.6 *************** *** 96,103 **** * @param no_entry_value a <code>#e#</code> value that represents null. */ - @SuppressWarnings({"RedundantCast"}) public T#E#HashSet( int initial_capacity, float load_factor, #e# no_entry_value ) { super( initial_capacity, load_factor, no_entry_value ); if ( no_entry_value != ( #e# ) 0 ) { Arrays.fill( _set, no_entry_value ); --- 96,103 ---- * @param no_entry_value a <code>#e#</code> value that represents null. */ public T#E#HashSet( int initial_capacity, float load_factor, #e# no_entry_value ) { super( initial_capacity, load_factor, no_entry_value ); + //noinspection RedundantCast if ( no_entry_value != ( #e# ) 0 ) { Arrays.fill( _set, no_entry_value ); *************** *** 122,142 **** * of the existing set. * ! * @param set a <tt>T#E#Set</tt> that will be duplicated. */ ! public T#E#HashSet( T#E#Collection set ) { ! this( Math.max( set.size(), DEFAULT_CAPACITY ) ); ! if ( set instanceof T#E#HashSet ) { ! T#E#HashSet hashset = ( T#E#HashSet ) set; this._loadFactor = hashset._loadFactor; this.no_entry_value = hashset.no_entry_value; setUp( (int) Math.ceil( DEFAULT_CAPACITY / _loadFactor ) ); } ! addAll( set ); } ! /** ! * @return a T#E#Iterator with access to the values in this set ! */ public T#E#Iterator iterator() { return new T#E#HashIterator( this ); --- 122,144 ---- * of the existing set. * ! * @param collection a <tt>T#E#Set</tt> that will be duplicated. */ ! public T#E#HashSet( T#E#Collection collection ) { ! this( Math.max( collection.size(), DEFAULT_CAPACITY ) ); ! if ( collection instanceof T#E#HashSet ) { ! T#E#HashSet hashset = ( T#E#HashSet ) collection; this._loadFactor = hashset._loadFactor; this.no_entry_value = hashset.no_entry_value; + //noinspection RedundantCast + if ( this.no_entry_value != ( #e# ) 0 ) { + Arrays.fill( _set, this.no_entry_value ); + } setUp( (int) Math.ceil( DEFAULT_CAPACITY / _loadFactor ) ); } ! addAll( collection ); } ! /** {@inheritDoc} */ public T#E#Iterator iterator() { return new T#E#HashIterator( this ); *************** *** 144,152 **** ! /** ! * Returns a new array containing the values in the set. ! * ! * @return an <code>#e#[]</code> value ! */ public #e#[] toArray() { #e#[] result = new #e#[ size() ]; --- 146,150 ---- ! /** {@inheritDoc} */ public #e#[] toArray() { #e#[] result = new #e#[ size() ]; *************** *** 414,421 **** /** {@inheritDoc} */ public boolean equals( Object other ) { ! if (! (other instanceof T#E#HashSet)) { return false; } ! final T#E#HashSet that = ( T#E#HashSet ) other; if ( that.size() != this.size() ) { return false; --- 412,419 ---- /** {@inheritDoc} */ public boolean equals( Object other ) { ! if ( ! ( other instanceof T#E#Set ) ) { return false; } ! T#E#Set that = ( T#E#Set ) other; if ( that.size() != this.size() ) { return false; *************** *** 508,512 **** /** {@inheritDoc} */ - @SuppressWarnings({"RedundantCast"}) public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException { --- 506,509 ---- *************** *** 527,530 **** --- 524,528 ---- // NO ENTRY VALUE no_entry_value = in.read#E#(); + //noinspection RedundantCast if ( no_entry_value != ( #e# ) 0 ) { Arrays.fill( _set, no_entry_value ); |