[trove3] 04/33: initial release
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Wed Apr 18 17:18:59 BST 2018
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository trove3.
commit 105de07198651cb4d1fd9a47548f855227fcefe5
Author: Arnaud Vandyck <avdyk at debian.org>
Date: Thu Jun 7 16:36:44 2007 +0000
initial release
---
debian/README.Debian | 16 +
debian/control | 8 +-
debian/libtrove-java-doc.doc-base | 10 +
debian/libtrove-java.install | 1 -
debian/libtrove-java.links | 1 -
debian/patches/10_output_gen_src.patch | 64974 +++++++++++++++++++++++++++++++
debian/rules | 26 +-
7 files changed, 65026 insertions(+), 10 deletions(-)
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..7ade544
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,16 @@
+trove
+-----
+
+This package is in contrib because I've not been able to generate some
+source code. I've been obliged to generate sources from a Windows
+installation, then put the generated sources as patches.
+
+Don't forget to update the generated sources when upgrading the package
+
+The package will be able to move to main when some java sources will be
+generated by the build process. I already contacted the author but there
+is no sollution at the moment:
+
+http://sourceforge.net/tracker/index.php?func=detail&aid=1699401&group_id=39235&atid=424685
+
+ -- Arnaud Vandyck <avdyk at debian.org>, Thu, 7 Jun 2007 17:04:23 +0200
diff --git a/debian/control b/debian/control
index a237a51..a325bb1 100644
--- a/debian/control
+++ b/debian/control
@@ -1,15 +1,15 @@
Source: trove
-Section: libs
+Section: contrib/libs
Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
Uploaders: Arnaud Vandyck <avdyk at debian.org>
-Build-Depends-Indep: debhelper (>= 4.2.30), java-gcj-compat-dev (>= 1.0.69-2), ant, cdbs, ibm-j2sdk1.5
+Build-Depends-Indep: debhelper (>= 4.2.30), java-gcj-compat-dev (>= 1.0.69-2), ant, cdbs
Standards-Version: 3.7.2
Package: libtrove-java
-Section: libs
+Section: contrib/libs
Architecture: all
-Depends: ibm-j2sdk1.5 | java2-runtime
+Depends: java-gcj-compat | java2-runtime
Description: high performance collections for java
GNU Trove is a fast, lightweight implementations of the java.util
Collections API. These implementations are designed to be pluggable
diff --git a/debian/libtrove-java-doc.doc-base b/debian/libtrove-java-doc.doc-base
new file mode 100644
index 0000000..a8d7e01
--- /dev/null
+++ b/debian/libtrove-java-doc.doc-base
@@ -0,0 +1,10 @@
+Document: libtrove-java-doc
+Title: Programmer API for trove (high performance collections for java)
+Authors: Eric Friedman, Gann Bierner, Rob Eden
+Abstract: This is the programmer API of trove, a library for high
+ performance collections for java
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/libtrove-java-doc/api/index.html
+Files: /usr/share/doc/libtrove-java-doc/api/*.html
diff --git a/debian/libtrove-java.install b/debian/libtrove-java.install
deleted file mode 100644
index 1bf1cee..0000000
--- a/debian/libtrove-java.install
+++ /dev/null
@@ -1 +0,0 @@
-build/trove-2.0a2.jar /usr/share/java/
diff --git a/debian/libtrove-java.links b/debian/libtrove-java.links
deleted file mode 100644
index e93c935..0000000
--- a/debian/libtrove-java.links
+++ /dev/null
@@ -1 +0,0 @@
-/usr/share/java/trove-2.0a2.jar /usr/share/java/trove.jar
diff --git a/debian/patches/10_output_gen_src.patch b/debian/patches/10_output_gen_src.patch
new file mode 100644
index 0000000..829a41e
--- /dev/null
+++ b/debian/patches/10_output_gen_src.patch
@@ -0,0 +1,64974 @@
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TByteByteHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TByteByteHashMap;
++import gnu.trove.TByteByteIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TByteByteHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TByteByteHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TByteByteHashMapDecorator extends AbstractMap<Byte, Byte>
++ implements Map<Byte, Byte>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TByteByteHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TByteByteHashMapDecorator(TByteByteHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TByteByteHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TByteByteHashMapDecorator clone() {
++ try {
++ TByteByteHashMapDecorator copy = (TByteByteHashMapDecorator) super.clone();
++ copy._map = (TByteByteHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Byte(0) if none was found.
++ */
++ public Byte put(Byte key, Byte value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Byte && val instanceof Byte) {
++ byte k = unwrapKey(key);
++ byte v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Byte get(Byte key) {
++ byte k = unwrapKey(key);
++ byte v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Byte(0) if it was not found in the map
++ */
++ public Byte remove(Byte key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Byte,Byte>> entrySet() {
++ return new AbstractSet<Map.Entry<Byte,Byte>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TByteByteHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TByteByteHashMapDecorator.this.containsKey(k)
++ && TByteByteHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Byte,Byte>> iterator() {
++ return new Iterator<Map.Entry<Byte,Byte>>() {
++ private final TByteByteIterator it = _map.iterator();
++
++ public Map.Entry<Byte,Byte> next() {
++ it.advance();
++ final Byte key = wrapKey(it.key());
++ final Byte v = wrapValue(it.value());
++ return new Map.Entry<Byte,Byte>() {
++ private Byte val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Byte getKey() {
++ return key;
++ }
++
++ public Byte getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Byte setValue(Byte value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Byte o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Byte, Byte>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TByteByteHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Byte, ? extends Byte> map) {
++ Iterator<? extends Entry<? extends Byte,? extends Byte>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Byte,? extends Byte> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Byte wrapKey(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected byte unwrapKey(Object key) {
++ return ((Byte)key).byteValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Byte wrapValue(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected byte unwrapValue(Object value) {
++ return ((Byte)value).byteValue();
++ }
++
++} // TByteByteHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TByteDoubleHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TByteDoubleHashMap;
++import gnu.trove.TByteDoubleIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TByteDoubleHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TByteDoubleHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TByteDoubleHashMapDecorator extends AbstractMap<Byte, Double>
++ implements Map<Byte, Double>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TByteDoubleHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TByteDoubleHashMapDecorator(TByteDoubleHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TByteDoubleHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TByteDoubleHashMapDecorator clone() {
++ try {
++ TByteDoubleHashMapDecorator copy = (TByteDoubleHashMapDecorator) super.clone();
++ copy._map = (TByteDoubleHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Double(0) if none was found.
++ */
++ public Double put(Byte key, Double value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Byte && val instanceof Double) {
++ byte k = unwrapKey(key);
++ double v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Double get(Byte key) {
++ byte k = unwrapKey(key);
++ double v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Double(0) if it was not found in the map
++ */
++ public Double remove(Byte key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Byte,Double>> entrySet() {
++ return new AbstractSet<Map.Entry<Byte,Double>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TByteDoubleHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TByteDoubleHashMapDecorator.this.containsKey(k)
++ && TByteDoubleHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Byte,Double>> iterator() {
++ return new Iterator<Map.Entry<Byte,Double>>() {
++ private final TByteDoubleIterator it = _map.iterator();
++
++ public Map.Entry<Byte,Double> next() {
++ it.advance();
++ final Byte key = wrapKey(it.key());
++ final Double v = wrapValue(it.value());
++ return new Map.Entry<Byte,Double>() {
++ private Double val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Byte getKey() {
++ return key;
++ }
++
++ public Double getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Double setValue(Double value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Double o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Byte, Double>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TByteDoubleHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Byte, ? extends Double> map) {
++ Iterator<? extends Entry<? extends Byte,? extends Double>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Byte,? extends Double> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Byte wrapKey(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected byte unwrapKey(Object key) {
++ return ((Byte)key).byteValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Double wrapValue(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected double unwrapValue(Object value) {
++ return ((Double)value).doubleValue();
++ }
++
++} // TByteDoubleHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TByteFloatHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TByteFloatHashMap;
++import gnu.trove.TByteFloatIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TByteFloatHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TByteFloatHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TByteFloatHashMapDecorator extends AbstractMap<Byte, Float>
++ implements Map<Byte, Float>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TByteFloatHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TByteFloatHashMapDecorator(TByteFloatHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TByteFloatHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TByteFloatHashMapDecorator clone() {
++ try {
++ TByteFloatHashMapDecorator copy = (TByteFloatHashMapDecorator) super.clone();
++ copy._map = (TByteFloatHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Float(0) if none was found.
++ */
++ public Float put(Byte key, Float value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Byte && val instanceof Float) {
++ byte k = unwrapKey(key);
++ float v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Float get(Byte key) {
++ byte k = unwrapKey(key);
++ float v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Float(0) if it was not found in the map
++ */
++ public Float remove(Byte key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Byte,Float>> entrySet() {
++ return new AbstractSet<Map.Entry<Byte,Float>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TByteFloatHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TByteFloatHashMapDecorator.this.containsKey(k)
++ && TByteFloatHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Byte,Float>> iterator() {
++ return new Iterator<Map.Entry<Byte,Float>>() {
++ private final TByteFloatIterator it = _map.iterator();
++
++ public Map.Entry<Byte,Float> next() {
++ it.advance();
++ final Byte key = wrapKey(it.key());
++ final Float v = wrapValue(it.value());
++ return new Map.Entry<Byte,Float>() {
++ private Float val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Byte getKey() {
++ return key;
++ }
++
++ public Float getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Float setValue(Float value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Float o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Byte, Float>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TByteFloatHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Byte, ? extends Float> map) {
++ Iterator<? extends Entry<? extends Byte,? extends Float>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Byte,? extends Float> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Byte wrapKey(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected byte unwrapKey(Object key) {
++ return ((Byte)key).byteValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Float wrapValue(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected float unwrapValue(Object value) {
++ return ((Float)value).floatValue();
++ }
++
++} // TByteFloatHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TByteHashSetDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,209 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TByteHashSet;
++import gnu.trove.TByteIterator;
++
++import java.util.AbstractSet;
++import java.util.Iterator;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TByteHashSet conform to the <tt>java.util.Set</tt> API.
++ * This class simply decorates an underlying TByteHashSet and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Tue Sep 24 22:08:17 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TByteHashSetDecorator extends AbstractSet<Byte> implements Set<Byte> {
++ /** the wrapped primitive set */
++ protected TByteHashSet _set;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive set.
++ */
++ public TByteHashSetDecorator(TByteHashSet set) {
++ super();
++ this._set = set;
++ }
++
++
++ /**
++ * Returns a reference to the set wrapped by this decorator.
++ */
++ public TByteHashSet getSet() {
++ return _set;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TByteHashSetDecorator clone() {
++ try {
++ TByteHashSetDecorator copy = (TByteHashSetDecorator) super.clone();
++ copy._set = (TByteHashSet) _set.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable
++ }
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param value true if the set was modified by the insertion
++ */
++ public boolean add(Byte value) {
++ return _set.add(unwrap(value));
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the sets are identical
++ */
++ public boolean equals(Object other) {
++ if (_set.equals(other)) {
++ return true; // comparing two trove sets
++ } else if (other instanceof Set) {
++ Set that = (Set) other;
++ if (that.size() != _set.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Object val = it.next();
++ if (val instanceof Byte) {
++ byte v = unwrap(val);
++ if (_set.contains(v)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other set
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ this._set.clear();
++ }
++
++ /**
++ * Deletes a value from the set.
++ *
++ * @param value an <code>Object</code> value
++ * @return true if the set was modified
++ */
++ public boolean remove(Object value) {
++ return _set.remove(unwrap(value));
++ }
++
++ /**
++ * Creates an iterator over the values of the set.
++ *
++ * @return an iterator with support for removals in the underlying set
++ */
++ public Iterator<Byte> iterator() {
++ return new Iterator<Byte>() {
++ private final TByteIterator it = _set.iterator();
++
++ public Byte next() {
++ return wrap(it.next());
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ /**
++ * Returns the number of entries in the set.
++ *
++ * @return the set's size.
++ */
++ public int size() {
++ return this._set.size();
++ }
++
++ /**
++ * Indicates whether set has any entries.
++ *
++ * @return true if the set is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying set
++ * @return an Object representation of the value
++ */
++ protected Byte wrap(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected byte unwrap(Object value) {
++ return ((Byte) value).byteValue();
++ }
++} // TByteHashSetDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TByteIntHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TByteIntHashMap;
++import gnu.trove.TByteIntIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TByteIntHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TByteIntHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TByteIntHashMapDecorator extends AbstractMap<Byte, Integer>
++ implements Map<Byte, Integer>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TByteIntHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TByteIntHashMapDecorator(TByteIntHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TByteIntHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TByteIntHashMapDecorator clone() {
++ try {
++ TByteIntHashMapDecorator copy = (TByteIntHashMapDecorator) super.clone();
++ copy._map = (TByteIntHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Integer put(Byte key, Integer value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Byte && val instanceof Integer) {
++ byte k = unwrapKey(key);
++ int v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Integer get(Byte key) {
++ byte k = unwrapKey(key);
++ int v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Integer remove(Byte key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Byte,Integer>> entrySet() {
++ return new AbstractSet<Map.Entry<Byte,Integer>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TByteIntHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TByteIntHashMapDecorator.this.containsKey(k)
++ && TByteIntHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Byte,Integer>> iterator() {
++ return new Iterator<Map.Entry<Byte,Integer>>() {
++ private final TByteIntIterator it = _map.iterator();
++
++ public Map.Entry<Byte,Integer> next() {
++ it.advance();
++ final Byte key = wrapKey(it.key());
++ final Integer v = wrapValue(it.value());
++ return new Map.Entry<Byte,Integer>() {
++ private Integer val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Byte getKey() {
++ return key;
++ }
++
++ public Integer getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Integer setValue(Integer value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Integer o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Byte, Integer>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TByteIntHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Byte, ? extends Integer> map) {
++ Iterator<? extends Entry<? extends Byte,? extends Integer>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Byte,? extends Integer> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Byte wrapKey(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected byte unwrapKey(Object key) {
++ return ((Byte)key).byteValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Integer wrapValue(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected int unwrapValue(Object value) {
++ return ((Integer)value).intValue();
++ }
++
++} // TByteIntHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TByteLongHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TByteLongHashMap;
++import gnu.trove.TByteLongIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TByteLongHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TByteLongHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TByteLongHashMapDecorator extends AbstractMap<Byte, Long>
++ implements Map<Byte, Long>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TByteLongHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TByteLongHashMapDecorator(TByteLongHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TByteLongHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TByteLongHashMapDecorator clone() {
++ try {
++ TByteLongHashMapDecorator copy = (TByteLongHashMapDecorator) super.clone();
++ copy._map = (TByteLongHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Long(0) if none was found.
++ */
++ public Long put(Byte key, Long value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Byte && val instanceof Long) {
++ byte k = unwrapKey(key);
++ long v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Long get(Byte key) {
++ byte k = unwrapKey(key);
++ long v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Long(0) if it was not found in the map
++ */
++ public Long remove(Byte key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Byte,Long>> entrySet() {
++ return new AbstractSet<Map.Entry<Byte,Long>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TByteLongHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TByteLongHashMapDecorator.this.containsKey(k)
++ && TByteLongHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Byte,Long>> iterator() {
++ return new Iterator<Map.Entry<Byte,Long>>() {
++ private final TByteLongIterator it = _map.iterator();
++
++ public Map.Entry<Byte,Long> next() {
++ it.advance();
++ final Byte key = wrapKey(it.key());
++ final Long v = wrapValue(it.value());
++ return new Map.Entry<Byte,Long>() {
++ private Long val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Byte getKey() {
++ return key;
++ }
++
++ public Long getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Long setValue(Long value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Long o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Byte, Long>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TByteLongHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Byte, ? extends Long> map) {
++ Iterator<? extends Entry<? extends Byte,? extends Long>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Byte,? extends Long> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Byte wrapKey(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected byte unwrapKey(Object key) {
++ return ((Byte)key).byteValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Long wrapValue(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected long unwrapValue(Object value) {
++ return ((Long)value).longValue();
++ }
++
++} // TByteLongHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TByteObjectHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,365 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TByteObjectHashMap;
++import gnu.trove.TByteObjectIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TByteObjectHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TByteObjectHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TByteObjectHashMapDecorator<V> extends AbstractMap<Byte, V>
++ implements Map<Byte, V>, Cloneable {
++
++ /**
++ * the wrapped primitive map
++ */
++ protected TByteObjectHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TByteObjectHashMapDecorator(TByteObjectHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TByteObjectHashMap<V> getMap() {
++ return _map;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TByteObjectHashMapDecorator clone() {
++ try {
++ TByteObjectHashMapDecorator copy = (TByteObjectHashMapDecorator) super.clone();
++ copy._map = (TByteObjectHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public V put(Byte key, V value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Byte) {
++ byte k = unwrapKey(key);
++ Object v = unwrapValue((V) val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public V get(Object key) {
++ return _map.get(unwrapKey(key));
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public V remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Byte,V>> entrySet() {
++ return new AbstractSet<Map.Entry<Byte,V>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TByteObjectHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TByteObjectHashMapDecorator.this.containsKey(k) &&
++ TByteObjectHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Byte,V>> iterator() {
++ return new Iterator<Map.Entry<Byte,V>>() {
++ private final TByteObjectIterator<V> it = _map.iterator();
++
++ public Map.Entry<Byte,V> next() {
++ it.advance();
++ final Byte key = wrapKey(it.key());
++ final V v = wrapValue(it.value());
++ return new Map.Entry<Byte,V>() {
++ private V val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Byte getKey() {
++ return key;
++ }
++
++ public V getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public V setValue(V value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Map.Entry<Byte,V> o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Byte,V>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TByteObjectHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue((V) val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Byte, ? extends V> map) {
++ Iterator<? extends Entry<? extends Byte,? extends V>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Byte,? extends V> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Byte wrapKey(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected byte unwrapKey(Object key) {
++ return ((Byte)key).byteValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param o value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected final V wrapValue(V o) {
++ return o;
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected final V unwrapValue(V value) {
++ return value;
++ }
++
++} // TByteObjectHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TByteShortHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TByteShortHashMap;
++import gnu.trove.TByteShortIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TByteShortHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TByteShortHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TByteShortHashMapDecorator extends AbstractMap<Byte, Short>
++ implements Map<Byte, Short>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TByteShortHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TByteShortHashMapDecorator(TByteShortHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TByteShortHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TByteShortHashMapDecorator clone() {
++ try {
++ TByteShortHashMapDecorator copy = (TByteShortHashMapDecorator) super.clone();
++ copy._map = (TByteShortHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Short(0) if none was found.
++ */
++ public Short put(Byte key, Short value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Byte && val instanceof Short) {
++ byte k = unwrapKey(key);
++ short v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Short get(Byte key) {
++ byte k = unwrapKey(key);
++ short v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Short(0) if it was not found in the map
++ */
++ public Short remove(Byte key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Byte,Short>> entrySet() {
++ return new AbstractSet<Map.Entry<Byte,Short>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TByteShortHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TByteShortHashMapDecorator.this.containsKey(k)
++ && TByteShortHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Byte,Short>> iterator() {
++ return new Iterator<Map.Entry<Byte,Short>>() {
++ private final TByteShortIterator it = _map.iterator();
++
++ public Map.Entry<Byte,Short> next() {
++ it.advance();
++ final Byte key = wrapKey(it.key());
++ final Short v = wrapValue(it.value());
++ return new Map.Entry<Byte,Short>() {
++ private Short val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Byte getKey() {
++ return key;
++ }
++
++ public Short getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Short setValue(Short value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Short o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Byte, Short>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TByteShortHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Byte, ? extends Short> map) {
++ Iterator<? extends Entry<? extends Byte,? extends Short>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Byte,? extends Short> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Byte wrapKey(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected byte unwrapKey(Object key) {
++ return ((Byte)key).byteValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Short wrapValue(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected short unwrapValue(Object value) {
++ return ((Short)value).shortValue();
++ }
++
++} // TByteShortHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TDoubleByteHashMapDecorator.java 2007-04-18 06:49:34.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TDoubleByteHashMap;
++import gnu.trove.TDoubleByteIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TDoubleByteHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TDoubleByteHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TDoubleByteHashMapDecorator extends AbstractMap<Double, Byte>
++ implements Map<Double, Byte>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TDoubleByteHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TDoubleByteHashMapDecorator(TDoubleByteHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TDoubleByteHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TDoubleByteHashMapDecorator clone() {
++ try {
++ TDoubleByteHashMapDecorator copy = (TDoubleByteHashMapDecorator) super.clone();
++ copy._map = (TDoubleByteHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Byte(0) if none was found.
++ */
++ public Byte put(Double key, Byte value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Double && val instanceof Byte) {
++ double k = unwrapKey(key);
++ byte v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Byte get(Double key) {
++ double k = unwrapKey(key);
++ byte v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Byte(0) if it was not found in the map
++ */
++ public Byte remove(Double key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Double,Byte>> entrySet() {
++ return new AbstractSet<Map.Entry<Double,Byte>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TDoubleByteHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TDoubleByteHashMapDecorator.this.containsKey(k)
++ && TDoubleByteHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Double,Byte>> iterator() {
++ return new Iterator<Map.Entry<Double,Byte>>() {
++ private final TDoubleByteIterator it = _map.iterator();
++
++ public Map.Entry<Double,Byte> next() {
++ it.advance();
++ final Double key = wrapKey(it.key());
++ final Byte v = wrapValue(it.value());
++ return new Map.Entry<Double,Byte>() {
++ private Byte val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Double getKey() {
++ return key;
++ }
++
++ public Byte getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Byte setValue(Byte value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Byte o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Double, Byte>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TDoubleByteHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Double, ? extends Byte> map) {
++ Iterator<? extends Entry<? extends Double,? extends Byte>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Double,? extends Byte> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Double wrapKey(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected double unwrapKey(Object key) {
++ return ((Double)key).doubleValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Byte wrapValue(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected byte unwrapValue(Object value) {
++ return ((Byte)value).byteValue();
++ }
++
++} // TDoubleByteHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TDoubleDoubleHashMapDecorator.java 2007-04-18 06:49:34.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TDoubleDoubleHashMap;
++import gnu.trove.TDoubleDoubleIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TDoubleDoubleHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TDoubleDoubleHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TDoubleDoubleHashMapDecorator extends AbstractMap<Double, Double>
++ implements Map<Double, Double>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TDoubleDoubleHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TDoubleDoubleHashMapDecorator(TDoubleDoubleHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TDoubleDoubleHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TDoubleDoubleHashMapDecorator clone() {
++ try {
++ TDoubleDoubleHashMapDecorator copy = (TDoubleDoubleHashMapDecorator) super.clone();
++ copy._map = (TDoubleDoubleHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Double(0) if none was found.
++ */
++ public Double put(Double key, Double value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Double && val instanceof Double) {
++ double k = unwrapKey(key);
++ double v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Double get(Double key) {
++ double k = unwrapKey(key);
++ double v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Double(0) if it was not found in the map
++ */
++ public Double remove(Double key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Double,Double>> entrySet() {
++ return new AbstractSet<Map.Entry<Double,Double>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TDoubleDoubleHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TDoubleDoubleHashMapDecorator.this.containsKey(k)
++ && TDoubleDoubleHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Double,Double>> iterator() {
++ return new Iterator<Map.Entry<Double,Double>>() {
++ private final TDoubleDoubleIterator it = _map.iterator();
++
++ public Map.Entry<Double,Double> next() {
++ it.advance();
++ final Double key = wrapKey(it.key());
++ final Double v = wrapValue(it.value());
++ return new Map.Entry<Double,Double>() {
++ private Double val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Double getKey() {
++ return key;
++ }
++
++ public Double getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Double setValue(Double value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Double o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Double, Double>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TDoubleDoubleHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Double, ? extends Double> map) {
++ Iterator<? extends Entry<? extends Double,? extends Double>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Double,? extends Double> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Double wrapKey(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected double unwrapKey(Object key) {
++ return ((Double)key).doubleValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Double wrapValue(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected double unwrapValue(Object value) {
++ return ((Double)value).doubleValue();
++ }
++
++} // TDoubleDoubleHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TDoubleFloatHashMapDecorator.java 2007-04-18 06:49:34.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TDoubleFloatHashMap;
++import gnu.trove.TDoubleFloatIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TDoubleFloatHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TDoubleFloatHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TDoubleFloatHashMapDecorator extends AbstractMap<Double, Float>
++ implements Map<Double, Float>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TDoubleFloatHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TDoubleFloatHashMapDecorator(TDoubleFloatHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TDoubleFloatHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TDoubleFloatHashMapDecorator clone() {
++ try {
++ TDoubleFloatHashMapDecorator copy = (TDoubleFloatHashMapDecorator) super.clone();
++ copy._map = (TDoubleFloatHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Float(0) if none was found.
++ */
++ public Float put(Double key, Float value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Double && val instanceof Float) {
++ double k = unwrapKey(key);
++ float v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Float get(Double key) {
++ double k = unwrapKey(key);
++ float v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Float(0) if it was not found in the map
++ */
++ public Float remove(Double key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Double,Float>> entrySet() {
++ return new AbstractSet<Map.Entry<Double,Float>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TDoubleFloatHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TDoubleFloatHashMapDecorator.this.containsKey(k)
++ && TDoubleFloatHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Double,Float>> iterator() {
++ return new Iterator<Map.Entry<Double,Float>>() {
++ private final TDoubleFloatIterator it = _map.iterator();
++
++ public Map.Entry<Double,Float> next() {
++ it.advance();
++ final Double key = wrapKey(it.key());
++ final Float v = wrapValue(it.value());
++ return new Map.Entry<Double,Float>() {
++ private Float val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Double getKey() {
++ return key;
++ }
++
++ public Float getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Float setValue(Float value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Float o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Double, Float>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TDoubleFloatHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Double, ? extends Float> map) {
++ Iterator<? extends Entry<? extends Double,? extends Float>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Double,? extends Float> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Double wrapKey(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected double unwrapKey(Object key) {
++ return ((Double)key).doubleValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Float wrapValue(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected float unwrapValue(Object value) {
++ return ((Float)value).floatValue();
++ }
++
++} // TDoubleFloatHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TDoubleHashSetDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,209 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TDoubleHashSet;
++import gnu.trove.TDoubleIterator;
++
++import java.util.AbstractSet;
++import java.util.Iterator;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TDoubleHashSet conform to the <tt>java.util.Set</tt> API.
++ * This class simply decorates an underlying TDoubleHashSet and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Tue Sep 24 22:08:17 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TDoubleHashSetDecorator extends AbstractSet<Double> implements Set<Double> {
++ /** the wrapped primitive set */
++ protected TDoubleHashSet _set;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive set.
++ */
++ public TDoubleHashSetDecorator(TDoubleHashSet set) {
++ super();
++ this._set = set;
++ }
++
++
++ /**
++ * Returns a reference to the set wrapped by this decorator.
++ */
++ public TDoubleHashSet getSet() {
++ return _set;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TDoubleHashSetDecorator clone() {
++ try {
++ TDoubleHashSetDecorator copy = (TDoubleHashSetDecorator) super.clone();
++ copy._set = (TDoubleHashSet) _set.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable
++ }
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param value true if the set was modified by the insertion
++ */
++ public boolean add(Double value) {
++ return _set.add(unwrap(value));
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the sets are identical
++ */
++ public boolean equals(Object other) {
++ if (_set.equals(other)) {
++ return true; // comparing two trove sets
++ } else if (other instanceof Set) {
++ Set that = (Set) other;
++ if (that.size() != _set.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Object val = it.next();
++ if (val instanceof Double) {
++ double v = unwrap(val);
++ if (_set.contains(v)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other set
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ this._set.clear();
++ }
++
++ /**
++ * Deletes a value from the set.
++ *
++ * @param value an <code>Object</code> value
++ * @return true if the set was modified
++ */
++ public boolean remove(Object value) {
++ return _set.remove(unwrap(value));
++ }
++
++ /**
++ * Creates an iterator over the values of the set.
++ *
++ * @return an iterator with support for removals in the underlying set
++ */
++ public Iterator<Double> iterator() {
++ return new Iterator<Double>() {
++ private final TDoubleIterator it = _set.iterator();
++
++ public Double next() {
++ return wrap(it.next());
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ /**
++ * Returns the number of entries in the set.
++ *
++ * @return the set's size.
++ */
++ public int size() {
++ return this._set.size();
++ }
++
++ /**
++ * Indicates whether set has any entries.
++ *
++ * @return true if the set is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying set
++ * @return an Object representation of the value
++ */
++ protected Double wrap(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected double unwrap(Object value) {
++ return ((Double) value).doubleValue();
++ }
++} // TDoubleHashSetDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TDoubleIntHashMapDecorator.java 2007-04-18 06:49:34.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TDoubleIntHashMap;
++import gnu.trove.TDoubleIntIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TDoubleIntHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TDoubleIntHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TDoubleIntHashMapDecorator extends AbstractMap<Double, Integer>
++ implements Map<Double, Integer>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TDoubleIntHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TDoubleIntHashMapDecorator(TDoubleIntHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TDoubleIntHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TDoubleIntHashMapDecorator clone() {
++ try {
++ TDoubleIntHashMapDecorator copy = (TDoubleIntHashMapDecorator) super.clone();
++ copy._map = (TDoubleIntHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Integer put(Double key, Integer value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Double && val instanceof Integer) {
++ double k = unwrapKey(key);
++ int v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Integer get(Double key) {
++ double k = unwrapKey(key);
++ int v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Integer remove(Double key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Double,Integer>> entrySet() {
++ return new AbstractSet<Map.Entry<Double,Integer>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TDoubleIntHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TDoubleIntHashMapDecorator.this.containsKey(k)
++ && TDoubleIntHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Double,Integer>> iterator() {
++ return new Iterator<Map.Entry<Double,Integer>>() {
++ private final TDoubleIntIterator it = _map.iterator();
++
++ public Map.Entry<Double,Integer> next() {
++ it.advance();
++ final Double key = wrapKey(it.key());
++ final Integer v = wrapValue(it.value());
++ return new Map.Entry<Double,Integer>() {
++ private Integer val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Double getKey() {
++ return key;
++ }
++
++ public Integer getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Integer setValue(Integer value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Integer o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Double, Integer>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TDoubleIntHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Double, ? extends Integer> map) {
++ Iterator<? extends Entry<? extends Double,? extends Integer>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Double,? extends Integer> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Double wrapKey(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected double unwrapKey(Object key) {
++ return ((Double)key).doubleValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Integer wrapValue(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected int unwrapValue(Object value) {
++ return ((Integer)value).intValue();
++ }
++
++} // TDoubleIntHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TDoubleLongHashMapDecorator.java 2007-04-18 06:49:34.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TDoubleLongHashMap;
++import gnu.trove.TDoubleLongIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TDoubleLongHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TDoubleLongHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TDoubleLongHashMapDecorator extends AbstractMap<Double, Long>
++ implements Map<Double, Long>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TDoubleLongHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TDoubleLongHashMapDecorator(TDoubleLongHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TDoubleLongHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TDoubleLongHashMapDecorator clone() {
++ try {
++ TDoubleLongHashMapDecorator copy = (TDoubleLongHashMapDecorator) super.clone();
++ copy._map = (TDoubleLongHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Long(0) if none was found.
++ */
++ public Long put(Double key, Long value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Double && val instanceof Long) {
++ double k = unwrapKey(key);
++ long v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Long get(Double key) {
++ double k = unwrapKey(key);
++ long v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Long(0) if it was not found in the map
++ */
++ public Long remove(Double key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Double,Long>> entrySet() {
++ return new AbstractSet<Map.Entry<Double,Long>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TDoubleLongHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TDoubleLongHashMapDecorator.this.containsKey(k)
++ && TDoubleLongHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Double,Long>> iterator() {
++ return new Iterator<Map.Entry<Double,Long>>() {
++ private final TDoubleLongIterator it = _map.iterator();
++
++ public Map.Entry<Double,Long> next() {
++ it.advance();
++ final Double key = wrapKey(it.key());
++ final Long v = wrapValue(it.value());
++ return new Map.Entry<Double,Long>() {
++ private Long val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Double getKey() {
++ return key;
++ }
++
++ public Long getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Long setValue(Long value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Long o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Double, Long>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TDoubleLongHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Double, ? extends Long> map) {
++ Iterator<? extends Entry<? extends Double,? extends Long>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Double,? extends Long> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Double wrapKey(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected double unwrapKey(Object key) {
++ return ((Double)key).doubleValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Long wrapValue(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected long unwrapValue(Object value) {
++ return ((Long)value).longValue();
++ }
++
++} // TDoubleLongHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TDoubleObjectHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,365 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TDoubleObjectHashMap;
++import gnu.trove.TDoubleObjectIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TDoubleObjectHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TDoubleObjectHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TDoubleObjectHashMapDecorator<V> extends AbstractMap<Double, V>
++ implements Map<Double, V>, Cloneable {
++
++ /**
++ * the wrapped primitive map
++ */
++ protected TDoubleObjectHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TDoubleObjectHashMapDecorator(TDoubleObjectHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TDoubleObjectHashMap<V> getMap() {
++ return _map;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TDoubleObjectHashMapDecorator clone() {
++ try {
++ TDoubleObjectHashMapDecorator copy = (TDoubleObjectHashMapDecorator) super.clone();
++ copy._map = (TDoubleObjectHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public V put(Double key, V value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Double) {
++ double k = unwrapKey(key);
++ Object v = unwrapValue((V) val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public V get(Object key) {
++ return _map.get(unwrapKey(key));
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public V remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Double,V>> entrySet() {
++ return new AbstractSet<Map.Entry<Double,V>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TDoubleObjectHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TDoubleObjectHashMapDecorator.this.containsKey(k) &&
++ TDoubleObjectHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Double,V>> iterator() {
++ return new Iterator<Map.Entry<Double,V>>() {
++ private final TDoubleObjectIterator<V> it = _map.iterator();
++
++ public Map.Entry<Double,V> next() {
++ it.advance();
++ final Double key = wrapKey(it.key());
++ final V v = wrapValue(it.value());
++ return new Map.Entry<Double,V>() {
++ private V val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Double getKey() {
++ return key;
++ }
++
++ public V getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public V setValue(V value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Map.Entry<Double,V> o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Double,V>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TDoubleObjectHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue((V) val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Double, ? extends V> map) {
++ Iterator<? extends Entry<? extends Double,? extends V>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Double,? extends V> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Double wrapKey(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected double unwrapKey(Object key) {
++ return ((Double)key).doubleValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param o value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected final V wrapValue(V o) {
++ return o;
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected final V unwrapValue(V value) {
++ return value;
++ }
++
++} // TDoubleObjectHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TDoubleShortHashMapDecorator.java 2007-04-18 06:49:34.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TDoubleShortHashMap;
++import gnu.trove.TDoubleShortIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TDoubleShortHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TDoubleShortHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TDoubleShortHashMapDecorator extends AbstractMap<Double, Short>
++ implements Map<Double, Short>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TDoubleShortHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TDoubleShortHashMapDecorator(TDoubleShortHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TDoubleShortHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TDoubleShortHashMapDecorator clone() {
++ try {
++ TDoubleShortHashMapDecorator copy = (TDoubleShortHashMapDecorator) super.clone();
++ copy._map = (TDoubleShortHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Short(0) if none was found.
++ */
++ public Short put(Double key, Short value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Double && val instanceof Short) {
++ double k = unwrapKey(key);
++ short v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Short get(Double key) {
++ double k = unwrapKey(key);
++ short v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Short(0) if it was not found in the map
++ */
++ public Short remove(Double key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Double,Short>> entrySet() {
++ return new AbstractSet<Map.Entry<Double,Short>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TDoubleShortHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TDoubleShortHashMapDecorator.this.containsKey(k)
++ && TDoubleShortHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Double,Short>> iterator() {
++ return new Iterator<Map.Entry<Double,Short>>() {
++ private final TDoubleShortIterator it = _map.iterator();
++
++ public Map.Entry<Double,Short> next() {
++ it.advance();
++ final Double key = wrapKey(it.key());
++ final Short v = wrapValue(it.value());
++ return new Map.Entry<Double,Short>() {
++ private Short val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Double getKey() {
++ return key;
++ }
++
++ public Short getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Short setValue(Short value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Short o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Double, Short>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TDoubleShortHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Double, ? extends Short> map) {
++ Iterator<? extends Entry<? extends Double,? extends Short>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Double,? extends Short> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Double wrapKey(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected double unwrapKey(Object key) {
++ return ((Double)key).doubleValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Short wrapValue(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected short unwrapValue(Object value) {
++ return ((Short)value).shortValue();
++ }
++
++} // TDoubleShortHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TFloatByteHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TFloatByteHashMap;
++import gnu.trove.TFloatByteIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TFloatByteHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TFloatByteHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TFloatByteHashMapDecorator extends AbstractMap<Float, Byte>
++ implements Map<Float, Byte>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TFloatByteHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TFloatByteHashMapDecorator(TFloatByteHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TFloatByteHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TFloatByteHashMapDecorator clone() {
++ try {
++ TFloatByteHashMapDecorator copy = (TFloatByteHashMapDecorator) super.clone();
++ copy._map = (TFloatByteHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Byte(0) if none was found.
++ */
++ public Byte put(Float key, Byte value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Float && val instanceof Byte) {
++ float k = unwrapKey(key);
++ byte v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Byte get(Float key) {
++ float k = unwrapKey(key);
++ byte v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Byte(0) if it was not found in the map
++ */
++ public Byte remove(Float key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Float,Byte>> entrySet() {
++ return new AbstractSet<Map.Entry<Float,Byte>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TFloatByteHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TFloatByteHashMapDecorator.this.containsKey(k)
++ && TFloatByteHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Float,Byte>> iterator() {
++ return new Iterator<Map.Entry<Float,Byte>>() {
++ private final TFloatByteIterator it = _map.iterator();
++
++ public Map.Entry<Float,Byte> next() {
++ it.advance();
++ final Float key = wrapKey(it.key());
++ final Byte v = wrapValue(it.value());
++ return new Map.Entry<Float,Byte>() {
++ private Byte val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Float getKey() {
++ return key;
++ }
++
++ public Byte getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Byte setValue(Byte value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Byte o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Float, Byte>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TFloatByteHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Float, ? extends Byte> map) {
++ Iterator<? extends Entry<? extends Float,? extends Byte>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Float,? extends Byte> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Float wrapKey(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected float unwrapKey(Object key) {
++ return ((Float)key).floatValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Byte wrapValue(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected byte unwrapValue(Object value) {
++ return ((Byte)value).byteValue();
++ }
++
++} // TFloatByteHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TFloatDoubleHashMapDecorator.java 2007-04-18 06:49:34.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TFloatDoubleHashMap;
++import gnu.trove.TFloatDoubleIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TFloatDoubleHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TFloatDoubleHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TFloatDoubleHashMapDecorator extends AbstractMap<Float, Double>
++ implements Map<Float, Double>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TFloatDoubleHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TFloatDoubleHashMapDecorator(TFloatDoubleHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TFloatDoubleHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TFloatDoubleHashMapDecorator clone() {
++ try {
++ TFloatDoubleHashMapDecorator copy = (TFloatDoubleHashMapDecorator) super.clone();
++ copy._map = (TFloatDoubleHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Double(0) if none was found.
++ */
++ public Double put(Float key, Double value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Float && val instanceof Double) {
++ float k = unwrapKey(key);
++ double v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Double get(Float key) {
++ float k = unwrapKey(key);
++ double v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Double(0) if it was not found in the map
++ */
++ public Double remove(Float key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Float,Double>> entrySet() {
++ return new AbstractSet<Map.Entry<Float,Double>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TFloatDoubleHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TFloatDoubleHashMapDecorator.this.containsKey(k)
++ && TFloatDoubleHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Float,Double>> iterator() {
++ return new Iterator<Map.Entry<Float,Double>>() {
++ private final TFloatDoubleIterator it = _map.iterator();
++
++ public Map.Entry<Float,Double> next() {
++ it.advance();
++ final Float key = wrapKey(it.key());
++ final Double v = wrapValue(it.value());
++ return new Map.Entry<Float,Double>() {
++ private Double val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Float getKey() {
++ return key;
++ }
++
++ public Double getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Double setValue(Double value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Double o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Float, Double>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TFloatDoubleHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Float, ? extends Double> map) {
++ Iterator<? extends Entry<? extends Float,? extends Double>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Float,? extends Double> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Float wrapKey(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected float unwrapKey(Object key) {
++ return ((Float)key).floatValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Double wrapValue(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected double unwrapValue(Object value) {
++ return ((Double)value).doubleValue();
++ }
++
++} // TFloatDoubleHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TFloatFloatHashMapDecorator.java 2007-04-18 06:49:34.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TFloatFloatHashMap;
++import gnu.trove.TFloatFloatIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TFloatFloatHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TFloatFloatHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TFloatFloatHashMapDecorator extends AbstractMap<Float, Float>
++ implements Map<Float, Float>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TFloatFloatHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TFloatFloatHashMapDecorator(TFloatFloatHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TFloatFloatHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TFloatFloatHashMapDecorator clone() {
++ try {
++ TFloatFloatHashMapDecorator copy = (TFloatFloatHashMapDecorator) super.clone();
++ copy._map = (TFloatFloatHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Float(0) if none was found.
++ */
++ public Float put(Float key, Float value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Float && val instanceof Float) {
++ float k = unwrapKey(key);
++ float v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Float get(Float key) {
++ float k = unwrapKey(key);
++ float v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Float(0) if it was not found in the map
++ */
++ public Float remove(Float key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Float,Float>> entrySet() {
++ return new AbstractSet<Map.Entry<Float,Float>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TFloatFloatHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TFloatFloatHashMapDecorator.this.containsKey(k)
++ && TFloatFloatHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Float,Float>> iterator() {
++ return new Iterator<Map.Entry<Float,Float>>() {
++ private final TFloatFloatIterator it = _map.iterator();
++
++ public Map.Entry<Float,Float> next() {
++ it.advance();
++ final Float key = wrapKey(it.key());
++ final Float v = wrapValue(it.value());
++ return new Map.Entry<Float,Float>() {
++ private Float val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Float getKey() {
++ return key;
++ }
++
++ public Float getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Float setValue(Float value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Float o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Float, Float>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TFloatFloatHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Float, ? extends Float> map) {
++ Iterator<? extends Entry<? extends Float,? extends Float>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Float,? extends Float> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Float wrapKey(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected float unwrapKey(Object key) {
++ return ((Float)key).floatValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Float wrapValue(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected float unwrapValue(Object value) {
++ return ((Float)value).floatValue();
++ }
++
++} // TFloatFloatHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TFloatHashSetDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,209 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TFloatHashSet;
++import gnu.trove.TFloatIterator;
++
++import java.util.AbstractSet;
++import java.util.Iterator;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TFloatHashSet conform to the <tt>java.util.Set</tt> API.
++ * This class simply decorates an underlying TFloatHashSet and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Tue Sep 24 22:08:17 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TFloatHashSetDecorator extends AbstractSet<Float> implements Set<Float> {
++ /** the wrapped primitive set */
++ protected TFloatHashSet _set;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive set.
++ */
++ public TFloatHashSetDecorator(TFloatHashSet set) {
++ super();
++ this._set = set;
++ }
++
++
++ /**
++ * Returns a reference to the set wrapped by this decorator.
++ */
++ public TFloatHashSet getSet() {
++ return _set;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TFloatHashSetDecorator clone() {
++ try {
++ TFloatHashSetDecorator copy = (TFloatHashSetDecorator) super.clone();
++ copy._set = (TFloatHashSet) _set.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable
++ }
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param value true if the set was modified by the insertion
++ */
++ public boolean add(Float value) {
++ return _set.add(unwrap(value));
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the sets are identical
++ */
++ public boolean equals(Object other) {
++ if (_set.equals(other)) {
++ return true; // comparing two trove sets
++ } else if (other instanceof Set) {
++ Set that = (Set) other;
++ if (that.size() != _set.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Object val = it.next();
++ if (val instanceof Float) {
++ float v = unwrap(val);
++ if (_set.contains(v)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other set
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ this._set.clear();
++ }
++
++ /**
++ * Deletes a value from the set.
++ *
++ * @param value an <code>Object</code> value
++ * @return true if the set was modified
++ */
++ public boolean remove(Object value) {
++ return _set.remove(unwrap(value));
++ }
++
++ /**
++ * Creates an iterator over the values of the set.
++ *
++ * @return an iterator with support for removals in the underlying set
++ */
++ public Iterator<Float> iterator() {
++ return new Iterator<Float>() {
++ private final TFloatIterator it = _set.iterator();
++
++ public Float next() {
++ return wrap(it.next());
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ /**
++ * Returns the number of entries in the set.
++ *
++ * @return the set's size.
++ */
++ public int size() {
++ return this._set.size();
++ }
++
++ /**
++ * Indicates whether set has any entries.
++ *
++ * @return true if the set is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying set
++ * @return an Object representation of the value
++ */
++ protected Float wrap(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected float unwrap(Object value) {
++ return ((Float) value).floatValue();
++ }
++} // TFloatHashSetDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TFloatIntHashMapDecorator.java 2007-04-18 06:49:34.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TFloatIntHashMap;
++import gnu.trove.TFloatIntIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TFloatIntHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TFloatIntHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TFloatIntHashMapDecorator extends AbstractMap<Float, Integer>
++ implements Map<Float, Integer>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TFloatIntHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TFloatIntHashMapDecorator(TFloatIntHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TFloatIntHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TFloatIntHashMapDecorator clone() {
++ try {
++ TFloatIntHashMapDecorator copy = (TFloatIntHashMapDecorator) super.clone();
++ copy._map = (TFloatIntHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Integer put(Float key, Integer value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Float && val instanceof Integer) {
++ float k = unwrapKey(key);
++ int v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Integer get(Float key) {
++ float k = unwrapKey(key);
++ int v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Integer remove(Float key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Float,Integer>> entrySet() {
++ return new AbstractSet<Map.Entry<Float,Integer>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TFloatIntHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TFloatIntHashMapDecorator.this.containsKey(k)
++ && TFloatIntHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Float,Integer>> iterator() {
++ return new Iterator<Map.Entry<Float,Integer>>() {
++ private final TFloatIntIterator it = _map.iterator();
++
++ public Map.Entry<Float,Integer> next() {
++ it.advance();
++ final Float key = wrapKey(it.key());
++ final Integer v = wrapValue(it.value());
++ return new Map.Entry<Float,Integer>() {
++ private Integer val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Float getKey() {
++ return key;
++ }
++
++ public Integer getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Integer setValue(Integer value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Integer o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Float, Integer>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TFloatIntHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Float, ? extends Integer> map) {
++ Iterator<? extends Entry<? extends Float,? extends Integer>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Float,? extends Integer> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Float wrapKey(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected float unwrapKey(Object key) {
++ return ((Float)key).floatValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Integer wrapValue(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected int unwrapValue(Object value) {
++ return ((Integer)value).intValue();
++ }
++
++} // TFloatIntHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TFloatLongHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TFloatLongHashMap;
++import gnu.trove.TFloatLongIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TFloatLongHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TFloatLongHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TFloatLongHashMapDecorator extends AbstractMap<Float, Long>
++ implements Map<Float, Long>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TFloatLongHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TFloatLongHashMapDecorator(TFloatLongHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TFloatLongHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TFloatLongHashMapDecorator clone() {
++ try {
++ TFloatLongHashMapDecorator copy = (TFloatLongHashMapDecorator) super.clone();
++ copy._map = (TFloatLongHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Long(0) if none was found.
++ */
++ public Long put(Float key, Long value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Float && val instanceof Long) {
++ float k = unwrapKey(key);
++ long v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Long get(Float key) {
++ float k = unwrapKey(key);
++ long v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Long(0) if it was not found in the map
++ */
++ public Long remove(Float key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Float,Long>> entrySet() {
++ return new AbstractSet<Map.Entry<Float,Long>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TFloatLongHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TFloatLongHashMapDecorator.this.containsKey(k)
++ && TFloatLongHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Float,Long>> iterator() {
++ return new Iterator<Map.Entry<Float,Long>>() {
++ private final TFloatLongIterator it = _map.iterator();
++
++ public Map.Entry<Float,Long> next() {
++ it.advance();
++ final Float key = wrapKey(it.key());
++ final Long v = wrapValue(it.value());
++ return new Map.Entry<Float,Long>() {
++ private Long val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Float getKey() {
++ return key;
++ }
++
++ public Long getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Long setValue(Long value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Long o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Float, Long>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TFloatLongHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Float, ? extends Long> map) {
++ Iterator<? extends Entry<? extends Float,? extends Long>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Float,? extends Long> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Float wrapKey(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected float unwrapKey(Object key) {
++ return ((Float)key).floatValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Long wrapValue(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected long unwrapValue(Object value) {
++ return ((Long)value).longValue();
++ }
++
++} // TFloatLongHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TFloatObjectHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,365 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TFloatObjectHashMap;
++import gnu.trove.TFloatObjectIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TFloatObjectHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TFloatObjectHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TFloatObjectHashMapDecorator<V> extends AbstractMap<Float, V>
++ implements Map<Float, V>, Cloneable {
++
++ /**
++ * the wrapped primitive map
++ */
++ protected TFloatObjectHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TFloatObjectHashMapDecorator(TFloatObjectHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TFloatObjectHashMap<V> getMap() {
++ return _map;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TFloatObjectHashMapDecorator clone() {
++ try {
++ TFloatObjectHashMapDecorator copy = (TFloatObjectHashMapDecorator) super.clone();
++ copy._map = (TFloatObjectHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public V put(Float key, V value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Float) {
++ float k = unwrapKey(key);
++ Object v = unwrapValue((V) val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public V get(Object key) {
++ return _map.get(unwrapKey(key));
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public V remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Float,V>> entrySet() {
++ return new AbstractSet<Map.Entry<Float,V>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TFloatObjectHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TFloatObjectHashMapDecorator.this.containsKey(k) &&
++ TFloatObjectHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Float,V>> iterator() {
++ return new Iterator<Map.Entry<Float,V>>() {
++ private final TFloatObjectIterator<V> it = _map.iterator();
++
++ public Map.Entry<Float,V> next() {
++ it.advance();
++ final Float key = wrapKey(it.key());
++ final V v = wrapValue(it.value());
++ return new Map.Entry<Float,V>() {
++ private V val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Float getKey() {
++ return key;
++ }
++
++ public V getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public V setValue(V value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Map.Entry<Float,V> o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Float,V>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TFloatObjectHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue((V) val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Float, ? extends V> map) {
++ Iterator<? extends Entry<? extends Float,? extends V>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Float,? extends V> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Float wrapKey(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected float unwrapKey(Object key) {
++ return ((Float)key).floatValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param o value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected final V wrapValue(V o) {
++ return o;
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected final V unwrapValue(V value) {
++ return value;
++ }
++
++} // TFloatObjectHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TFloatShortHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TFloatShortHashMap;
++import gnu.trove.TFloatShortIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TFloatShortHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TFloatShortHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TFloatShortHashMapDecorator extends AbstractMap<Float, Short>
++ implements Map<Float, Short>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TFloatShortHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TFloatShortHashMapDecorator(TFloatShortHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TFloatShortHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TFloatShortHashMapDecorator clone() {
++ try {
++ TFloatShortHashMapDecorator copy = (TFloatShortHashMapDecorator) super.clone();
++ copy._map = (TFloatShortHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Short(0) if none was found.
++ */
++ public Short put(Float key, Short value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Float && val instanceof Short) {
++ float k = unwrapKey(key);
++ short v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Short get(Float key) {
++ float k = unwrapKey(key);
++ short v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Short(0) if it was not found in the map
++ */
++ public Short remove(Float key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Float,Short>> entrySet() {
++ return new AbstractSet<Map.Entry<Float,Short>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TFloatShortHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TFloatShortHashMapDecorator.this.containsKey(k)
++ && TFloatShortHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Float,Short>> iterator() {
++ return new Iterator<Map.Entry<Float,Short>>() {
++ private final TFloatShortIterator it = _map.iterator();
++
++ public Map.Entry<Float,Short> next() {
++ it.advance();
++ final Float key = wrapKey(it.key());
++ final Short v = wrapValue(it.value());
++ return new Map.Entry<Float,Short>() {
++ private Short val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Float getKey() {
++ return key;
++ }
++
++ public Short getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Short setValue(Short value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Short o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Float, Short>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TFloatShortHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Float, ? extends Short> map) {
++ Iterator<? extends Entry<? extends Float,? extends Short>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Float,? extends Short> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Float wrapKey(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected float unwrapKey(Object key) {
++ return ((Float)key).floatValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Short wrapValue(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected short unwrapValue(Object value) {
++ return ((Short)value).shortValue();
++ }
++
++} // TFloatShortHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TIntByteHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TIntByteHashMap;
++import gnu.trove.TIntByteIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TIntByteHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TIntByteHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TIntByteHashMapDecorator extends AbstractMap<Integer, Byte>
++ implements Map<Integer, Byte>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TIntByteHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TIntByteHashMapDecorator(TIntByteHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TIntByteHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TIntByteHashMapDecorator clone() {
++ try {
++ TIntByteHashMapDecorator copy = (TIntByteHashMapDecorator) super.clone();
++ copy._map = (TIntByteHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Byte(0) if none was found.
++ */
++ public Byte put(Integer key, Byte value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Integer && val instanceof Byte) {
++ int k = unwrapKey(key);
++ byte v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Byte get(Integer key) {
++ int k = unwrapKey(key);
++ byte v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Byte(0) if it was not found in the map
++ */
++ public Byte remove(Integer key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Integer,Byte>> entrySet() {
++ return new AbstractSet<Map.Entry<Integer,Byte>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TIntByteHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TIntByteHashMapDecorator.this.containsKey(k)
++ && TIntByteHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Integer,Byte>> iterator() {
++ return new Iterator<Map.Entry<Integer,Byte>>() {
++ private final TIntByteIterator it = _map.iterator();
++
++ public Map.Entry<Integer,Byte> next() {
++ it.advance();
++ final Integer key = wrapKey(it.key());
++ final Byte v = wrapValue(it.value());
++ return new Map.Entry<Integer,Byte>() {
++ private Byte val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Integer getKey() {
++ return key;
++ }
++
++ public Byte getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Byte setValue(Byte value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Byte o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Integer, Byte>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TIntByteHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Integer, ? extends Byte> map) {
++ Iterator<? extends Entry<? extends Integer,? extends Byte>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Integer,? extends Byte> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Integer wrapKey(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected int unwrapKey(Object key) {
++ return ((Integer)key).intValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Byte wrapValue(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected byte unwrapValue(Object value) {
++ return ((Byte)value).byteValue();
++ }
++
++} // TIntByteHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TIntDoubleHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TIntDoubleHashMap;
++import gnu.trove.TIntDoubleIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TIntDoubleHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TIntDoubleHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TIntDoubleHashMapDecorator extends AbstractMap<Integer, Double>
++ implements Map<Integer, Double>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TIntDoubleHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TIntDoubleHashMapDecorator(TIntDoubleHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TIntDoubleHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TIntDoubleHashMapDecorator clone() {
++ try {
++ TIntDoubleHashMapDecorator copy = (TIntDoubleHashMapDecorator) super.clone();
++ copy._map = (TIntDoubleHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Double(0) if none was found.
++ */
++ public Double put(Integer key, Double value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Integer && val instanceof Double) {
++ int k = unwrapKey(key);
++ double v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Double get(Integer key) {
++ int k = unwrapKey(key);
++ double v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Double(0) if it was not found in the map
++ */
++ public Double remove(Integer key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Integer,Double>> entrySet() {
++ return new AbstractSet<Map.Entry<Integer,Double>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TIntDoubleHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TIntDoubleHashMapDecorator.this.containsKey(k)
++ && TIntDoubleHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Integer,Double>> iterator() {
++ return new Iterator<Map.Entry<Integer,Double>>() {
++ private final TIntDoubleIterator it = _map.iterator();
++
++ public Map.Entry<Integer,Double> next() {
++ it.advance();
++ final Integer key = wrapKey(it.key());
++ final Double v = wrapValue(it.value());
++ return new Map.Entry<Integer,Double>() {
++ private Double val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Integer getKey() {
++ return key;
++ }
++
++ public Double getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Double setValue(Double value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Double o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Integer, Double>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TIntDoubleHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Integer, ? extends Double> map) {
++ Iterator<? extends Entry<? extends Integer,? extends Double>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Integer,? extends Double> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Integer wrapKey(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected int unwrapKey(Object key) {
++ return ((Integer)key).intValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Double wrapValue(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected double unwrapValue(Object value) {
++ return ((Double)value).doubleValue();
++ }
++
++} // TIntDoubleHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TIntFloatHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TIntFloatHashMap;
++import gnu.trove.TIntFloatIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TIntFloatHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TIntFloatHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TIntFloatHashMapDecorator extends AbstractMap<Integer, Float>
++ implements Map<Integer, Float>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TIntFloatHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TIntFloatHashMapDecorator(TIntFloatHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TIntFloatHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TIntFloatHashMapDecorator clone() {
++ try {
++ TIntFloatHashMapDecorator copy = (TIntFloatHashMapDecorator) super.clone();
++ copy._map = (TIntFloatHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Float(0) if none was found.
++ */
++ public Float put(Integer key, Float value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Integer && val instanceof Float) {
++ int k = unwrapKey(key);
++ float v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Float get(Integer key) {
++ int k = unwrapKey(key);
++ float v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Float(0) if it was not found in the map
++ */
++ public Float remove(Integer key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Integer,Float>> entrySet() {
++ return new AbstractSet<Map.Entry<Integer,Float>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TIntFloatHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TIntFloatHashMapDecorator.this.containsKey(k)
++ && TIntFloatHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Integer,Float>> iterator() {
++ return new Iterator<Map.Entry<Integer,Float>>() {
++ private final TIntFloatIterator it = _map.iterator();
++
++ public Map.Entry<Integer,Float> next() {
++ it.advance();
++ final Integer key = wrapKey(it.key());
++ final Float v = wrapValue(it.value());
++ return new Map.Entry<Integer,Float>() {
++ private Float val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Integer getKey() {
++ return key;
++ }
++
++ public Float getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Float setValue(Float value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Float o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Integer, Float>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TIntFloatHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Integer, ? extends Float> map) {
++ Iterator<? extends Entry<? extends Integer,? extends Float>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Integer,? extends Float> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Integer wrapKey(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected int unwrapKey(Object key) {
++ return ((Integer)key).intValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Float wrapValue(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected float unwrapValue(Object value) {
++ return ((Float)value).floatValue();
++ }
++
++} // TIntFloatHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TIntHashSetDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,209 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TIntHashSet;
++import gnu.trove.TIntIterator;
++
++import java.util.AbstractSet;
++import java.util.Iterator;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TIntHashSet conform to the <tt>java.util.Set</tt> API.
++ * This class simply decorates an underlying TIntHashSet and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Tue Sep 24 22:08:17 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TIntHashSetDecorator extends AbstractSet<Integer> implements Set<Integer> {
++ /** the wrapped primitive set */
++ protected TIntHashSet _set;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive set.
++ */
++ public TIntHashSetDecorator(TIntHashSet set) {
++ super();
++ this._set = set;
++ }
++
++
++ /**
++ * Returns a reference to the set wrapped by this decorator.
++ */
++ public TIntHashSet getSet() {
++ return _set;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TIntHashSetDecorator clone() {
++ try {
++ TIntHashSetDecorator copy = (TIntHashSetDecorator) super.clone();
++ copy._set = (TIntHashSet) _set.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable
++ }
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param value true if the set was modified by the insertion
++ */
++ public boolean add(Integer value) {
++ return _set.add(unwrap(value));
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the sets are identical
++ */
++ public boolean equals(Object other) {
++ if (_set.equals(other)) {
++ return true; // comparing two trove sets
++ } else if (other instanceof Set) {
++ Set that = (Set) other;
++ if (that.size() != _set.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Object val = it.next();
++ if (val instanceof Integer) {
++ int v = unwrap(val);
++ if (_set.contains(v)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other set
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ this._set.clear();
++ }
++
++ /**
++ * Deletes a value from the set.
++ *
++ * @param value an <code>Object</code> value
++ * @return true if the set was modified
++ */
++ public boolean remove(Object value) {
++ return _set.remove(unwrap(value));
++ }
++
++ /**
++ * Creates an iterator over the values of the set.
++ *
++ * @return an iterator with support for removals in the underlying set
++ */
++ public Iterator<Integer> iterator() {
++ return new Iterator<Integer>() {
++ private final TIntIterator it = _set.iterator();
++
++ public Integer next() {
++ return wrap(it.next());
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ /**
++ * Returns the number of entries in the set.
++ *
++ * @return the set's size.
++ */
++ public int size() {
++ return this._set.size();
++ }
++
++ /**
++ * Indicates whether set has any entries.
++ *
++ * @return true if the set is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying set
++ * @return an Object representation of the value
++ */
++ protected Integer wrap(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected int unwrap(Object value) {
++ return ((Integer) value).intValue();
++ }
++} // TIntHashSetDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TIntIntHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TIntIntHashMap;
++import gnu.trove.TIntIntIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TIntIntHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TIntIntHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TIntIntHashMapDecorator extends AbstractMap<Integer, Integer>
++ implements Map<Integer, Integer>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TIntIntHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TIntIntHashMapDecorator(TIntIntHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TIntIntHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TIntIntHashMapDecorator clone() {
++ try {
++ TIntIntHashMapDecorator copy = (TIntIntHashMapDecorator) super.clone();
++ copy._map = (TIntIntHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Integer put(Integer key, Integer value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Integer && val instanceof Integer) {
++ int k = unwrapKey(key);
++ int v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Integer get(Integer key) {
++ int k = unwrapKey(key);
++ int v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Integer remove(Integer key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Integer,Integer>> entrySet() {
++ return new AbstractSet<Map.Entry<Integer,Integer>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TIntIntHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TIntIntHashMapDecorator.this.containsKey(k)
++ && TIntIntHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Integer,Integer>> iterator() {
++ return new Iterator<Map.Entry<Integer,Integer>>() {
++ private final TIntIntIterator it = _map.iterator();
++
++ public Map.Entry<Integer,Integer> next() {
++ it.advance();
++ final Integer key = wrapKey(it.key());
++ final Integer v = wrapValue(it.value());
++ return new Map.Entry<Integer,Integer>() {
++ private Integer val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Integer getKey() {
++ return key;
++ }
++
++ public Integer getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Integer setValue(Integer value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Integer o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Integer, Integer>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TIntIntHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Integer, ? extends Integer> map) {
++ Iterator<? extends Entry<? extends Integer,? extends Integer>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Integer,? extends Integer> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Integer wrapKey(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected int unwrapKey(Object key) {
++ return ((Integer)key).intValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Integer wrapValue(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected int unwrapValue(Object value) {
++ return ((Integer)value).intValue();
++ }
++
++} // TIntIntHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TIntLongHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TIntLongHashMap;
++import gnu.trove.TIntLongIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TIntLongHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TIntLongHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TIntLongHashMapDecorator extends AbstractMap<Integer, Long>
++ implements Map<Integer, Long>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TIntLongHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TIntLongHashMapDecorator(TIntLongHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TIntLongHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TIntLongHashMapDecorator clone() {
++ try {
++ TIntLongHashMapDecorator copy = (TIntLongHashMapDecorator) super.clone();
++ copy._map = (TIntLongHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Long(0) if none was found.
++ */
++ public Long put(Integer key, Long value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Integer && val instanceof Long) {
++ int k = unwrapKey(key);
++ long v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Long get(Integer key) {
++ int k = unwrapKey(key);
++ long v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Long(0) if it was not found in the map
++ */
++ public Long remove(Integer key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Integer,Long>> entrySet() {
++ return new AbstractSet<Map.Entry<Integer,Long>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TIntLongHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TIntLongHashMapDecorator.this.containsKey(k)
++ && TIntLongHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Integer,Long>> iterator() {
++ return new Iterator<Map.Entry<Integer,Long>>() {
++ private final TIntLongIterator it = _map.iterator();
++
++ public Map.Entry<Integer,Long> next() {
++ it.advance();
++ final Integer key = wrapKey(it.key());
++ final Long v = wrapValue(it.value());
++ return new Map.Entry<Integer,Long>() {
++ private Long val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Integer getKey() {
++ return key;
++ }
++
++ public Long getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Long setValue(Long value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Long o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Integer, Long>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TIntLongHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Integer, ? extends Long> map) {
++ Iterator<? extends Entry<? extends Integer,? extends Long>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Integer,? extends Long> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Integer wrapKey(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected int unwrapKey(Object key) {
++ return ((Integer)key).intValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Long wrapValue(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected long unwrapValue(Object value) {
++ return ((Long)value).longValue();
++ }
++
++} // TIntLongHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TIntObjectHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,365 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TIntObjectHashMap;
++import gnu.trove.TIntObjectIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TIntObjectHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TIntObjectHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TIntObjectHashMapDecorator<V> extends AbstractMap<Integer, V>
++ implements Map<Integer, V>, Cloneable {
++
++ /**
++ * the wrapped primitive map
++ */
++ protected TIntObjectHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TIntObjectHashMapDecorator(TIntObjectHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TIntObjectHashMap<V> getMap() {
++ return _map;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TIntObjectHashMapDecorator clone() {
++ try {
++ TIntObjectHashMapDecorator copy = (TIntObjectHashMapDecorator) super.clone();
++ copy._map = (TIntObjectHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public V put(Integer key, V value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Integer) {
++ int k = unwrapKey(key);
++ Object v = unwrapValue((V) val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public V get(Object key) {
++ return _map.get(unwrapKey(key));
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public V remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Integer,V>> entrySet() {
++ return new AbstractSet<Map.Entry<Integer,V>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TIntObjectHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TIntObjectHashMapDecorator.this.containsKey(k) &&
++ TIntObjectHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Integer,V>> iterator() {
++ return new Iterator<Map.Entry<Integer,V>>() {
++ private final TIntObjectIterator<V> it = _map.iterator();
++
++ public Map.Entry<Integer,V> next() {
++ it.advance();
++ final Integer key = wrapKey(it.key());
++ final V v = wrapValue(it.value());
++ return new Map.Entry<Integer,V>() {
++ private V val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Integer getKey() {
++ return key;
++ }
++
++ public V getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public V setValue(V value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Map.Entry<Integer,V> o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Integer,V>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TIntObjectHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue((V) val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Integer, ? extends V> map) {
++ Iterator<? extends Entry<? extends Integer,? extends V>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Integer,? extends V> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Integer wrapKey(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected int unwrapKey(Object key) {
++ return ((Integer)key).intValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param o value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected final V wrapValue(V o) {
++ return o;
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected final V unwrapValue(V value) {
++ return value;
++ }
++
++} // TIntObjectHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TIntShortHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TIntShortHashMap;
++import gnu.trove.TIntShortIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TIntShortHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TIntShortHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TIntShortHashMapDecorator extends AbstractMap<Integer, Short>
++ implements Map<Integer, Short>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TIntShortHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TIntShortHashMapDecorator(TIntShortHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TIntShortHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TIntShortHashMapDecorator clone() {
++ try {
++ TIntShortHashMapDecorator copy = (TIntShortHashMapDecorator) super.clone();
++ copy._map = (TIntShortHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Short(0) if none was found.
++ */
++ public Short put(Integer key, Short value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Integer && val instanceof Short) {
++ int k = unwrapKey(key);
++ short v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Short get(Integer key) {
++ int k = unwrapKey(key);
++ short v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Short(0) if it was not found in the map
++ */
++ public Short remove(Integer key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Integer,Short>> entrySet() {
++ return new AbstractSet<Map.Entry<Integer,Short>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TIntShortHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TIntShortHashMapDecorator.this.containsKey(k)
++ && TIntShortHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Integer,Short>> iterator() {
++ return new Iterator<Map.Entry<Integer,Short>>() {
++ private final TIntShortIterator it = _map.iterator();
++
++ public Map.Entry<Integer,Short> next() {
++ it.advance();
++ final Integer key = wrapKey(it.key());
++ final Short v = wrapValue(it.value());
++ return new Map.Entry<Integer,Short>() {
++ private Short val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Integer getKey() {
++ return key;
++ }
++
++ public Short getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Short setValue(Short value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Short o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Integer, Short>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TIntShortHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Integer, ? extends Short> map) {
++ Iterator<? extends Entry<? extends Integer,? extends Short>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Integer,? extends Short> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Integer wrapKey(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected int unwrapKey(Object key) {
++ return ((Integer)key).intValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Short wrapValue(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected short unwrapValue(Object value) {
++ return ((Short)value).shortValue();
++ }
++
++} // TIntShortHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TLongByteHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TLongByteHashMap;
++import gnu.trove.TLongByteIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TLongByteHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TLongByteHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TLongByteHashMapDecorator extends AbstractMap<Long, Byte>
++ implements Map<Long, Byte>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TLongByteHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TLongByteHashMapDecorator(TLongByteHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TLongByteHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TLongByteHashMapDecorator clone() {
++ try {
++ TLongByteHashMapDecorator copy = (TLongByteHashMapDecorator) super.clone();
++ copy._map = (TLongByteHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Byte(0) if none was found.
++ */
++ public Byte put(Long key, Byte value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Long && val instanceof Byte) {
++ long k = unwrapKey(key);
++ byte v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Byte get(Long key) {
++ long k = unwrapKey(key);
++ byte v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Byte(0) if it was not found in the map
++ */
++ public Byte remove(Long key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Long,Byte>> entrySet() {
++ return new AbstractSet<Map.Entry<Long,Byte>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TLongByteHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TLongByteHashMapDecorator.this.containsKey(k)
++ && TLongByteHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Long,Byte>> iterator() {
++ return new Iterator<Map.Entry<Long,Byte>>() {
++ private final TLongByteIterator it = _map.iterator();
++
++ public Map.Entry<Long,Byte> next() {
++ it.advance();
++ final Long key = wrapKey(it.key());
++ final Byte v = wrapValue(it.value());
++ return new Map.Entry<Long,Byte>() {
++ private Byte val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Long getKey() {
++ return key;
++ }
++
++ public Byte getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Byte setValue(Byte value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Byte o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Long, Byte>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TLongByteHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Long, ? extends Byte> map) {
++ Iterator<? extends Entry<? extends Long,? extends Byte>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Long,? extends Byte> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Long wrapKey(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected long unwrapKey(Object key) {
++ return ((Long)key).longValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Byte wrapValue(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected byte unwrapValue(Object value) {
++ return ((Byte)value).byteValue();
++ }
++
++} // TLongByteHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TLongDoubleHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TLongDoubleHashMap;
++import gnu.trove.TLongDoubleIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TLongDoubleHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TLongDoubleHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TLongDoubleHashMapDecorator extends AbstractMap<Long, Double>
++ implements Map<Long, Double>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TLongDoubleHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TLongDoubleHashMapDecorator(TLongDoubleHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TLongDoubleHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TLongDoubleHashMapDecorator clone() {
++ try {
++ TLongDoubleHashMapDecorator copy = (TLongDoubleHashMapDecorator) super.clone();
++ copy._map = (TLongDoubleHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Double(0) if none was found.
++ */
++ public Double put(Long key, Double value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Long && val instanceof Double) {
++ long k = unwrapKey(key);
++ double v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Double get(Long key) {
++ long k = unwrapKey(key);
++ double v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Double(0) if it was not found in the map
++ */
++ public Double remove(Long key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Long,Double>> entrySet() {
++ return new AbstractSet<Map.Entry<Long,Double>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TLongDoubleHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TLongDoubleHashMapDecorator.this.containsKey(k)
++ && TLongDoubleHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Long,Double>> iterator() {
++ return new Iterator<Map.Entry<Long,Double>>() {
++ private final TLongDoubleIterator it = _map.iterator();
++
++ public Map.Entry<Long,Double> next() {
++ it.advance();
++ final Long key = wrapKey(it.key());
++ final Double v = wrapValue(it.value());
++ return new Map.Entry<Long,Double>() {
++ private Double val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Long getKey() {
++ return key;
++ }
++
++ public Double getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Double setValue(Double value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Double o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Long, Double>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TLongDoubleHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Long, ? extends Double> map) {
++ Iterator<? extends Entry<? extends Long,? extends Double>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Long,? extends Double> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Long wrapKey(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected long unwrapKey(Object key) {
++ return ((Long)key).longValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Double wrapValue(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected double unwrapValue(Object value) {
++ return ((Double)value).doubleValue();
++ }
++
++} // TLongDoubleHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TLongFloatHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TLongFloatHashMap;
++import gnu.trove.TLongFloatIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TLongFloatHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TLongFloatHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TLongFloatHashMapDecorator extends AbstractMap<Long, Float>
++ implements Map<Long, Float>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TLongFloatHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TLongFloatHashMapDecorator(TLongFloatHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TLongFloatHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TLongFloatHashMapDecorator clone() {
++ try {
++ TLongFloatHashMapDecorator copy = (TLongFloatHashMapDecorator) super.clone();
++ copy._map = (TLongFloatHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Float(0) if none was found.
++ */
++ public Float put(Long key, Float value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Long && val instanceof Float) {
++ long k = unwrapKey(key);
++ float v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Float get(Long key) {
++ long k = unwrapKey(key);
++ float v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Float(0) if it was not found in the map
++ */
++ public Float remove(Long key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Long,Float>> entrySet() {
++ return new AbstractSet<Map.Entry<Long,Float>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TLongFloatHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TLongFloatHashMapDecorator.this.containsKey(k)
++ && TLongFloatHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Long,Float>> iterator() {
++ return new Iterator<Map.Entry<Long,Float>>() {
++ private final TLongFloatIterator it = _map.iterator();
++
++ public Map.Entry<Long,Float> next() {
++ it.advance();
++ final Long key = wrapKey(it.key());
++ final Float v = wrapValue(it.value());
++ return new Map.Entry<Long,Float>() {
++ private Float val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Long getKey() {
++ return key;
++ }
++
++ public Float getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Float setValue(Float value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Float o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Long, Float>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TLongFloatHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Long, ? extends Float> map) {
++ Iterator<? extends Entry<? extends Long,? extends Float>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Long,? extends Float> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Long wrapKey(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected long unwrapKey(Object key) {
++ return ((Long)key).longValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Float wrapValue(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected float unwrapValue(Object value) {
++ return ((Float)value).floatValue();
++ }
++
++} // TLongFloatHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TLongHashSetDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,209 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TLongHashSet;
++import gnu.trove.TLongIterator;
++
++import java.util.AbstractSet;
++import java.util.Iterator;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TLongHashSet conform to the <tt>java.util.Set</tt> API.
++ * This class simply decorates an underlying TLongHashSet and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Tue Sep 24 22:08:17 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TLongHashSetDecorator extends AbstractSet<Long> implements Set<Long> {
++ /** the wrapped primitive set */
++ protected TLongHashSet _set;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive set.
++ */
++ public TLongHashSetDecorator(TLongHashSet set) {
++ super();
++ this._set = set;
++ }
++
++
++ /**
++ * Returns a reference to the set wrapped by this decorator.
++ */
++ public TLongHashSet getSet() {
++ return _set;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TLongHashSetDecorator clone() {
++ try {
++ TLongHashSetDecorator copy = (TLongHashSetDecorator) super.clone();
++ copy._set = (TLongHashSet) _set.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable
++ }
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param value true if the set was modified by the insertion
++ */
++ public boolean add(Long value) {
++ return _set.add(unwrap(value));
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the sets are identical
++ */
++ public boolean equals(Object other) {
++ if (_set.equals(other)) {
++ return true; // comparing two trove sets
++ } else if (other instanceof Set) {
++ Set that = (Set) other;
++ if (that.size() != _set.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Object val = it.next();
++ if (val instanceof Long) {
++ long v = unwrap(val);
++ if (_set.contains(v)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other set
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ this._set.clear();
++ }
++
++ /**
++ * Deletes a value from the set.
++ *
++ * @param value an <code>Object</code> value
++ * @return true if the set was modified
++ */
++ public boolean remove(Object value) {
++ return _set.remove(unwrap(value));
++ }
++
++ /**
++ * Creates an iterator over the values of the set.
++ *
++ * @return an iterator with support for removals in the underlying set
++ */
++ public Iterator<Long> iterator() {
++ return new Iterator<Long>() {
++ private final TLongIterator it = _set.iterator();
++
++ public Long next() {
++ return wrap(it.next());
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ /**
++ * Returns the number of entries in the set.
++ *
++ * @return the set's size.
++ */
++ public int size() {
++ return this._set.size();
++ }
++
++ /**
++ * Indicates whether set has any entries.
++ *
++ * @return true if the set is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying set
++ * @return an Object representation of the value
++ */
++ protected Long wrap(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected long unwrap(Object value) {
++ return ((Long) value).longValue();
++ }
++} // TLongHashSetDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TLongIntHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TLongIntHashMap;
++import gnu.trove.TLongIntIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TLongIntHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TLongIntHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TLongIntHashMapDecorator extends AbstractMap<Long, Integer>
++ implements Map<Long, Integer>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TLongIntHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TLongIntHashMapDecorator(TLongIntHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TLongIntHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TLongIntHashMapDecorator clone() {
++ try {
++ TLongIntHashMapDecorator copy = (TLongIntHashMapDecorator) super.clone();
++ copy._map = (TLongIntHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Integer put(Long key, Integer value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Long && val instanceof Integer) {
++ long k = unwrapKey(key);
++ int v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Integer get(Long key) {
++ long k = unwrapKey(key);
++ int v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Integer remove(Long key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Long,Integer>> entrySet() {
++ return new AbstractSet<Map.Entry<Long,Integer>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TLongIntHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TLongIntHashMapDecorator.this.containsKey(k)
++ && TLongIntHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Long,Integer>> iterator() {
++ return new Iterator<Map.Entry<Long,Integer>>() {
++ private final TLongIntIterator it = _map.iterator();
++
++ public Map.Entry<Long,Integer> next() {
++ it.advance();
++ final Long key = wrapKey(it.key());
++ final Integer v = wrapValue(it.value());
++ return new Map.Entry<Long,Integer>() {
++ private Integer val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Long getKey() {
++ return key;
++ }
++
++ public Integer getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Integer setValue(Integer value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Integer o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Long, Integer>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TLongIntHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Long, ? extends Integer> map) {
++ Iterator<? extends Entry<? extends Long,? extends Integer>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Long,? extends Integer> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Long wrapKey(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected long unwrapKey(Object key) {
++ return ((Long)key).longValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Integer wrapValue(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected int unwrapValue(Object value) {
++ return ((Integer)value).intValue();
++ }
++
++} // TLongIntHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TLongLongHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TLongLongHashMap;
++import gnu.trove.TLongLongIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TLongLongHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TLongLongHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TLongLongHashMapDecorator extends AbstractMap<Long, Long>
++ implements Map<Long, Long>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TLongLongHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TLongLongHashMapDecorator(TLongLongHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TLongLongHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TLongLongHashMapDecorator clone() {
++ try {
++ TLongLongHashMapDecorator copy = (TLongLongHashMapDecorator) super.clone();
++ copy._map = (TLongLongHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Long(0) if none was found.
++ */
++ public Long put(Long key, Long value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Long && val instanceof Long) {
++ long k = unwrapKey(key);
++ long v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Long get(Long key) {
++ long k = unwrapKey(key);
++ long v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Long(0) if it was not found in the map
++ */
++ public Long remove(Long key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Long,Long>> entrySet() {
++ return new AbstractSet<Map.Entry<Long,Long>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TLongLongHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TLongLongHashMapDecorator.this.containsKey(k)
++ && TLongLongHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Long,Long>> iterator() {
++ return new Iterator<Map.Entry<Long,Long>>() {
++ private final TLongLongIterator it = _map.iterator();
++
++ public Map.Entry<Long,Long> next() {
++ it.advance();
++ final Long key = wrapKey(it.key());
++ final Long v = wrapValue(it.value());
++ return new Map.Entry<Long,Long>() {
++ private Long val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Long getKey() {
++ return key;
++ }
++
++ public Long getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Long setValue(Long value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Long o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Long, Long>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TLongLongHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Long, ? extends Long> map) {
++ Iterator<? extends Entry<? extends Long,? extends Long>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Long,? extends Long> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Long wrapKey(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected long unwrapKey(Object key) {
++ return ((Long)key).longValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Long wrapValue(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected long unwrapValue(Object value) {
++ return ((Long)value).longValue();
++ }
++
++} // TLongLongHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TLongObjectHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,365 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TLongObjectHashMap;
++import gnu.trove.TLongObjectIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TLongObjectHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TLongObjectHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TLongObjectHashMapDecorator<V> extends AbstractMap<Long, V>
++ implements Map<Long, V>, Cloneable {
++
++ /**
++ * the wrapped primitive map
++ */
++ protected TLongObjectHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TLongObjectHashMapDecorator(TLongObjectHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TLongObjectHashMap<V> getMap() {
++ return _map;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TLongObjectHashMapDecorator clone() {
++ try {
++ TLongObjectHashMapDecorator copy = (TLongObjectHashMapDecorator) super.clone();
++ copy._map = (TLongObjectHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public V put(Long key, V value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Long) {
++ long k = unwrapKey(key);
++ Object v = unwrapValue((V) val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public V get(Object key) {
++ return _map.get(unwrapKey(key));
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public V remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Long,V>> entrySet() {
++ return new AbstractSet<Map.Entry<Long,V>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TLongObjectHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TLongObjectHashMapDecorator.this.containsKey(k) &&
++ TLongObjectHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Long,V>> iterator() {
++ return new Iterator<Map.Entry<Long,V>>() {
++ private final TLongObjectIterator<V> it = _map.iterator();
++
++ public Map.Entry<Long,V> next() {
++ it.advance();
++ final Long key = wrapKey(it.key());
++ final V v = wrapValue(it.value());
++ return new Map.Entry<Long,V>() {
++ private V val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Long getKey() {
++ return key;
++ }
++
++ public V getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public V setValue(V value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Map.Entry<Long,V> o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Long,V>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TLongObjectHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue((V) val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Long, ? extends V> map) {
++ Iterator<? extends Entry<? extends Long,? extends V>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Long,? extends V> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Long wrapKey(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected long unwrapKey(Object key) {
++ return ((Long)key).longValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param o value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected final V wrapValue(V o) {
++ return o;
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected final V unwrapValue(V value) {
++ return value;
++ }
++
++} // TLongObjectHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TLongShortHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TLongShortHashMap;
++import gnu.trove.TLongShortIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TLongShortHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TLongShortHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TLongShortHashMapDecorator extends AbstractMap<Long, Short>
++ implements Map<Long, Short>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TLongShortHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TLongShortHashMapDecorator(TLongShortHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TLongShortHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TLongShortHashMapDecorator clone() {
++ try {
++ TLongShortHashMapDecorator copy = (TLongShortHashMapDecorator) super.clone();
++ copy._map = (TLongShortHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Short(0) if none was found.
++ */
++ public Short put(Long key, Short value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Long && val instanceof Short) {
++ long k = unwrapKey(key);
++ short v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Short get(Long key) {
++ long k = unwrapKey(key);
++ short v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Short(0) if it was not found in the map
++ */
++ public Short remove(Long key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Long,Short>> entrySet() {
++ return new AbstractSet<Map.Entry<Long,Short>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TLongShortHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TLongShortHashMapDecorator.this.containsKey(k)
++ && TLongShortHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Long,Short>> iterator() {
++ return new Iterator<Map.Entry<Long,Short>>() {
++ private final TLongShortIterator it = _map.iterator();
++
++ public Map.Entry<Long,Short> next() {
++ it.advance();
++ final Long key = wrapKey(it.key());
++ final Short v = wrapValue(it.value());
++ return new Map.Entry<Long,Short>() {
++ private Short val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Long getKey() {
++ return key;
++ }
++
++ public Short getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Short setValue(Short value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Short o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Long, Short>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TLongShortHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Long, ? extends Short> map) {
++ Iterator<? extends Entry<? extends Long,? extends Short>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Long,? extends Short> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Long wrapKey(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected long unwrapKey(Object key) {
++ return ((Long)key).longValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Short wrapValue(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected short unwrapValue(Object value) {
++ return ((Short)value).shortValue();
++ }
++
++} // TLongShortHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TObjectByteHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,373 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TObjectByteHashMap;
++import gnu.trove.TObjectByteIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TObjectByteHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TObjectByteHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectByteHashMapDecorator<V> extends AbstractMap<V, Byte> implements Map<V, Byte> {
++ /**
++ * the wrapped primitive map
++ */
++ protected TObjectByteHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TObjectByteHashMapDecorator(TObjectByteHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TObjectByteHashMap<V> getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TObjectByteHashMapDecorator clone() {
++ try {
++ TObjectByteHashMapDecorator copy = (TObjectByteHashMapDecorator) super.clone();
++ copy._map = (TObjectByteHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Byte put(V key, Byte value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (val instanceof Byte) {
++ V k = unwrapKey(key);
++ byte v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Byte get(Object key) {
++ V k = unwrapKey(key);
++ byte v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Byte remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<V,Byte>> entrySet() {
++ return new AbstractSet<Map.Entry<V,Byte>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TObjectByteHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TObjectByteHashMapDecorator.this.containsKey(k) &&
++ TObjectByteHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<V,Byte>> iterator() {
++ return new Iterator<Map.Entry<V,Byte>>() {
++ private final TObjectByteIterator<V> it = _map.iterator();
++
++ public Map.Entry<V,Byte> next() {
++ it.advance();
++ final V key = wrapKey(it.key());
++ final Byte v = wrapValue(it.value());
++ return new Map.Entry<V,Byte>() {
++ private Byte val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry &&
++ ((Map.Entry) o).getKey().equals(key) &&
++ ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public V getKey() {
++ return key;
++ }
++
++ public Byte getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Byte setValue(Byte value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Byte o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<V,Byte>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TObjectByteHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends V, ? extends Byte> map) {
++ Iterator<? extends Entry<? extends V,? extends Byte>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends V,? extends Byte> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param o key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected final V wrapKey(Object o) {
++ return (V) o;
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected final V unwrapKey(Object key) {
++ return (V) key;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Byte wrapValue(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected byte unwrapValue(Object value) {
++ return ((Byte) value).byteValue();
++ }
++
++} // TObjectByteHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TObjectDoubleHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,373 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TObjectDoubleHashMap;
++import gnu.trove.TObjectDoubleIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TObjectDoubleHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TObjectDoubleHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectDoubleHashMapDecorator<V> extends AbstractMap<V, Double> implements Map<V, Double> {
++ /**
++ * the wrapped primitive map
++ */
++ protected TObjectDoubleHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TObjectDoubleHashMapDecorator(TObjectDoubleHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TObjectDoubleHashMap<V> getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TObjectDoubleHashMapDecorator clone() {
++ try {
++ TObjectDoubleHashMapDecorator copy = (TObjectDoubleHashMapDecorator) super.clone();
++ copy._map = (TObjectDoubleHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Double put(V key, Double value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (val instanceof Double) {
++ V k = unwrapKey(key);
++ double v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Double get(Object key) {
++ V k = unwrapKey(key);
++ double v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Double remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<V,Double>> entrySet() {
++ return new AbstractSet<Map.Entry<V,Double>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TObjectDoubleHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TObjectDoubleHashMapDecorator.this.containsKey(k) &&
++ TObjectDoubleHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<V,Double>> iterator() {
++ return new Iterator<Map.Entry<V,Double>>() {
++ private final TObjectDoubleIterator<V> it = _map.iterator();
++
++ public Map.Entry<V,Double> next() {
++ it.advance();
++ final V key = wrapKey(it.key());
++ final Double v = wrapValue(it.value());
++ return new Map.Entry<V,Double>() {
++ private Double val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry &&
++ ((Map.Entry) o).getKey().equals(key) &&
++ ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public V getKey() {
++ return key;
++ }
++
++ public Double getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Double setValue(Double value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Double o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<V,Double>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TObjectDoubleHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends V, ? extends Double> map) {
++ Iterator<? extends Entry<? extends V,? extends Double>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends V,? extends Double> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param o key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected final V wrapKey(Object o) {
++ return (V) o;
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected final V unwrapKey(Object key) {
++ return (V) key;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Double wrapValue(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected double unwrapValue(Object value) {
++ return ((Double) value).doubleValue();
++ }
++
++} // TObjectDoubleHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TObjectFloatHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,373 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TObjectFloatHashMap;
++import gnu.trove.TObjectFloatIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TObjectFloatHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TObjectFloatHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectFloatHashMapDecorator<V> extends AbstractMap<V, Float> implements Map<V, Float> {
++ /**
++ * the wrapped primitive map
++ */
++ protected TObjectFloatHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TObjectFloatHashMapDecorator(TObjectFloatHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TObjectFloatHashMap<V> getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TObjectFloatHashMapDecorator clone() {
++ try {
++ TObjectFloatHashMapDecorator copy = (TObjectFloatHashMapDecorator) super.clone();
++ copy._map = (TObjectFloatHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Float put(V key, Float value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (val instanceof Float) {
++ V k = unwrapKey(key);
++ float v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Float get(Object key) {
++ V k = unwrapKey(key);
++ float v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Float remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<V,Float>> entrySet() {
++ return new AbstractSet<Map.Entry<V,Float>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TObjectFloatHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TObjectFloatHashMapDecorator.this.containsKey(k) &&
++ TObjectFloatHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<V,Float>> iterator() {
++ return new Iterator<Map.Entry<V,Float>>() {
++ private final TObjectFloatIterator<V> it = _map.iterator();
++
++ public Map.Entry<V,Float> next() {
++ it.advance();
++ final V key = wrapKey(it.key());
++ final Float v = wrapValue(it.value());
++ return new Map.Entry<V,Float>() {
++ private Float val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry &&
++ ((Map.Entry) o).getKey().equals(key) &&
++ ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public V getKey() {
++ return key;
++ }
++
++ public Float getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Float setValue(Float value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Float o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<V,Float>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TObjectFloatHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends V, ? extends Float> map) {
++ Iterator<? extends Entry<? extends V,? extends Float>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends V,? extends Float> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param o key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected final V wrapKey(Object o) {
++ return (V) o;
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected final V unwrapKey(Object key) {
++ return (V) key;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Float wrapValue(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected float unwrapValue(Object value) {
++ return ((Float) value).floatValue();
++ }
++
++} // TObjectFloatHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TObjectIntHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,373 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TObjectIntHashMap;
++import gnu.trove.TObjectIntIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TObjectIntHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TObjectIntHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectIntHashMapDecorator<V> extends AbstractMap<V, Integer> implements Map<V, Integer> {
++ /**
++ * the wrapped primitive map
++ */
++ protected TObjectIntHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TObjectIntHashMapDecorator(TObjectIntHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TObjectIntHashMap<V> getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TObjectIntHashMapDecorator clone() {
++ try {
++ TObjectIntHashMapDecorator copy = (TObjectIntHashMapDecorator) super.clone();
++ copy._map = (TObjectIntHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Integer put(V key, Integer value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (val instanceof Integer) {
++ V k = unwrapKey(key);
++ int v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Integer get(Object key) {
++ V k = unwrapKey(key);
++ int v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Integer remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<V,Integer>> entrySet() {
++ return new AbstractSet<Map.Entry<V,Integer>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TObjectIntHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TObjectIntHashMapDecorator.this.containsKey(k) &&
++ TObjectIntHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<V,Integer>> iterator() {
++ return new Iterator<Map.Entry<V,Integer>>() {
++ private final TObjectIntIterator<V> it = _map.iterator();
++
++ public Map.Entry<V,Integer> next() {
++ it.advance();
++ final V key = wrapKey(it.key());
++ final Integer v = wrapValue(it.value());
++ return new Map.Entry<V,Integer>() {
++ private Integer val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry &&
++ ((Map.Entry) o).getKey().equals(key) &&
++ ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public V getKey() {
++ return key;
++ }
++
++ public Integer getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Integer setValue(Integer value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Integer o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<V,Integer>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TObjectIntHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends V, ? extends Integer> map) {
++ Iterator<? extends Entry<? extends V,? extends Integer>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends V,? extends Integer> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param o key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected final V wrapKey(Object o) {
++ return (V) o;
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected final V unwrapKey(Object key) {
++ return (V) key;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Integer wrapValue(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected int unwrapValue(Object value) {
++ return ((Integer) value).intValue();
++ }
++
++} // TObjectIntHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TObjectLongHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,373 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TObjectLongHashMap;
++import gnu.trove.TObjectLongIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TObjectLongHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TObjectLongHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectLongHashMapDecorator<V> extends AbstractMap<V, Long> implements Map<V, Long> {
++ /**
++ * the wrapped primitive map
++ */
++ protected TObjectLongHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TObjectLongHashMapDecorator(TObjectLongHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TObjectLongHashMap<V> getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TObjectLongHashMapDecorator clone() {
++ try {
++ TObjectLongHashMapDecorator copy = (TObjectLongHashMapDecorator) super.clone();
++ copy._map = (TObjectLongHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Long put(V key, Long value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (val instanceof Long) {
++ V k = unwrapKey(key);
++ long v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Long get(Object key) {
++ V k = unwrapKey(key);
++ long v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Long remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<V,Long>> entrySet() {
++ return new AbstractSet<Map.Entry<V,Long>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TObjectLongHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TObjectLongHashMapDecorator.this.containsKey(k) &&
++ TObjectLongHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<V,Long>> iterator() {
++ return new Iterator<Map.Entry<V,Long>>() {
++ private final TObjectLongIterator<V> it = _map.iterator();
++
++ public Map.Entry<V,Long> next() {
++ it.advance();
++ final V key = wrapKey(it.key());
++ final Long v = wrapValue(it.value());
++ return new Map.Entry<V,Long>() {
++ private Long val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry &&
++ ((Map.Entry) o).getKey().equals(key) &&
++ ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public V getKey() {
++ return key;
++ }
++
++ public Long getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Long setValue(Long value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Long o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<V,Long>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TObjectLongHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends V, ? extends Long> map) {
++ Iterator<? extends Entry<? extends V,? extends Long>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends V,? extends Long> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param o key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected final V wrapKey(Object o) {
++ return (V) o;
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected final V unwrapKey(Object key) {
++ return (V) key;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Long wrapValue(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected long unwrapValue(Object value) {
++ return ((Long) value).longValue();
++ }
++
++} // TObjectLongHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TObjectShortHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,373 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TObjectShortHashMap;
++import gnu.trove.TObjectShortIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TObjectShortHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TObjectShortHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectShortHashMapDecorator<V> extends AbstractMap<V, Short> implements Map<V, Short> {
++ /**
++ * the wrapped primitive map
++ */
++ protected TObjectShortHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TObjectShortHashMapDecorator(TObjectShortHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TObjectShortHashMap<V> getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TObjectShortHashMapDecorator clone() {
++ try {
++ TObjectShortHashMapDecorator copy = (TObjectShortHashMapDecorator) super.clone();
++ copy._map = (TObjectShortHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Short put(V key, Short value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (val instanceof Short) {
++ V k = unwrapKey(key);
++ short v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Short get(Object key) {
++ V k = unwrapKey(key);
++ short v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Short remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<V,Short>> entrySet() {
++ return new AbstractSet<Map.Entry<V,Short>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TObjectShortHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TObjectShortHashMapDecorator.this.containsKey(k) &&
++ TObjectShortHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<V,Short>> iterator() {
++ return new Iterator<Map.Entry<V,Short>>() {
++ private final TObjectShortIterator<V> it = _map.iterator();
++
++ public Map.Entry<V,Short> next() {
++ it.advance();
++ final V key = wrapKey(it.key());
++ final Short v = wrapValue(it.value());
++ return new Map.Entry<V,Short>() {
++ private Short val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry &&
++ ((Map.Entry) o).getKey().equals(key) &&
++ ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public V getKey() {
++ return key;
++ }
++
++ public Short getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Short setValue(Short value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Short o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<V,Short>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TObjectShortHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends V, ? extends Short> map) {
++ Iterator<? extends Entry<? extends V,? extends Short>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends V,? extends Short> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param o key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected final V wrapKey(Object o) {
++ return (V) o;
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected final V unwrapKey(Object key) {
++ return (V) key;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Short wrapValue(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected short unwrapValue(Object value) {
++ return ((Short) value).shortValue();
++ }
++
++} // TObjectShortHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TShortByteHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TShortByteHashMap;
++import gnu.trove.TShortByteIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TShortByteHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TShortByteHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TShortByteHashMapDecorator extends AbstractMap<Short, Byte>
++ implements Map<Short, Byte>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TShortByteHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TShortByteHashMapDecorator(TShortByteHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TShortByteHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TShortByteHashMapDecorator clone() {
++ try {
++ TShortByteHashMapDecorator copy = (TShortByteHashMapDecorator) super.clone();
++ copy._map = (TShortByteHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Byte(0) if none was found.
++ */
++ public Byte put(Short key, Byte value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Short && val instanceof Byte) {
++ short k = unwrapKey(key);
++ byte v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Byte get(Short key) {
++ short k = unwrapKey(key);
++ byte v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Byte(0) if it was not found in the map
++ */
++ public Byte remove(Short key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Short,Byte>> entrySet() {
++ return new AbstractSet<Map.Entry<Short,Byte>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TShortByteHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TShortByteHashMapDecorator.this.containsKey(k)
++ && TShortByteHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Short,Byte>> iterator() {
++ return new Iterator<Map.Entry<Short,Byte>>() {
++ private final TShortByteIterator it = _map.iterator();
++
++ public Map.Entry<Short,Byte> next() {
++ it.advance();
++ final Short key = wrapKey(it.key());
++ final Byte v = wrapValue(it.value());
++ return new Map.Entry<Short,Byte>() {
++ private Byte val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Short getKey() {
++ return key;
++ }
++
++ public Byte getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Byte setValue(Byte value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Byte o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Short, Byte>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TShortByteHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Short, ? extends Byte> map) {
++ Iterator<? extends Entry<? extends Short,? extends Byte>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Short,? extends Byte> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Short wrapKey(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected short unwrapKey(Object key) {
++ return ((Short)key).shortValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Byte wrapValue(byte k) {
++ return new Byte(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected byte unwrapValue(Object value) {
++ return ((Byte)value).byteValue();
++ }
++
++} // TShortByteHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TShortDoubleHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TShortDoubleHashMap;
++import gnu.trove.TShortDoubleIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TShortDoubleHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TShortDoubleHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TShortDoubleHashMapDecorator extends AbstractMap<Short, Double>
++ implements Map<Short, Double>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TShortDoubleHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TShortDoubleHashMapDecorator(TShortDoubleHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TShortDoubleHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TShortDoubleHashMapDecorator clone() {
++ try {
++ TShortDoubleHashMapDecorator copy = (TShortDoubleHashMapDecorator) super.clone();
++ copy._map = (TShortDoubleHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Double(0) if none was found.
++ */
++ public Double put(Short key, Double value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Short && val instanceof Double) {
++ short k = unwrapKey(key);
++ double v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Double get(Short key) {
++ short k = unwrapKey(key);
++ double v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Double(0) if it was not found in the map
++ */
++ public Double remove(Short key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Short,Double>> entrySet() {
++ return new AbstractSet<Map.Entry<Short,Double>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TShortDoubleHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TShortDoubleHashMapDecorator.this.containsKey(k)
++ && TShortDoubleHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Short,Double>> iterator() {
++ return new Iterator<Map.Entry<Short,Double>>() {
++ private final TShortDoubleIterator it = _map.iterator();
++
++ public Map.Entry<Short,Double> next() {
++ it.advance();
++ final Short key = wrapKey(it.key());
++ final Double v = wrapValue(it.value());
++ return new Map.Entry<Short,Double>() {
++ private Double val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Short getKey() {
++ return key;
++ }
++
++ public Double getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Double setValue(Double value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Double o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Short, Double>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TShortDoubleHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Short, ? extends Double> map) {
++ Iterator<? extends Entry<? extends Short,? extends Double>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Short,? extends Double> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Short wrapKey(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected short unwrapKey(Object key) {
++ return ((Short)key).shortValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Double wrapValue(double k) {
++ return new Double(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected double unwrapValue(Object value) {
++ return ((Double)value).doubleValue();
++ }
++
++} // TShortDoubleHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TShortFloatHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TShortFloatHashMap;
++import gnu.trove.TShortFloatIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TShortFloatHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TShortFloatHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TShortFloatHashMapDecorator extends AbstractMap<Short, Float>
++ implements Map<Short, Float>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TShortFloatHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TShortFloatHashMapDecorator(TShortFloatHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TShortFloatHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TShortFloatHashMapDecorator clone() {
++ try {
++ TShortFloatHashMapDecorator copy = (TShortFloatHashMapDecorator) super.clone();
++ copy._map = (TShortFloatHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Float(0) if none was found.
++ */
++ public Float put(Short key, Float value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Short && val instanceof Float) {
++ short k = unwrapKey(key);
++ float v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Float get(Short key) {
++ short k = unwrapKey(key);
++ float v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Float(0) if it was not found in the map
++ */
++ public Float remove(Short key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Short,Float>> entrySet() {
++ return new AbstractSet<Map.Entry<Short,Float>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TShortFloatHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TShortFloatHashMapDecorator.this.containsKey(k)
++ && TShortFloatHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Short,Float>> iterator() {
++ return new Iterator<Map.Entry<Short,Float>>() {
++ private final TShortFloatIterator it = _map.iterator();
++
++ public Map.Entry<Short,Float> next() {
++ it.advance();
++ final Short key = wrapKey(it.key());
++ final Float v = wrapValue(it.value());
++ return new Map.Entry<Short,Float>() {
++ private Float val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Short getKey() {
++ return key;
++ }
++
++ public Float getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Float setValue(Float value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Float o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Short, Float>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TShortFloatHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Short, ? extends Float> map) {
++ Iterator<? extends Entry<? extends Short,? extends Float>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Short,? extends Float> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Short wrapKey(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected short unwrapKey(Object key) {
++ return ((Short)key).shortValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Float wrapValue(float k) {
++ return new Float(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected float unwrapValue(Object value) {
++ return ((Float)value).floatValue();
++ }
++
++} // TShortFloatHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TShortHashSetDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,209 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TShortHashSet;
++import gnu.trove.TShortIterator;
++
++import java.util.AbstractSet;
++import java.util.Iterator;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TShortHashSet conform to the <tt>java.util.Set</tt> API.
++ * This class simply decorates an underlying TShortHashSet and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Tue Sep 24 22:08:17 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TShortHashSetDecorator extends AbstractSet<Short> implements Set<Short> {
++ /** the wrapped primitive set */
++ protected TShortHashSet _set;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive set.
++ */
++ public TShortHashSetDecorator(TShortHashSet set) {
++ super();
++ this._set = set;
++ }
++
++
++ /**
++ * Returns a reference to the set wrapped by this decorator.
++ */
++ public TShortHashSet getSet() {
++ return _set;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TShortHashSetDecorator clone() {
++ try {
++ TShortHashSetDecorator copy = (TShortHashSetDecorator) super.clone();
++ copy._set = (TShortHashSet) _set.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable
++ }
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param value true if the set was modified by the insertion
++ */
++ public boolean add(Short value) {
++ return _set.add(unwrap(value));
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the sets are identical
++ */
++ public boolean equals(Object other) {
++ if (_set.equals(other)) {
++ return true; // comparing two trove sets
++ } else if (other instanceof Set) {
++ Set that = (Set) other;
++ if (that.size() != _set.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Object val = it.next();
++ if (val instanceof Short) {
++ short v = unwrap(val);
++ if (_set.contains(v)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other set
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ this._set.clear();
++ }
++
++ /**
++ * Deletes a value from the set.
++ *
++ * @param value an <code>Object</code> value
++ * @return true if the set was modified
++ */
++ public boolean remove(Object value) {
++ return _set.remove(unwrap(value));
++ }
++
++ /**
++ * Creates an iterator over the values of the set.
++ *
++ * @return an iterator with support for removals in the underlying set
++ */
++ public Iterator<Short> iterator() {
++ return new Iterator<Short>() {
++ private final TShortIterator it = _set.iterator();
++
++ public Short next() {
++ return wrap(it.next());
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ /**
++ * Returns the number of entries in the set.
++ *
++ * @return the set's size.
++ */
++ public int size() {
++ return this._set.size();
++ }
++
++ /**
++ * Indicates whether set has any entries.
++ *
++ * @return true if the set is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying set
++ * @return an Object representation of the value
++ */
++ protected Short wrap(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected short unwrap(Object value) {
++ return ((Short) value).shortValue();
++ }
++} // TShortHashSetDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TShortIntHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TShortIntHashMap;
++import gnu.trove.TShortIntIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TShortIntHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TShortIntHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TShortIntHashMapDecorator extends AbstractMap<Short, Integer>
++ implements Map<Short, Integer>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TShortIntHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TShortIntHashMapDecorator(TShortIntHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TShortIntHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TShortIntHashMapDecorator clone() {
++ try {
++ TShortIntHashMapDecorator copy = (TShortIntHashMapDecorator) super.clone();
++ copy._map = (TShortIntHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public Integer put(Short key, Integer value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Short && val instanceof Integer) {
++ short k = unwrapKey(key);
++ int v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Integer get(Short key) {
++ short k = unwrapKey(key);
++ int v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public Integer remove(Short key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Short,Integer>> entrySet() {
++ return new AbstractSet<Map.Entry<Short,Integer>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TShortIntHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TShortIntHashMapDecorator.this.containsKey(k)
++ && TShortIntHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Short,Integer>> iterator() {
++ return new Iterator<Map.Entry<Short,Integer>>() {
++ private final TShortIntIterator it = _map.iterator();
++
++ public Map.Entry<Short,Integer> next() {
++ it.advance();
++ final Short key = wrapKey(it.key());
++ final Integer v = wrapValue(it.value());
++ return new Map.Entry<Short,Integer>() {
++ private Integer val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Short getKey() {
++ return key;
++ }
++
++ public Integer getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Integer setValue(Integer value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Integer o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Short, Integer>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TShortIntHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Short, ? extends Integer> map) {
++ Iterator<? extends Entry<? extends Short,? extends Integer>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Short,? extends Integer> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Short wrapKey(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected short unwrapKey(Object key) {
++ return ((Short)key).shortValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Integer wrapValue(int k) {
++ return new Integer(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected int unwrapValue(Object value) {
++ return ((Integer)value).intValue();
++ }
++
++} // TShortIntHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TShortLongHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TShortLongHashMap;
++import gnu.trove.TShortLongIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TShortLongHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TShortLongHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TShortLongHashMapDecorator extends AbstractMap<Short, Long>
++ implements Map<Short, Long>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TShortLongHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TShortLongHashMapDecorator(TShortLongHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TShortLongHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TShortLongHashMapDecorator clone() {
++ try {
++ TShortLongHashMapDecorator copy = (TShortLongHashMapDecorator) super.clone();
++ copy._map = (TShortLongHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Long(0) if none was found.
++ */
++ public Long put(Short key, Long value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Short && val instanceof Long) {
++ short k = unwrapKey(key);
++ long v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Long get(Short key) {
++ short k = unwrapKey(key);
++ long v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Long(0) if it was not found in the map
++ */
++ public Long remove(Short key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Short,Long>> entrySet() {
++ return new AbstractSet<Map.Entry<Short,Long>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TShortLongHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TShortLongHashMapDecorator.this.containsKey(k)
++ && TShortLongHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Short,Long>> iterator() {
++ return new Iterator<Map.Entry<Short,Long>>() {
++ private final TShortLongIterator it = _map.iterator();
++
++ public Map.Entry<Short,Long> next() {
++ it.advance();
++ final Short key = wrapKey(it.key());
++ final Long v = wrapValue(it.value());
++ return new Map.Entry<Short,Long>() {
++ private Long val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Short getKey() {
++ return key;
++ }
++
++ public Long getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Long setValue(Long value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Long o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Short, Long>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TShortLongHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Short, ? extends Long> map) {
++ Iterator<? extends Entry<? extends Short,? extends Long>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Short,? extends Long> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Short wrapKey(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected short unwrapKey(Object key) {
++ return ((Short)key).shortValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Long wrapValue(long k) {
++ return new Long(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected long unwrapValue(Object value) {
++ return ((Long)value).longValue();
++ }
++
++} // TShortLongHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TShortObjectHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,365 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TShortObjectHashMap;
++import gnu.trove.TShortObjectIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TShortObjectHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TShortObjectHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ */
++public class TShortObjectHashMapDecorator<V> extends AbstractMap<Short, V>
++ implements Map<Short, V>, Cloneable {
++
++ /**
++ * the wrapped primitive map
++ */
++ protected TShortObjectHashMap<V> _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TShortObjectHashMapDecorator(TShortObjectHashMap<V> map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TShortObjectHashMap<V> getMap() {
++ return _map;
++ }
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TShortObjectHashMapDecorator clone() {
++ try {
++ TShortObjectHashMapDecorator copy = (TShortObjectHashMapDecorator) super.clone();
++ copy._map = (TShortObjectHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Integer(0) if none was found.
++ */
++ public V put(Short key, V value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Short) {
++ short k = unwrapKey(key);
++ Object v = unwrapValue((V) val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public V get(Object key) {
++ return _map.get(unwrapKey(key));
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Integer(0) if it was not found in the map
++ */
++ public V remove(Object key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Short,V>> entrySet() {
++ return new AbstractSet<Map.Entry<Short,V>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TShortObjectHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TShortObjectHashMapDecorator.this.containsKey(k) &&
++ TShortObjectHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Short,V>> iterator() {
++ return new Iterator<Map.Entry<Short,V>>() {
++ private final TShortObjectIterator<V> it = _map.iterator();
++
++ public Map.Entry<Short,V> next() {
++ it.advance();
++ final Short key = wrapKey(it.key());
++ final V v = wrapValue(it.value());
++ return new Map.Entry<Short,V>() {
++ private V val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Short getKey() {
++ return key;
++ }
++
++ public V getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public V setValue(V value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Map.Entry<Short,V> o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Short,V>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TShortObjectHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue((V) val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Short, ? extends V> map) {
++ Iterator<? extends Entry<? extends Short,? extends V>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Short,? extends V> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Short wrapKey(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected short unwrapKey(Object key) {
++ return ((Short)key).shortValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param o value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected final V wrapValue(V o) {
++ return o;
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected final V unwrapValue(V value) {
++ return value;
++ }
++
++} // TShortObjectHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/decorator/TShortShortHashMapDecorator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,374 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove.decorator;
++
++import gnu.trove.TShortShortHashMap;
++import gnu.trove.TShortShortIterator;
++
++import java.util.AbstractMap;
++import java.util.AbstractSet;
++import java.util.Collection;
++import java.util.Iterator;
++import java.util.Map.Entry;
++import java.util.Map;
++import java.util.Set;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Wrapper class to make a TShortShortHashMap conform to the <tt>java.util.Map</tt> API.
++ * This class simply decorates an underlying TShortShortHashMap and translates the Object-based
++ * APIs into their Trove primitive analogs.
++ * <p/>
++ * <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>
++ * <p/>
++ * Created: Mon Sep 23 22:07:40 PDT 2002
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++public class TShortShortHashMapDecorator extends AbstractMap<Short, Short>
++ implements Map<Short, Short>, Cloneable {
++
++ /** the wrapped primitive map */
++ protected TShortShortHashMap _map;
++
++ /**
++ * Creates a wrapper that decorates the specified primitive map.
++ */
++ public TShortShortHashMapDecorator(TShortShortHashMap map) {
++ super();
++ this._map = map;
++ }
++
++
++ /**
++ * Returns a reference to the map wrapped by this decorator.
++ */
++ public TShortShortHashMap getMap() {
++ return _map;
++ }
++
++
++ /**
++ * Clones the underlying trove collection and returns the clone wrapped in a new
++ * decorator instance. This is a shallow clone except where primitives are
++ * concerned.
++ *
++ * @return a copy of the receiver
++ */
++ public TShortShortHashMapDecorator clone() {
++ try {
++ TShortShortHashMapDecorator copy = (TShortShortHashMapDecorator) super.clone();
++ copy._map = (TShortShortHashMap)_map.clone();
++ return copy;
++ } catch (CloneNotSupportedException e) {
++ // assert(false);
++ throw new InternalError(); // we are cloneable, so this does not happen
++ }
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or Short(0) if none was found.
++ */
++ public Short put(Short key, Short value) {
++ return wrapValue(_map.put(unwrapKey(key), unwrapValue(value)));
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return true if the maps are identical
++ */
++ public boolean equals(Object other) {
++ if (_map.equals(other)) {
++ return true; // comparing two trove maps
++ } else if (other instanceof Map) {
++ Map that = (Map) other;
++ if (that.size() != _map.size()) {
++ return false; // different sizes, no need to compare
++ } else { // now we have to do it the hard way
++ Iterator it = that.entrySet().iterator();
++ for (int i = that.size(); i-- > 0;) {
++ Map.Entry e = (Map.Entry) it.next();
++ Object key = e.getKey();
++ Object val = e.getValue();
++ if (key instanceof Short && val instanceof Short) {
++ short k = unwrapKey(key);
++ short v = unwrapValue(val);
++ if (_map.containsKey(k) && v == _map.get(k)) {
++ // match, ok to continue
++ } else {
++ return false; // no match: we're done
++ }
++ } else {
++ return false; // different type in other map
++ }
++ }
++ return true; // all entries match
++ }
++ } else {
++ return false;
++ }
++ }
++
++ /**
++ * Retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or null if no such mapping exists.
++ */
++ public Short get(Short key) {
++ short k = unwrapKey(key);
++ short v = _map.get(k);
++ // 0 may be a false positive since primitive maps
++ // cannot return null, so we have to do an extra
++ // check here.
++ if (v == 0) {
++ return _map.containsKey(k) ? wrapValue(v) : null;
++ } else {
++ return wrapValue(v);
++ }
++ }
++
++
++ /**
++ * Empties the map.
++ */
++ public void clear() {
++ this._map.clear();
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return the removed value, or Short(0) if it was not found in the map
++ */
++ public Short remove(Short key) {
++ return wrapValue(_map.remove(unwrapKey(key)));
++ }
++
++ /**
++ * Returns a Set view on the entries of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Set<Map.Entry<Short,Short>> entrySet() {
++ return new AbstractSet<Map.Entry<Short,Short>>() {
++ public int size() {
++ return _map.size();
++ }
++
++ public boolean isEmpty() {
++ return TShortShortHashMapDecorator.this.isEmpty();
++ }
++
++ public boolean contains(Object o) {
++ if (o instanceof Map.Entry) {
++ Object k = ((Map.Entry) o).getKey();
++ Object v = ((Map.Entry) o).getValue();
++ return TShortShortHashMapDecorator.this.containsKey(k)
++ && TShortShortHashMapDecorator.this.get(k).equals(v);
++ } else {
++ return false;
++ }
++ }
++
++ public Iterator<Map.Entry<Short,Short>> iterator() {
++ return new Iterator<Map.Entry<Short,Short>>() {
++ private final TShortShortIterator it = _map.iterator();
++
++ public Map.Entry<Short,Short> next() {
++ it.advance();
++ final Short key = wrapKey(it.key());
++ final Short v = wrapValue(it.value());
++ return new Map.Entry<Short,Short>() {
++ private Short val = v;
++
++ public boolean equals(Object o) {
++ return o instanceof Map.Entry
++ && ((Map.Entry) o).getKey().equals(key)
++ && ((Map.Entry) o).getValue().equals(val);
++ }
++
++ public Short getKey() {
++ return key;
++ }
++
++ public Short getValue() {
++ return val;
++ }
++
++ public int hashCode() {
++ return key.hashCode() + val.hashCode();
++ }
++
++ public Short setValue(Short value) {
++ val = value;
++ return put(key, value);
++ }
++ };
++ }
++
++ public boolean hasNext() {
++ return it.hasNext();
++ }
++
++ public void remove() {
++ it.remove();
++ }
++ };
++ }
++
++ public boolean add(Short o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean remove(Object o) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean addAll(Collection<? extends Map.Entry<Short, Short>> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean retainAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public boolean removeAll(Collection<?> c) {
++ throw new UnsupportedOperationException();
++ }
++
++ public void clear() {
++ TShortShortHashMapDecorator.this.clear();
++ }
++ };
++ }
++
++ /**
++ * Checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(Object val) {
++ return _map.containsValue(unwrapValue(val));
++ }
++
++ /**
++ * Checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(Object key) {
++ return _map.containsKey(unwrapKey(key));
++ }
++
++ /**
++ * Returns the number of entries in the map.
++ *
++ * @return the map's size.
++ */
++ public int size() {
++ return this._map.size();
++ }
++
++ /**
++ * Indicates whether map has any entries.
++ *
++ * @return true if the map is empty
++ */
++ public boolean isEmpty() {
++ return size() == 0;
++ }
++
++ /**
++ * Copies the key/value mappings in <tt>map</tt> into this map.
++ * Note that this will be a <b>deep</b> copy, as storage is by
++ * primitive value.
++ *
++ * @param map a <code>Map</code> value
++ */
++ public void putAll(Map<? extends Short, ? extends Short> map) {
++ Iterator<? extends Entry<? extends Short,? extends Short>> it = map.entrySet().iterator();
++ for (int i = map.size(); i-- > 0;) {
++ Entry<? extends Short,? extends Short> e = it.next();
++ this.put(e.getKey(), e.getValue());
++ }
++ }
++
++ /**
++ * Wraps a key
++ *
++ * @param k key in the underlying map
++ * @return an Object representation of the key
++ */
++ protected Short wrapKey(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a key
++ *
++ * @param key wrapped key
++ * @return an unwrapped representation of the key
++ */
++ protected short unwrapKey(Object key) {
++ return ((Short)key).shortValue();
++ }
++
++ /**
++ * Wraps a value
++ *
++ * @param k value in the underlying map
++ * @return an Object representation of the value
++ */
++ protected Short wrapValue(short k) {
++ return new Short(k);
++ }
++
++ /**
++ * Unwraps a value
++ *
++ * @param value wrapped value
++ * @return an unwrapped representation of the value
++ */
++ protected short unwrapValue(Object value) {
++ return ((Short)value).shortValue();
++ }
++
++} // TShortShortHashMapDecorator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteArrayList.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,905 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Externalizable;
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.util.Arrays;
++import java.util.Random;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * A resizable, array-backed list of byte primitives.
++ *
++ * Created: Sat Dec 29 14:21:12 2001
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TByteArrayList implements Externalizable, Cloneable {
++ static final long serialVersionUID = 1L;
++
++ /** the data of the list */
++ protected byte[] _data;
++
++ /** the index after the last entry in the list */
++ protected int _pos;
++
++ /** the default capacity for new lists */
++ protected static final int DEFAULT_CAPACITY = 10;
++
++ /**
++ * Creates a new <code>TByteArrayList</code> instance with the
++ * default capacity.
++ */
++ public TByteArrayList() {
++ this(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Creates a new <code>TByteArrayList</code> instance with the
++ * specified capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public TByteArrayList(int capacity) {
++ _data = new byte[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Creates a new <code>TByteArrayList</code> instance whose
++ * capacity is the greater of the length of <tt>values</tt> and
++ * DEFAULT_CAPACITY and whose initial contents are the specified
++ * values.
++ *
++ * @param values an <code>byte[]</code> value
++ */
++ public TByteArrayList(byte[] values) {
++ this(Math.max(values.length, DEFAULT_CAPACITY));
++ add(values);
++ }
++
++ // sizing
++
++ /**
++ * Grow the internal array as needed to accomodate the specified
++ * number of elements. The size of the array bytes on each
++ * resize unless <tt>capacity</tt> requires more than twice the
++ * current capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void ensureCapacity(int capacity) {
++ if (capacity > _data.length) {
++ int newCap = Math.max(_data.length << 1, capacity);
++ byte[] tmp = new byte[newCap];
++ System.arraycopy(_data, 0, tmp, 0, _data.length);
++ _data = tmp;
++ }
++ }
++
++ /**
++ * Returns the number of values in the list.
++ *
++ * @return the number of values in the list.
++ */
++ public int size() {
++ return _pos;
++ }
++
++ /**
++ * Tests whether this list contains any values.
++ *
++ * @return true if the list is empty.
++ */
++ public boolean isEmpty() {
++ return _pos == 0;
++ }
++
++ /**
++ * Sheds any excess capacity above and beyond the current size of
++ * the list.
++ */
++ public void trimToSize() {
++ if (_data.length > size()) {
++ byte[] tmp = new byte[size()];
++ toNativeArray(tmp, 0, tmp.length);
++ _data = tmp;
++ }
++ }
++
++ // modifying
++
++ /**
++ * Adds <tt>val</tt> to the end of the list, growing as needed.
++ *
++ * @param val an <code>byte</code> value
++ */
++ public void add(byte val) {
++ ensureCapacity(_pos + 1);
++ _data[_pos++] = val;
++ }
++
++ /**
++ * Adds the values in the array <tt>vals</tt> to the end of the
++ * list, in order.
++ *
++ * @param vals an <code>byte[]</code> value
++ */
++ public void add(byte[] vals) {
++ add(vals, 0, vals.length);
++ }
++
++ /**
++ * Adds a subset of the values in the array <tt>vals</tt> to the
++ * end of the list, in order.
++ *
++ * @param vals an <code>byte[]</code> value
++ * @param offset the offset at which to start copying
++ * @param length the number of values to copy.
++ */
++ public void add(byte[] vals, int offset, int length) {
++ ensureCapacity(_pos + length);
++ System.arraycopy(vals, offset, _data, _pos, length);
++ _pos += length;
++ }
++
++ /**
++ * Inserts <tt>value</tt> into the list at <tt>offset</tt>. All
++ * values including and to the right of <tt>offset</tt> are shifted
++ * to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param value an <code>byte</code> value
++ */
++ public void insert(int offset, byte value) {
++ if (offset == _pos) {
++ add(value);
++ return;
++ }
++ ensureCapacity(_pos + 1);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + 1, _pos - offset);
++ // insert
++ _data[offset] = value;
++ _pos++;
++ }
++
++ /**
++ * Inserts the array of <tt>values</tt> into the list at
++ * <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>byte[]</code> value
++ */
++ public void insert(int offset, byte[] values) {
++ insert(offset, values, 0, values.length);
++ }
++
++ /**
++ * Inserts a slice of the array of <tt>values</tt> into the list
++ * at <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>byte[]</code> value
++ * @param valOffset the offset in the values array at which to
++ * start copying.
++ * @param len the number of values to copy from the values array
++ */
++ public void insert(int offset, byte[] values, int valOffset, int len) {
++ if (offset == _pos) {
++ add(values, valOffset, len);
++ return;
++ }
++
++ ensureCapacity(_pos + len);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + len, _pos - offset);
++ // insert
++ System.arraycopy(values, valOffset, _data, offset, len);
++ _pos += len;
++ }
++
++ /**
++ * Returns the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>byte</code> value
++ */
++ public byte get(int offset) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ return _data[offset];
++ }
++
++ /**
++ * Returns the value at the specified offset without doing any
++ * bounds checking.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>byte</code> value
++ */
++ public byte getQuick(int offset) {
++ return _data[offset];
++ }
++
++ /**
++ * Sets the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>byte</code> value
++ */
++ public void set(int offset, byte val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ _data[offset] = val;
++ }
++
++ /**
++ * Sets the value at the specified offset and returns the
++ * previously stored value.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>byte</code> value
++ * @return the value previously stored at offset.
++ */
++ public byte getSet(int offset, byte val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ byte old = _data[offset];
++ _data[offset] = val;
++ return old;
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * the contents of the <tt>values</tt> array.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ */
++ public void set(int offset, byte[] values) {
++ set(offset, values, 0, values.length);
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * <tt>length</tt> values from the <tt>values</tt> array, starting
++ * at valOffset.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ * @param valOffset the first value to copy from the values array
++ * @param length the number of values to copy
++ */
++ public void set(int offset, byte[] values, int valOffset, int length) {
++ if (offset < 0 || offset + length > _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(values, valOffset, _data, offset, length);
++ }
++
++ /**
++ * Sets the value at the specified offset without doing any bounds
++ * checking.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>byte</code> value
++ */
++ public void setQuick(int offset, byte val) {
++ _data[offset] = val;
++ }
++
++ /**
++ * Flushes the internal state of the list, resetting the capacity
++ * to the default.
++ */
++ public void clear() {
++ clear(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Flushes the internal state of the list, setting the capacity of
++ * the empty list to <tt>capacity</tt>.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void clear(int capacity) {
++ _data = new byte[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list without
++ * allocating new backing arrays.
++ *
++ * @see #clear
++ */
++ public void reset() {
++ _pos = 0;
++ fill((byte)0);
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list
++ * without allocating new backing arrays. This method differs
++ * from {@link #reset reset} in that it does not clear the old
++ * values in the backing array. Thus, it is possible for {@link
++ * #getQuick getQuick} to return stale data if this method is used
++ * and the caller is careless about bounds checking.
++ *
++ * @see #reset
++ * @see #clear
++ * @see #getQuick
++ */
++ public void resetQuick() {
++ _pos = 0;
++ }
++
++ /**
++ * Removes the value at <tt>offset</tt> from the list.
++ *
++ * @param offset an <code>int</code> value
++ * @return the value previously stored at offset.
++ */
++ public byte remove(int offset) {
++ byte old = get(offset);
++ remove(offset, 1);
++ return old;
++ }
++
++ /**
++ * Removes <tt>length</tt> values from the list, starting at
++ * <tt>offset</tt>
++ *
++ * @param offset an <code>int</code> value
++ * @param length an <code>int</code> value
++ */
++ public void remove(int offset, int length) {
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++
++ if (offset == 0) {
++ // data at the front
++ System.arraycopy(_data, length, _data, 0, _pos - length);
++ } else if (_pos - length == offset) {
++ // no copy to make, decrementing pos "deletes" values at
++ // the end
++ } else {
++ // data in the middle
++ System.arraycopy(_data, offset + length,
++ _data, offset, _pos - (offset + length));
++ }
++ _pos -= length;
++ // no need to clear old values beyond _pos, because this is a
++ // primitive collection and 0 takes as much room as any other
++ // value
++ }
++
++ /**
++ * Transform each value in the list using the specified function.
++ *
++ * @param function a <code>TByteFunction</code> value
++ */
++ public void transformValues(TByteFunction function) {
++ for (int i = _pos; i-- > 0;) {
++ _data[i] = function.execute(_data[i]);
++ }
++ }
++
++ /**
++ * Reverse the order of the elements in the list.
++ */
++ public void reverse() {
++ reverse(0, _pos);
++ }
++
++ /**
++ * Reverse the order of the elements in the range of the list.
++ *
++ * @param from the inclusive index at which to start reversing
++ * @param to the exclusive index at which to stop reversing
++ */
++ public void reverse(int from, int to) {
++ if (from == to) {
++ return; // nothing to do
++ }
++ if (from > to) {
++ throw new IllegalArgumentException("from cannot be greater than to");
++ }
++ for (int i = from, j = to - 1; i < j; i++, j--) {
++ swap(i, j);
++ }
++ }
++
++ /**
++ * Shuffle the elements of the list using the specified random
++ * number generator.
++ *
++ * @param rand a <code>Random</code> value
++ */
++ public void shuffle(Random rand) {
++ for (int i = _pos; i-- > 1;) {
++ swap(i, rand.nextInt(i));
++ }
++ }
++
++ /**
++ * Swap the values at offsets <tt>i</tt> and <tt>j</tt>.
++ *
++ * @param i an offset into the data array
++ * @param j an offset into the data array
++ */
++ private final void swap(int i, int j) {
++ byte tmp = _data[i];
++ _data[i] = _data[j];
++ _data[j] = tmp;
++ }
++
++ // copying
++
++ /**
++ * Returns a clone of this list. Since this is a primitive
++ * collection, this will be a deep clone.
++ *
++ * @return a deep clone of the list.
++ */
++ public Object clone() {
++ TByteArrayList list = null;
++ try {
++ list = (TByteArrayList) super.clone();
++ list._data = toNativeArray();
++ } catch (CloneNotSupportedException e) {
++ // it's supported
++ } // end of try-catch
++ return list;
++ }
++
++ /**
++ * Copies the contents of the list into a native array.
++ *
++ * @return an <code>byte[]</code> value
++ */
++ public byte[] toNativeArray() {
++ return toNativeArray(0, _pos);
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param offset the offset at which to start copying
++ * @param len the number of values to copy.
++ * @return an <code>byte[]</code> value
++ */
++ public byte[] toNativeArray(int offset, int len) {
++ byte[] rv = new byte[len];
++ toNativeArray(rv, offset, len);
++ return rv;
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param dest the array to copy into.
++ * @param offset the offset of the first value to copy
++ * @param len the number of values to copy.
++ */
++ public void toNativeArray(byte[] dest, int offset, int len) {
++ if (len == 0) {
++ return; // nothing to copy
++ }
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(_data, offset, dest, 0, len);
++ }
++
++ // comparing
++
++ /**
++ * Compares this list to another list, value by value.
++ *
++ * @param other the object to compare against
++ * @return true if other is a TByteArrayList and has exactly the
++ * same values.
++ */
++ public boolean equals(Object other) {
++ if (other == this) {
++ return true;
++ } else if (other instanceof TByteArrayList) {
++ TByteArrayList that = (TByteArrayList)other;
++ if (that.size() != this.size()) {
++ return false;
++ } else {
++ for (int i = _pos; i-- > 0;) {
++ if (this._data[i] != that._data[i]) {
++ return false;
++ }
++ }
++ return true;
++ }
++ } else {
++ return false;
++ }
++ }
++
++ public int hashCode() {
++ int h = 0;
++ for (int i = _pos; i-- > 0;) {
++ h += HashFunctions.hash(_data[i]);
++ }
++ return h;
++ }
++
++ // procedures
++
++ /**
++ * Applies the procedure to each value in the list in ascending
++ * (front to back) order.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEach(TByteProcedure procedure) {
++ for (int i = 0; i < _pos; i++) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Applies the procedure to each value in the list in descending
++ * (back to front) order.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEachDescending(TByteProcedure procedure) {
++ for (int i = _pos; i-- > 0;) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ // sorting
++
++ /**
++ * Sort the values in the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @see java.util.Arrays#sort
++ */
++ public void sort() {
++ Arrays.sort(_data, 0, _pos);
++ }
++
++ /**
++ * Sort a slice of the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @param fromIndex the index at which to start sorting (inclusive)
++ * @param toIndex the index at which to stop sorting (exclusive)
++ * @see java.util.Arrays#sort
++ */
++ public void sort(int fromIndex, int toIndex) {
++ Arrays.sort(_data, fromIndex, toIndex);
++ }
++
++ // filling
++
++ /**
++ * Fills every slot in the list with the specified value.
++ *
++ * @param val the value to use when filling
++ */
++ public void fill(byte val) {
++ Arrays.fill(_data, 0, _pos, val);
++ }
++
++ /**
++ * Fills a range in the list with the specified value.
++ *
++ * @param fromIndex the offset at which to start filling (inclusive)
++ * @param toIndex the offset at which to stop filling (exclusive)
++ * @param val the value to use when filling
++ */
++ public void fill(int fromIndex, int toIndex, byte val) {
++ if (toIndex > _pos) {
++ ensureCapacity(toIndex);
++ _pos = toIndex;
++ }
++ Arrays.fill(_data, fromIndex, toIndex, val);
++ }
++
++ // searching
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the entire list.
++ * Note that you <b>must</b> @{link #sort sort} the list before
++ * doing a search.
++ *
++ * @param value the value to search for
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(byte value) {
++ return binarySearch(value, 0, _pos);
++ }
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the specified
++ * range. Note that you <b>must</b> @{link #sort sort} the list
++ * or the range before doing a search.
++ *
++ * @param value the value to search for
++ * @param fromIndex the lower boundary of the range (inclusive)
++ * @param toIndex the upper boundary of the range (exclusive)
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(byte value, int fromIndex, int toIndex) {
++ if (fromIndex < 0) {
++ throw new ArrayIndexOutOfBoundsException(fromIndex);
++ }
++ if (toIndex > _pos) {
++ throw new ArrayIndexOutOfBoundsException(toIndex);
++ }
++
++ int low = fromIndex;
++ int high = toIndex - 1;
++
++ while (low <= high) {
++ int mid = (low + high) >> 1;
++ byte midVal = _data[mid];
++
++ if (midVal < value) {
++ low = mid + 1;
++ } else if (midVal > value) {
++ high = mid - 1;
++ } else {
++ return mid; // value found
++ }
++ }
++ return -(low + 1); // value not found.
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>byte</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(byte value) {
++ return indexOf(0, value);
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (inclusive)
++ * @param value an <code>byte</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(int offset, byte value) {
++ for (int i = offset; i < _pos; i++) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>byte</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(byte value) {
++ return lastIndexOf(_pos, value);
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (exclusive)
++ * @param value an <code>byte</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(int offset, byte value) {
++ for (int i = offset; i-- > 0;) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list for <tt>value</tt>
++ *
++ * @param value an <code>byte</code> value
++ * @return true if value is in the list.
++ */
++ public boolean contains(byte value) {
++ return lastIndexOf(value) >= 0;
++ }
++
++ /**
++ * Searches the list for values satisfying <tt>condition</tt> in
++ * the manner of the *nix <tt>grep</tt> utility.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which match the condition.
++ */
++ public TByteArrayList grep(TByteProcedure condition) {
++ TByteArrayList list = new TByteArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Searches the list for values which do <b>not</b> satisfy
++ * <tt>condition</tt>. This is akin to *nix <code>grep -v</code>.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which do not match the condition.
++ */
++ public TByteArrayList inverseGrep(TByteProcedure condition) {
++ TByteArrayList list = new TByteArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (! condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Finds the maximum value in the list.
++ *
++ * @return the largest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public byte max() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find maximum of an empty list");
++ }
++ byte max = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > max ) {
++ max = _data[_pos];
++ }
++ }
++ return max;
++ }
++
++ /**
++ * Finds the minimum value in the list.
++ *
++ * @return the smallest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public byte min() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find minimum of an empty list");
++ }
++ byte min = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > min ) {
++ min = _data[_pos];
++ }
++ }
++ return min;
++ }
++
++ // stringification
++
++ /**
++ * Returns a String representation of the list, front to back.
++ *
++ * @return a <code>String</code> value
++ */
++ public String toString() {
++ final StringBuffer buf = new StringBuffer("{");
++ for (int i = 0, end = _pos - 1; i < end; i++) {
++ buf.append(_data[i]);
++ buf.append(", ");
++ }
++ if (size() > 0) {
++ buf.append(_data[_pos - 1]);
++ }
++ buf.append("}");
++ return buf.toString();
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // POSITION
++ out.writeInt( _pos );
++
++ // ENTRIES
++ int len = _data.length;
++ out.writeInt( len );
++ for( int i = 0; i < len; i++ ) {
++ out.writeByte( _data[ i ] );
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // POSITION
++ _pos = in.readInt();
++
++ // ENTRIES
++ int len = in.readInt();
++ _data = new byte[ len ];
++ for( int i = 0; i < len; i++ ) {
++ _data[ i ] = in.readByte();
++ }
++ }
++} // TByteArrayList
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteByteHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for byte keys and byte values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TByteByteHashMap extends TByteHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient byte[] _values;
++
++ /**
++ * Creates a new <code>TByteByteHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TByteByteHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TByteByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TByteByteHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TByteByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TByteByteHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TByteByteHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteByteHashMap(TByteHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteByteHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteByteHashMap(int initialCapacity, TByteHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteByteHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteByteHashMap(int initialCapacity, float loadFactor, TByteHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TByteByteHashMap m = (TByteByteHashMap)super.clone();
++ m._values = (byte[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TByteByteIterator with access to this map's keys and values
++ */
++ public TByteByteIterator iterator() {
++ return new TByteByteIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new byte[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>byte</code> value
++ * @param value an <code>byte</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (byte)0 if none was found.
++ */
++ public byte put(byte key, byte value) {
++ byte previousState;
++ byte previous = (byte)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ byte oldKeys[] = _set;
++ byte oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new byte[newCapacity];
++ _values = new byte[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ byte o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>byte</code> value
++ * @return the value of <tt>key</tt> or (byte)0 if no such mapping exists.
++ */
++ public byte get(byte key) {
++ int index = index(key);
++ return index < 0 ? (byte)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ byte[] keys = _set;
++ byte[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (byte)0;
++ vals[i] = (byte)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return an <code>byte</code> value, or (byte)0 if no mapping for key exists
++ */
++ public byte remove(byte key) {
++ byte prev = (byte)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TByteByteHashMap)) {
++ return false;
++ }
++ TByteByteHashMap that = (TByteByteHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TByteByteProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(byte key, byte value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TByteByteProcedure {
++ private final TByteByteHashMap _otherMap;
++
++ EqProcedure(TByteByteHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(byte key, byte value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two bytes for equality.
++ */
++ private final boolean eq(byte v1, byte v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (byte)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public byte[] getValues() {
++ byte[] vals = new byte[size()];
++ byte[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public byte[] keys() {
++ byte[] keys = new byte[size()];
++ byte[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(byte val) {
++ byte[] states = _states;
++ byte[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(byte key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TByteProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TByteProcedure procedure) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOByteByteProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TByteByteProcedure procedure) {
++ byte[] states = _states;
++ byte[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TByteByteProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ byte[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TByteFunction</code> value
++ */
++ public void transformValues(TByteFunction function) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(byte key) {
++ return adjustValue(key, (byte)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(byte key, byte amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ byte key = in.readByte();
++ byte val = in.readByte();
++ put(key, val);
++ }
++ }
++} // TByteByteHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteByteIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type byte and byte.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TByteByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TByteByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TByteByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TByteByteIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TByteByteIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TByteByteHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TByteByteIterator(TByteByteHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public byte key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public byte value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public byte setValue(byte val) {
++ byte old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TByteByteIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteByteProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type byte and byte.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteByteProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>byte</code> value
++ * @param b a <code>byte</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(byte a, byte b);
++}// TByteByteProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteDoubleHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for byte keys and double values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TByteDoubleHashMap extends TByteHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient double[] _values;
++
++ /**
++ * Creates a new <code>TByteDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TByteDoubleHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TByteDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TByteDoubleHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TByteDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TByteDoubleHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TByteDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteDoubleHashMap(TByteHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteDoubleHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteDoubleHashMap(int initialCapacity, TByteHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteDoubleHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteDoubleHashMap(int initialCapacity, float loadFactor, TByteHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TByteDoubleHashMap m = (TByteDoubleHashMap)super.clone();
++ m._values = (double[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TByteDoubleIterator with access to this map's keys and values
++ */
++ public TByteDoubleIterator iterator() {
++ return new TByteDoubleIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new double[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>byte</code> value
++ * @param value an <code>double</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (byte)0 if none was found.
++ */
++ public double put(byte key, double value) {
++ byte previousState;
++ double previous = (double)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ byte oldKeys[] = _set;
++ double oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new byte[newCapacity];
++ _values = new double[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ byte o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>byte</code> value
++ * @return the value of <tt>key</tt> or (byte)0 if no such mapping exists.
++ */
++ public double get(byte key) {
++ int index = index(key);
++ return index < 0 ? (double)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ byte[] keys = _set;
++ double[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (byte)0;
++ vals[i] = (double)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return an <code>double</code> value, or (byte)0 if no mapping for key exists
++ */
++ public double remove(byte key) {
++ double prev = (double)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TByteDoubleHashMap)) {
++ return false;
++ }
++ TByteDoubleHashMap that = (TByteDoubleHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TByteDoubleProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(byte key, double value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TByteDoubleProcedure {
++ private final TByteDoubleHashMap _otherMap;
++
++ EqProcedure(TByteDoubleHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(byte key, double value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two doubles for equality.
++ */
++ private final boolean eq(double v1, double v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (double)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public double[] getValues() {
++ double[] vals = new double[size()];
++ double[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public byte[] keys() {
++ byte[] keys = new byte[size()];
++ byte[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(double val) {
++ byte[] states = _states;
++ double[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(byte key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TByteProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TDoubleProcedure procedure) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOByteDoubleProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TByteDoubleProcedure procedure) {
++ byte[] states = _states;
++ byte[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TByteDoubleProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ byte[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TDoubleFunction</code> value
++ */
++ public void transformValues(TDoubleFunction function) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(byte key) {
++ return adjustValue(key, (double)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(byte key, double amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ byte key = in.readByte();
++ double val = in.readDouble();
++ put(key, val);
++ }
++ }
++} // TByteDoubleHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteDoubleIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type byte and double.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TByteDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TByteDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TByteDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TByteDoubleIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TByteDoubleIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TByteDoubleHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TByteDoubleIterator(TByteDoubleHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public byte key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public double value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public double setValue(double val) {
++ double old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TByteDoubleIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteDoubleProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type byte and double.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteDoubleProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>byte</code> value
++ * @param b a <code>double</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(byte a, double b);
++}// TByteDoubleProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteFloatHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for byte keys and float values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TByteFloatHashMap extends TByteHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient float[] _values;
++
++ /**
++ * Creates a new <code>TByteFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TByteFloatHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TByteFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TByteFloatHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TByteFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TByteFloatHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TByteFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteFloatHashMap(TByteHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteFloatHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteFloatHashMap(int initialCapacity, TByteHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteFloatHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteFloatHashMap(int initialCapacity, float loadFactor, TByteHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TByteFloatHashMap m = (TByteFloatHashMap)super.clone();
++ m._values = (float[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TByteFloatIterator with access to this map's keys and values
++ */
++ public TByteFloatIterator iterator() {
++ return new TByteFloatIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new float[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>byte</code> value
++ * @param value an <code>float</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (byte)0 if none was found.
++ */
++ public float put(byte key, float value) {
++ byte previousState;
++ float previous = (float)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ byte oldKeys[] = _set;
++ float oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new byte[newCapacity];
++ _values = new float[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ byte o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>byte</code> value
++ * @return the value of <tt>key</tt> or (byte)0 if no such mapping exists.
++ */
++ public float get(byte key) {
++ int index = index(key);
++ return index < 0 ? (float)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ byte[] keys = _set;
++ float[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (byte)0;
++ vals[i] = (float)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return an <code>float</code> value, or (byte)0 if no mapping for key exists
++ */
++ public float remove(byte key) {
++ float prev = (float)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TByteFloatHashMap)) {
++ return false;
++ }
++ TByteFloatHashMap that = (TByteFloatHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TByteFloatProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(byte key, float value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TByteFloatProcedure {
++ private final TByteFloatHashMap _otherMap;
++
++ EqProcedure(TByteFloatHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(byte key, float value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two floats for equality.
++ */
++ private final boolean eq(float v1, float v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (float)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public float[] getValues() {
++ float[] vals = new float[size()];
++ float[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public byte[] keys() {
++ byte[] keys = new byte[size()];
++ byte[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(float val) {
++ byte[] states = _states;
++ float[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(byte key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TByteProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TFloatProcedure procedure) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOByteFloatProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TByteFloatProcedure procedure) {
++ byte[] states = _states;
++ byte[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TByteFloatProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ byte[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TFloatFunction</code> value
++ */
++ public void transformValues(TFloatFunction function) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(byte key) {
++ return adjustValue(key, (float)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(byte key, float amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ byte key = in.readByte();
++ float val = in.readFloat();
++ put(key, val);
++ }
++ }
++} // TByteFloatHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteFloatIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type byte and float.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TByteFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TByteFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TByteFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TByteFloatIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TByteFloatIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TByteFloatHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TByteFloatIterator(TByteFloatHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public byte key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public float value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public float setValue(float val) {
++ float old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TByteFloatIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteFloatProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type byte and float.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteFloatProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>byte</code> value
++ * @param b a <code>float</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(byte a, float b);
++}// TByteFloatProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteFunction.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,43 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for functions that accept and return one byte primitive.
++ *
++ * Created: Mon Nov 5 22:19:36 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PFunction.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteFunction {
++ /**
++ * Execute this function with <tt>value</tt>
++ *
++ * @param value a <code>byte</code> input
++ * @return a <code>byte</code> result
++ */
++ public byte execute(byte value);
++}// TByteFunction
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteHash.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,289 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed hashing implementation for byte primitives.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHash.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++abstract public class TByteHash extends TPrimitiveHash implements TByteHashingStrategy {
++
++ /** the set of bytes */
++ protected transient byte[] _set;
++
++ /** strategy used to hash values in this collection */
++ protected TByteHashingStrategy _hashingStrategy;
++
++ /**
++ * Creates a new <code>TByteHash</code> instance with the default
++ * capacity and load factor.
++ */
++ public TByteHash() {
++ super();
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TByteHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TByteHash(int initialCapacity) {
++ super(initialCapacity);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TByteHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ */
++ public TByteHash(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TByteHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteHash(TByteHashingStrategy strategy) {
++ super();
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TByteHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteHash(int initialCapacity, TByteHashingStrategy strategy) {
++ super(initialCapacity);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TByteHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteHash(int initialCapacity, float loadFactor, TByteHashingStrategy strategy) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TByteHash h = (TByteHash)super.clone();
++ h._set = (byte[])this._set.clone();
++ return h;
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _set = new byte[capacity];
++ return capacity;
++ }
++
++ /**
++ * Searches the set for <tt>val</tt>
++ *
++ * @param val an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean contains(byte val) {
++ return index(val) >= 0;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each element in the set.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the set terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEach(TByteProcedure procedure) {
++ byte[] states = _states;
++ byte[] set = _set;
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(set[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Releases the element currently stored at <tt>index</tt>.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _set[index] = (byte)0;
++ super.removeAt(index);
++ }
++
++ /**
++ * Locates the index of <tt>val</tt>.
++ *
++ * @param val an <code>byte</code> value
++ * @return the index of <tt>val</tt> or -1 if it isn't in the set.
++ */
++ protected int index(byte val) {
++ int hash, probe, index, length;
++ byte[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ // see Knuth, p. 529
++ probe = 1 + (hash % (length - 2));
++
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val));
++ }
++
++ return states[index] == FREE ? -1 : index;
++ }
++
++ /**
++ * Locates the index at which <tt>val</tt> can be inserted. if
++ * there is already a value equal()ing <tt>val</tt> in the set,
++ * returns that value as a negative integer.
++ *
++ * @param val an <code>byte</code> value
++ * @return an <code>int</code> value
++ */
++ protected int insertionIndex(byte val) {
++ int hash, probe, index, length;
++ byte[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] == FREE) {
++ return index; // empty, all done
++ } else if (states[index] == FULL && set[index] == val) {
++ return -index -1; // already stored
++ } else { // already FULL or REMOVED, must probe
++ // compute the double hash
++ probe = 1 + (hash % (length - 2));
++
++ // if the slot we landed on is FULL (but not removed), probe
++ // until we find an empty slot, a REMOVED slot, or an element
++ // equal to the one we are trying to insert.
++ // finding an empty slot means that the value is not present
++ // and that we should use that slot as the insertion point;
++ // finding a REMOVED slot means that we need to keep searching,
++ // however we want to remember the offset of that REMOVED slot
++ // so we can reuse it in case a "new" insertion (i.e. not an update)
++ // is possible.
++ // finding a matching value means that we've found that our desired
++ // key is already in the table
++
++ if (states[index] != REMOVED) {
++ // starting at the natural offset, probe until we find an
++ // offset that isn't full.
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] == FULL && set[index] != val);
++ }
++
++ // if the index we found was removed: continue probing until we
++ // locate a free location or an element which equal()s the
++ // one we have.
++ if (states[index] == REMOVED) {
++ int firstRemoved = index;
++ while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ }
++ return states[index] == FULL ? -index -1 : firstRemoved;
++ }
++ // if it's full, the key is already stored
++ return states[index] == FULL ? -index -1 : index;
++ }
++ }
++
++ /**
++ * Default implementation of TByteHashingStrategy:
++ * delegates hashing to HashFunctions.hash(byte).
++ *
++ * @param val the value to hash
++ * @return the hashcode.
++ */
++ public final int computeHashCode(byte val) {
++ return HashFunctions.hash(val);
++ }
++} // TByteHash
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteHashingStrategy.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,49 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Serializable;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface to support pluggable hashing strategies in maps and sets.
++ * Implementors can use this interface to make the trove hashing
++ * algorithms use an optimal strategy when computing hashcodes.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHashingStrategy.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteHashingStrategy extends Serializable {
++ /**
++ * Computes a hash code for the specified byte. Implementors
++ * can use the byte's own value or a custom scheme designed to
++ * minimize collisions for a known set of input.
++ *
++ * @param val byte for which the hashcode is to be computed
++ * @return the hashCode
++ */
++ public int computeHashCode(byte val);
++} // TByteHashingStrategy
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteHashSet.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,371 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed set implementation for byte primitives.
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TByteHashSet extends TByteHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /**
++ * Creates a new <code>TByteHashSet</code> instance with the default
++ * capacity and load factor.
++ */
++ public TByteHashSet() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TByteHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TByteHashSet(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TByteHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TByteHashSet(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TByteHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>byte</code> primitives
++ */
++ public TByteHashSet(byte[] array) {
++ this(array.length);
++ addAll(array);
++ }
++
++ /**
++ * Creates a new <code>TByteHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteHashSet(TByteHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteHashSet(int initialCapacity, TByteHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteHashSet(int initialCapacity, float loadFactor, TByteHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>byte</code> primitives
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteHashSet(byte[] array, TByteHashingStrategy strategy) {
++ this(array.length, strategy);
++ addAll(array);
++ }
++
++ /**
++ * @return a TByteIterator with access to the values in this set
++ */
++ public TByteIterator iterator() {
++ return new TByteIterator(this);
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param val an <code>byte</code> value
++ * @return true if the set was modified by the add operation
++ */
++ public boolean add(byte val) {
++ int index = insertionIndex(val);
++
++ if (index < 0) {
++ return false; // already present in set, nothing to add
++ }
++
++ byte previousState = _states[index];
++ _set[index] = val;
++ _states[index] = FULL;
++ postInsertHook(previousState == FREE);
++
++ return true; // yes, we added something
++ }
++
++ /**
++ * Expands the set to accomodate new values.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ byte oldSet[] = _set;
++ byte oldStates[] = _states;
++
++ _set = new byte[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ byte o = oldSet[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * Returns a new array containing the values in the set.
++ *
++ * @return an <code>byte[]</code> value
++ */
++ public byte[] toArray() {
++ byte[] result = new byte[size()];
++ byte[] set = _set;
++ byte[] states = _states;
++
++ for (int i = states.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ result[j++] = set[i];
++ }
++ }
++ return result;
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ super.clear();
++ byte[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ set[i] = (byte)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TByteHashSet)) {
++ return false;
++ }
++ final TByteHashSet that = (TByteHashSet)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEach(new TByteProcedure() {
++ public final boolean execute(byte value) {
++ return that.contains(value);
++ }
++ });
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEach(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TByteProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(byte key) {
++ h += _hashingStrategy.computeHashCode(key);
++ return true;
++ }
++ }
++
++ /**
++ * Removes <tt>val</tt> from the set.
++ *
++ * @param val an <code>byte</code> value
++ * @return true if the set was modified by the remove operation.
++ */
++ public boolean remove(byte val) {
++ int index = index(val);
++ if (index >= 0) {
++ removeAt(index);
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Tests the set to determine if all of the elements in
++ * <tt>array</tt> are present.
++ *
++ * @param array an <code>array</code> of byte primitives.
++ * @return true if all elements were present in the set.
++ */
++ public boolean containsAll(byte[] array) {
++ for (int i = array.length; i-- > 0;) {
++ if (! contains(array[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Adds all of the elements in <tt>array</tt> to the set.
++ *
++ * @param array an <code>array</code> of byte primitives.
++ * @return true if the set was modified by the add all operation.
++ */
++ public boolean addAll(byte[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (add(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes all of the elements in <tt>array</tt> from the set.
++ *
++ * @param array an <code>array</code> of byte primitives.
++ * @return true if the set was modified by the remove all operation.
++ */
++ public boolean removeAll(byte[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (remove(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes any values in the set which are not contained in
++ * <tt>array</tt>.
++ *
++ * @param array an <code>array</code> of byte primitives.
++ * @return true if the set was modified by the retain all operation
++ */
++ public boolean retainAll(byte[] array) {
++ boolean changed = false;
++ Arrays.sort(array);
++ byte[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && (Arrays.binarySearch(array,set[i]) < 0)) {
++ remove(set[i]);
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure(out);
++ if (! forEach(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++
++ // ENTRIES
++ setUp(size);
++ while (size-- > 0) {
++ byte val = in.readByte();
++ add(val);
++ }
++ }
++} // TByteHashSet
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteIntHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for byte keys and int values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TByteIntHashMap extends TByteHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient int[] _values;
++
++ /**
++ * Creates a new <code>TByteIntHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TByteIntHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TByteIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TByteIntHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TByteIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TByteIntHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TByteIntHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteIntHashMap(TByteHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteIntHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteIntHashMap(int initialCapacity, TByteHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteIntHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteIntHashMap(int initialCapacity, float loadFactor, TByteHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TByteIntHashMap m = (TByteIntHashMap)super.clone();
++ m._values = (int[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TByteIntIterator with access to this map's keys and values
++ */
++ public TByteIntIterator iterator() {
++ return new TByteIntIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new int[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>byte</code> value
++ * @param value an <code>int</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (byte)0 if none was found.
++ */
++ public int put(byte key, int value) {
++ byte previousState;
++ int previous = (int)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ byte oldKeys[] = _set;
++ int oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new byte[newCapacity];
++ _values = new int[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ byte o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>byte</code> value
++ * @return the value of <tt>key</tt> or (byte)0 if no such mapping exists.
++ */
++ public int get(byte key) {
++ int index = index(key);
++ return index < 0 ? (int)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ byte[] keys = _set;
++ int[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (byte)0;
++ vals[i] = (int)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return an <code>int</code> value, or (byte)0 if no mapping for key exists
++ */
++ public int remove(byte key) {
++ int prev = (int)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TByteIntHashMap)) {
++ return false;
++ }
++ TByteIntHashMap that = (TByteIntHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TByteIntProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(byte key, int value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TByteIntProcedure {
++ private final TByteIntHashMap _otherMap;
++
++ EqProcedure(TByteIntHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(byte key, int value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two ints for equality.
++ */
++ private final boolean eq(int v1, int v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (int)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public int[] getValues() {
++ int[] vals = new int[size()];
++ int[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public byte[] keys() {
++ byte[] keys = new byte[size()];
++ byte[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(int val) {
++ byte[] states = _states;
++ int[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(byte key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TByteProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TIntProcedure procedure) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOByteIntProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TByteIntProcedure procedure) {
++ byte[] states = _states;
++ byte[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TByteIntProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ byte[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TIntFunction</code> value
++ */
++ public void transformValues(TIntFunction function) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(byte key) {
++ return adjustValue(key, (int)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(byte key, int amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ byte key = in.readByte();
++ int val = in.readInt();
++ put(key, val);
++ }
++ }
++} // TByteIntHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteIntIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type byte and int.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TByteIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TByteIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TByteIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TByteIntIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TByteIntIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TByteIntHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TByteIntIterator(TByteIntHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public byte key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public int value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public int setValue(int val) {
++ int old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TByteIntIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteIntProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type byte and int.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteIntProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>byte</code> value
++ * @param b a <code>int</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(byte a, int b);
++}// TByteIntProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,56 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for byte collections.
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TByteIterator extends TPrimitiveIterator {
++ /** the collection on which the iterator operates */
++ private final TByteHash _hash;
++
++ /**
++ * Creates a TByteIterator for the elements in the specified collection.
++ */
++ public TByteIterator(TByteHash hash) {
++ super(hash);
++ this._hash = hash;
++ }
++
++ /**
++ * Advances the iterator to the next element in the underlying collection
++ * and returns it.
++ *
++ * @return the next byte in the collection
++ * @exception NoSuchElementException if the iterator is already exhausted
++ */
++ public byte next() {
++ moveToNextIndex();
++ return _hash._set[_index];
++ }
++}// TByteIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteLongHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for byte keys and long values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TByteLongHashMap extends TByteHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient long[] _values;
++
++ /**
++ * Creates a new <code>TByteLongHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TByteLongHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TByteLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TByteLongHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TByteLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TByteLongHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TByteLongHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteLongHashMap(TByteHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteLongHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteLongHashMap(int initialCapacity, TByteHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteLongHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteLongHashMap(int initialCapacity, float loadFactor, TByteHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TByteLongHashMap m = (TByteLongHashMap)super.clone();
++ m._values = (long[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TByteLongIterator with access to this map's keys and values
++ */
++ public TByteLongIterator iterator() {
++ return new TByteLongIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new long[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>byte</code> value
++ * @param value an <code>long</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (byte)0 if none was found.
++ */
++ public long put(byte key, long value) {
++ byte previousState;
++ long previous = (long)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ byte oldKeys[] = _set;
++ long oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new byte[newCapacity];
++ _values = new long[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ byte o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>byte</code> value
++ * @return the value of <tt>key</tt> or (byte)0 if no such mapping exists.
++ */
++ public long get(byte key) {
++ int index = index(key);
++ return index < 0 ? (long)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ byte[] keys = _set;
++ long[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (byte)0;
++ vals[i] = (long)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return an <code>long</code> value, or (byte)0 if no mapping for key exists
++ */
++ public long remove(byte key) {
++ long prev = (long)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TByteLongHashMap)) {
++ return false;
++ }
++ TByteLongHashMap that = (TByteLongHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TByteLongProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(byte key, long value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TByteLongProcedure {
++ private final TByteLongHashMap _otherMap;
++
++ EqProcedure(TByteLongHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(byte key, long value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two longs for equality.
++ */
++ private final boolean eq(long v1, long v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (long)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public long[] getValues() {
++ long[] vals = new long[size()];
++ long[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public byte[] keys() {
++ byte[] keys = new byte[size()];
++ byte[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(long val) {
++ byte[] states = _states;
++ long[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(byte key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TByteProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TLongProcedure procedure) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOByteLongProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TByteLongProcedure procedure) {
++ byte[] states = _states;
++ byte[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TByteLongProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ byte[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TLongFunction</code> value
++ */
++ public void transformValues(TLongFunction function) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(byte key) {
++ return adjustValue(key, (long)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(byte key, long amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ byte key = in.readByte();
++ long val = in.readLong();
++ put(key, val);
++ }
++ }
++} // TByteLongHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteLongIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type byte and long.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TByteLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TByteLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TByteLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TByteLongIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TByteLongIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TByteLongHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TByteLongIterator(TByteLongHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public byte key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public long value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public long setValue(long val) {
++ long old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TByteLongIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteLongProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type byte and long.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteLongProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>byte</code> value
++ * @param b a <code>long</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(byte a, long b);
++}// TByteLongProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteObjectHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,507 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for byte keys and Object values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TByteObjectHashMap<V> extends TByteHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient V[] _values;
++
++ /**
++ * Creates a new <code>TByteObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TByteObjectHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TByteObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TByteObjectHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TByteObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TByteObjectHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TByteObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteObjectHashMap(TByteHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteObjectHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteObjectHashMap(int initialCapacity, TByteHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteObjectHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteObjectHashMap(int initialCapacity, float loadFactor, TByteHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public TByteObjectHashMap<V> clone() {
++ TByteObjectHashMap<V> m = (TByteObjectHashMap<V>)super.clone();
++ m._values = (V[]) this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TByteObjectIterator with access to this map's keys and values
++ */
++ public TByteObjectIterator<V> iterator() {
++ return new TByteObjectIterator<V>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = (V[]) new Object[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>byte</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (byte)0 if none was found.
++ */
++ public V put(byte key, V value) {
++ byte previousState;
++ V previous = null;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ byte oldKeys[] = _set;
++ V oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new byte[newCapacity];
++ _values = (V[]) new Object[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ byte o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>byte</code> value
++ * @return the value of <tt>key</tt> or (byte)0 if no such mapping exists.
++ */
++ public V get(byte key) {
++ int index = index(key);
++ return index < 0 ? null : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ byte[] keys = _set;
++ Object[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (byte)0;
++ vals[i] = null;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return an <code>Object</code> value or (byte)0 if no such mapping exists.
++ */
++ public V remove(byte key) {
++ V prev = null;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TByteObjectHashMap)) {
++ return false;
++ }
++ TByteObjectHashMap that = (TByteObjectHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TByteObjectProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(byte key, Object value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TByteObjectProcedure {
++ private final TByteObjectHashMap _otherMap;
++
++ EqProcedure(TByteObjectHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(byte key, Object value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two objects for equality.
++ */
++ private final boolean eq(Object o1, Object o2) {
++ return o1 == o2 || ((o1 != null) && o1.equals(o2));
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = null;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public Object[] getValues() {
++ Object[] vals = new Object[size()];
++ V[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public byte[] keys() {
++ byte[] keys = new byte[size()];
++ byte[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(V val) {
++ byte[] states = _states;
++ V[] vals = _values;
++
++ // special case null values so that we don't have to
++ // perform null checks before every call to equals()
++ if (null == val) {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ val == vals[i]) {
++ return true;
++ }
++ }
++ } else {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ (val == vals[i] || val.equals(vals[i]))) {
++ return true;
++ }
++ }
++ } // end of else
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(byte key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TByteProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOByteObjectProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TByteObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ byte[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TByteObjectProcedure<V> procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ byte[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TObjectFunction</code> value
++ */
++ public void transformValues(TObjectFunction<V,V> function) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ byte key = in.readByte();
++ V val = (V) in.readObject();
++ put(key, val);
++ }
++ }
++} // TByteObjectHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteObjectIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,151 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type byte and Object.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TByteObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TByteObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TByteObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TByteObjectIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TByteObjectIterator<V> extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TByteObjectHashMap<V> _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TByteObjectIterator(TByteObjectHashMap<V> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException
++ * if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public byte key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public V value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public V setValue(V val) {
++ V old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TByteObjectIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteObjectProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type byte and Object.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteObjectProcedure<T> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>byte</code> value
++ * @param b an <code>Object</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(byte a, T b);
++}// TByteObjectProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,46 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures with one byte paramater.
++ *
++ * Created: Mon Nov 5 21:45:49 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteProcedure {
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param value a value of type <code>byte</code>
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(byte value);
++}// TByteProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteShortHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for byte keys and short values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TByteShortHashMap extends TByteHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient short[] _values;
++
++ /**
++ * Creates a new <code>TByteShortHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TByteShortHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TByteShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TByteShortHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TByteShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TByteShortHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TByteShortHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteShortHashMap(TByteHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteShortHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteShortHashMap(int initialCapacity, TByteHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TByteShortHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TByteShortHashMap(int initialCapacity, float loadFactor, TByteHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TByteShortHashMap m = (TByteShortHashMap)super.clone();
++ m._values = (short[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TByteShortIterator with access to this map's keys and values
++ */
++ public TByteShortIterator iterator() {
++ return new TByteShortIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new short[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>byte</code> value
++ * @param value an <code>short</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (byte)0 if none was found.
++ */
++ public short put(byte key, short value) {
++ byte previousState;
++ short previous = (short)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ byte oldKeys[] = _set;
++ short oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new byte[newCapacity];
++ _values = new short[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ byte o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>byte</code> value
++ * @return the value of <tt>key</tt> or (byte)0 if no such mapping exists.
++ */
++ public short get(byte key) {
++ int index = index(key);
++ return index < 0 ? (short)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ byte[] keys = _set;
++ short[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (byte)0;
++ vals[i] = (short)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return an <code>short</code> value, or (byte)0 if no mapping for key exists
++ */
++ public short remove(byte key) {
++ short prev = (short)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TByteShortHashMap)) {
++ return false;
++ }
++ TByteShortHashMap that = (TByteShortHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TByteShortProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(byte key, short value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TByteShortProcedure {
++ private final TByteShortHashMap _otherMap;
++
++ EqProcedure(TByteShortHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(byte key, short value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two shorts for equality.
++ */
++ private final boolean eq(short v1, short v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (short)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public short[] getValues() {
++ short[] vals = new short[size()];
++ short[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public byte[] keys() {
++ byte[] keys = new byte[size()];
++ byte[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(short val) {
++ byte[] states = _states;
++ short[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(byte key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TByteProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TShortProcedure procedure) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOByteShortProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TByteShortProcedure procedure) {
++ byte[] states = _states;
++ byte[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TByteShortProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ byte[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TShortFunction</code> value
++ */
++ public void transformValues(TShortFunction function) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(byte key) {
++ return adjustValue(key, (short)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(byte key, short amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ byte key = in.readByte();
++ short val = in.readShort();
++ put(key, val);
++ }
++ }
++} // TByteShortHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteShortIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type byte and short.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TByteShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TByteShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TByteShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TByteShortIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TByteShortIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TByteShortHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TByteShortIterator(TByteShortHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public byte key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public short value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public short setValue(short val) {
++ short old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TByteShortIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TByteShortProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type byte and short.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TByteShortProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>byte</code> value
++ * @param b a <code>short</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(byte a, short b);
++}// TByteShortProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleArrayList.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,905 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Externalizable;
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.util.Arrays;
++import java.util.Random;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * A resizable, array-backed list of double primitives.
++ *
++ * Created: Sat Dec 29 14:21:12 2001
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TDoubleArrayList implements Externalizable, Cloneable {
++ static final long serialVersionUID = 1L;
++
++ /** the data of the list */
++ protected double[] _data;
++
++ /** the index after the last entry in the list */
++ protected int _pos;
++
++ /** the default capacity for new lists */
++ protected static final int DEFAULT_CAPACITY = 10;
++
++ /**
++ * Creates a new <code>TDoubleArrayList</code> instance with the
++ * default capacity.
++ */
++ public TDoubleArrayList() {
++ this(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Creates a new <code>TDoubleArrayList</code> instance with the
++ * specified capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public TDoubleArrayList(int capacity) {
++ _data = new double[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Creates a new <code>TDoubleArrayList</code> instance whose
++ * capacity is the greater of the length of <tt>values</tt> and
++ * DEFAULT_CAPACITY and whose initial contents are the specified
++ * values.
++ *
++ * @param values an <code>double[]</code> value
++ */
++ public TDoubleArrayList(double[] values) {
++ this(Math.max(values.length, DEFAULT_CAPACITY));
++ add(values);
++ }
++
++ // sizing
++
++ /**
++ * Grow the internal array as needed to accomodate the specified
++ * number of elements. The size of the array doubles on each
++ * resize unless <tt>capacity</tt> requires more than twice the
++ * current capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void ensureCapacity(int capacity) {
++ if (capacity > _data.length) {
++ int newCap = Math.max(_data.length << 1, capacity);
++ double[] tmp = new double[newCap];
++ System.arraycopy(_data, 0, tmp, 0, _data.length);
++ _data = tmp;
++ }
++ }
++
++ /**
++ * Returns the number of values in the list.
++ *
++ * @return the number of values in the list.
++ */
++ public int size() {
++ return _pos;
++ }
++
++ /**
++ * Tests whether this list contains any values.
++ *
++ * @return true if the list is empty.
++ */
++ public boolean isEmpty() {
++ return _pos == 0;
++ }
++
++ /**
++ * Sheds any excess capacity above and beyond the current size of
++ * the list.
++ */
++ public void trimToSize() {
++ if (_data.length > size()) {
++ double[] tmp = new double[size()];
++ toNativeArray(tmp, 0, tmp.length);
++ _data = tmp;
++ }
++ }
++
++ // modifying
++
++ /**
++ * Adds <tt>val</tt> to the end of the list, growing as needed.
++ *
++ * @param val an <code>double</code> value
++ */
++ public void add(double val) {
++ ensureCapacity(_pos + 1);
++ _data[_pos++] = val;
++ }
++
++ /**
++ * Adds the values in the array <tt>vals</tt> to the end of the
++ * list, in order.
++ *
++ * @param vals an <code>double[]</code> value
++ */
++ public void add(double[] vals) {
++ add(vals, 0, vals.length);
++ }
++
++ /**
++ * Adds a subset of the values in the array <tt>vals</tt> to the
++ * end of the list, in order.
++ *
++ * @param vals an <code>double[]</code> value
++ * @param offset the offset at which to start copying
++ * @param length the number of values to copy.
++ */
++ public void add(double[] vals, int offset, int length) {
++ ensureCapacity(_pos + length);
++ System.arraycopy(vals, offset, _data, _pos, length);
++ _pos += length;
++ }
++
++ /**
++ * Inserts <tt>value</tt> into the list at <tt>offset</tt>. All
++ * values including and to the right of <tt>offset</tt> are shifted
++ * to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param value an <code>double</code> value
++ */
++ public void insert(int offset, double value) {
++ if (offset == _pos) {
++ add(value);
++ return;
++ }
++ ensureCapacity(_pos + 1);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + 1, _pos - offset);
++ // insert
++ _data[offset] = value;
++ _pos++;
++ }
++
++ /**
++ * Inserts the array of <tt>values</tt> into the list at
++ * <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>double[]</code> value
++ */
++ public void insert(int offset, double[] values) {
++ insert(offset, values, 0, values.length);
++ }
++
++ /**
++ * Inserts a slice of the array of <tt>values</tt> into the list
++ * at <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>double[]</code> value
++ * @param valOffset the offset in the values array at which to
++ * start copying.
++ * @param len the number of values to copy from the values array
++ */
++ public void insert(int offset, double[] values, int valOffset, int len) {
++ if (offset == _pos) {
++ add(values, valOffset, len);
++ return;
++ }
++
++ ensureCapacity(_pos + len);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + len, _pos - offset);
++ // insert
++ System.arraycopy(values, valOffset, _data, offset, len);
++ _pos += len;
++ }
++
++ /**
++ * Returns the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>double</code> value
++ */
++ public double get(int offset) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ return _data[offset];
++ }
++
++ /**
++ * Returns the value at the specified offset without doing any
++ * bounds checking.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>double</code> value
++ */
++ public double getQuick(int offset) {
++ return _data[offset];
++ }
++
++ /**
++ * Sets the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>double</code> value
++ */
++ public void set(int offset, double val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ _data[offset] = val;
++ }
++
++ /**
++ * Sets the value at the specified offset and returns the
++ * previously stored value.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>double</code> value
++ * @return the value previously stored at offset.
++ */
++ public double getSet(int offset, double val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ double old = _data[offset];
++ _data[offset] = val;
++ return old;
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * the contents of the <tt>values</tt> array.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ */
++ public void set(int offset, double[] values) {
++ set(offset, values, 0, values.length);
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * <tt>length</tt> values from the <tt>values</tt> array, starting
++ * at valOffset.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ * @param valOffset the first value to copy from the values array
++ * @param length the number of values to copy
++ */
++ public void set(int offset, double[] values, int valOffset, int length) {
++ if (offset < 0 || offset + length > _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(values, valOffset, _data, offset, length);
++ }
++
++ /**
++ * Sets the value at the specified offset without doing any bounds
++ * checking.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>double</code> value
++ */
++ public void setQuick(int offset, double val) {
++ _data[offset] = val;
++ }
++
++ /**
++ * Flushes the internal state of the list, resetting the capacity
++ * to the default.
++ */
++ public void clear() {
++ clear(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Flushes the internal state of the list, setting the capacity of
++ * the empty list to <tt>capacity</tt>.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void clear(int capacity) {
++ _data = new double[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list without
++ * allocating new backing arrays.
++ *
++ * @see #clear
++ */
++ public void reset() {
++ _pos = 0;
++ fill((double)0);
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list
++ * without allocating new backing arrays. This method differs
++ * from {@link #reset reset} in that it does not clear the old
++ * values in the backing array. Thus, it is possible for {@link
++ * #getQuick getQuick} to return stale data if this method is used
++ * and the caller is careless about bounds checking.
++ *
++ * @see #reset
++ * @see #clear
++ * @see #getQuick
++ */
++ public void resetQuick() {
++ _pos = 0;
++ }
++
++ /**
++ * Removes the value at <tt>offset</tt> from the list.
++ *
++ * @param offset an <code>int</code> value
++ * @return the value previously stored at offset.
++ */
++ public double remove(int offset) {
++ double old = get(offset);
++ remove(offset, 1);
++ return old;
++ }
++
++ /**
++ * Removes <tt>length</tt> values from the list, starting at
++ * <tt>offset</tt>
++ *
++ * @param offset an <code>int</code> value
++ * @param length an <code>int</code> value
++ */
++ public void remove(int offset, int length) {
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++
++ if (offset == 0) {
++ // data at the front
++ System.arraycopy(_data, length, _data, 0, _pos - length);
++ } else if (_pos - length == offset) {
++ // no copy to make, decrementing pos "deletes" values at
++ // the end
++ } else {
++ // data in the middle
++ System.arraycopy(_data, offset + length,
++ _data, offset, _pos - (offset + length));
++ }
++ _pos -= length;
++ // no need to clear old values beyond _pos, because this is a
++ // primitive collection and 0 takes as much room as any other
++ // value
++ }
++
++ /**
++ * Transform each value in the list using the specified function.
++ *
++ * @param function a <code>TDoubleFunction</code> value
++ */
++ public void transformValues(TDoubleFunction function) {
++ for (int i = _pos; i-- > 0;) {
++ _data[i] = function.execute(_data[i]);
++ }
++ }
++
++ /**
++ * Reverse the order of the elements in the list.
++ */
++ public void reverse() {
++ reverse(0, _pos);
++ }
++
++ /**
++ * Reverse the order of the elements in the range of the list.
++ *
++ * @param from the inclusive index at which to start reversing
++ * @param to the exclusive index at which to stop reversing
++ */
++ public void reverse(int from, int to) {
++ if (from == to) {
++ return; // nothing to do
++ }
++ if (from > to) {
++ throw new IllegalArgumentException("from cannot be greater than to");
++ }
++ for (int i = from, j = to - 1; i < j; i++, j--) {
++ swap(i, j);
++ }
++ }
++
++ /**
++ * Shuffle the elements of the list using the specified random
++ * number generator.
++ *
++ * @param rand a <code>Random</code> value
++ */
++ public void shuffle(Random rand) {
++ for (int i = _pos; i-- > 1;) {
++ swap(i, rand.nextInt(i));
++ }
++ }
++
++ /**
++ * Swap the values at offsets <tt>i</tt> and <tt>j</tt>.
++ *
++ * @param i an offset into the data array
++ * @param j an offset into the data array
++ */
++ private final void swap(int i, int j) {
++ double tmp = _data[i];
++ _data[i] = _data[j];
++ _data[j] = tmp;
++ }
++
++ // copying
++
++ /**
++ * Returns a clone of this list. Since this is a primitive
++ * collection, this will be a deep clone.
++ *
++ * @return a deep clone of the list.
++ */
++ public Object clone() {
++ TDoubleArrayList list = null;
++ try {
++ list = (TDoubleArrayList) super.clone();
++ list._data = toNativeArray();
++ } catch (CloneNotSupportedException e) {
++ // it's supported
++ } // end of try-catch
++ return list;
++ }
++
++ /**
++ * Copies the contents of the list into a native array.
++ *
++ * @return an <code>double[]</code> value
++ */
++ public double[] toNativeArray() {
++ return toNativeArray(0, _pos);
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param offset the offset at which to start copying
++ * @param len the number of values to copy.
++ * @return an <code>double[]</code> value
++ */
++ public double[] toNativeArray(int offset, int len) {
++ double[] rv = new double[len];
++ toNativeArray(rv, offset, len);
++ return rv;
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param dest the array to copy into.
++ * @param offset the offset of the first value to copy
++ * @param len the number of values to copy.
++ */
++ public void toNativeArray(double[] dest, int offset, int len) {
++ if (len == 0) {
++ return; // nothing to copy
++ }
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(_data, offset, dest, 0, len);
++ }
++
++ // comparing
++
++ /**
++ * Compares this list to another list, value by value.
++ *
++ * @param other the object to compare against
++ * @return true if other is a TDoubleArrayList and has exactly the
++ * same values.
++ */
++ public boolean equals(Object other) {
++ if (other == this) {
++ return true;
++ } else if (other instanceof TDoubleArrayList) {
++ TDoubleArrayList that = (TDoubleArrayList)other;
++ if (that.size() != this.size()) {
++ return false;
++ } else {
++ for (int i = _pos; i-- > 0;) {
++ if (this._data[i] != that._data[i]) {
++ return false;
++ }
++ }
++ return true;
++ }
++ } else {
++ return false;
++ }
++ }
++
++ public int hashCode() {
++ int h = 0;
++ for (int i = _pos; i-- > 0;) {
++ h += HashFunctions.hash(_data[i]);
++ }
++ return h;
++ }
++
++ // procedures
++
++ /**
++ * Applies the procedure to each value in the list in ascending
++ * (front to back) order.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEach(TDoubleProcedure procedure) {
++ for (int i = 0; i < _pos; i++) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Applies the procedure to each value in the list in descending
++ * (back to front) order.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEachDescending(TDoubleProcedure procedure) {
++ for (int i = _pos; i-- > 0;) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ // sorting
++
++ /**
++ * Sort the values in the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @see java.util.Arrays#sort
++ */
++ public void sort() {
++ Arrays.sort(_data, 0, _pos);
++ }
++
++ /**
++ * Sort a slice of the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @param fromIndex the index at which to start sorting (inclusive)
++ * @param toIndex the index at which to stop sorting (exclusive)
++ * @see java.util.Arrays#sort
++ */
++ public void sort(int fromIndex, int toIndex) {
++ Arrays.sort(_data, fromIndex, toIndex);
++ }
++
++ // filling
++
++ /**
++ * Fills every slot in the list with the specified value.
++ *
++ * @param val the value to use when filling
++ */
++ public void fill(double val) {
++ Arrays.fill(_data, 0, _pos, val);
++ }
++
++ /**
++ * Fills a range in the list with the specified value.
++ *
++ * @param fromIndex the offset at which to start filling (inclusive)
++ * @param toIndex the offset at which to stop filling (exclusive)
++ * @param val the value to use when filling
++ */
++ public void fill(int fromIndex, int toIndex, double val) {
++ if (toIndex > _pos) {
++ ensureCapacity(toIndex);
++ _pos = toIndex;
++ }
++ Arrays.fill(_data, fromIndex, toIndex, val);
++ }
++
++ // searching
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the entire list.
++ * Note that you <b>must</b> @{link #sort sort} the list before
++ * doing a search.
++ *
++ * @param value the value to search for
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(double value) {
++ return binarySearch(value, 0, _pos);
++ }
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the specified
++ * range. Note that you <b>must</b> @{link #sort sort} the list
++ * or the range before doing a search.
++ *
++ * @param value the value to search for
++ * @param fromIndex the lower boundary of the range (inclusive)
++ * @param toIndex the upper boundary of the range (exclusive)
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(double value, int fromIndex, int toIndex) {
++ if (fromIndex < 0) {
++ throw new ArrayIndexOutOfBoundsException(fromIndex);
++ }
++ if (toIndex > _pos) {
++ throw new ArrayIndexOutOfBoundsException(toIndex);
++ }
++
++ int low = fromIndex;
++ int high = toIndex - 1;
++
++ while (low <= high) {
++ int mid = (low + high) >> 1;
++ double midVal = _data[mid];
++
++ if (midVal < value) {
++ low = mid + 1;
++ } else if (midVal > value) {
++ high = mid - 1;
++ } else {
++ return mid; // value found
++ }
++ }
++ return -(low + 1); // value not found.
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>double</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(double value) {
++ return indexOf(0, value);
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (inclusive)
++ * @param value an <code>double</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(int offset, double value) {
++ for (int i = offset; i < _pos; i++) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>double</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(double value) {
++ return lastIndexOf(_pos, value);
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (exclusive)
++ * @param value an <code>double</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(int offset, double value) {
++ for (int i = offset; i-- > 0;) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list for <tt>value</tt>
++ *
++ * @param value an <code>double</code> value
++ * @return true if value is in the list.
++ */
++ public boolean contains(double value) {
++ return lastIndexOf(value) >= 0;
++ }
++
++ /**
++ * Searches the list for values satisfying <tt>condition</tt> in
++ * the manner of the *nix <tt>grep</tt> utility.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which match the condition.
++ */
++ public TDoubleArrayList grep(TDoubleProcedure condition) {
++ TDoubleArrayList list = new TDoubleArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Searches the list for values which do <b>not</b> satisfy
++ * <tt>condition</tt>. This is akin to *nix <code>grep -v</code>.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which do not match the condition.
++ */
++ public TDoubleArrayList inverseGrep(TDoubleProcedure condition) {
++ TDoubleArrayList list = new TDoubleArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (! condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Finds the maximum value in the list.
++ *
++ * @return the largest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public double max() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find maximum of an empty list");
++ }
++ double max = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > max ) {
++ max = _data[_pos];
++ }
++ }
++ return max;
++ }
++
++ /**
++ * Finds the minimum value in the list.
++ *
++ * @return the smallest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public double min() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find minimum of an empty list");
++ }
++ double min = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > min ) {
++ min = _data[_pos];
++ }
++ }
++ return min;
++ }
++
++ // stringification
++
++ /**
++ * Returns a String representation of the list, front to back.
++ *
++ * @return a <code>String</code> value
++ */
++ public String toString() {
++ final StringBuffer buf = new StringBuffer("{");
++ for (int i = 0, end = _pos - 1; i < end; i++) {
++ buf.append(_data[i]);
++ buf.append(", ");
++ }
++ if (size() > 0) {
++ buf.append(_data[_pos - 1]);
++ }
++ buf.append("}");
++ return buf.toString();
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // POSITION
++ out.writeInt( _pos );
++
++ // ENTRIES
++ int len = _data.length;
++ out.writeInt( len );
++ for( int i = 0; i < len; i++ ) {
++ out.writeDouble( _data[ i ] );
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // POSITION
++ _pos = in.readInt();
++
++ // ENTRIES
++ int len = in.readInt();
++ _data = new double[ len ];
++ for( int i = 0; i < len; i++ ) {
++ _data[ i ] = in.readDouble();
++ }
++ }
++} // TDoubleArrayList
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleByteHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for double keys and byte values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TDoubleByteHashMap extends TDoubleHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient byte[] _values;
++
++ /**
++ * Creates a new <code>TDoubleByteHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TDoubleByteHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TDoubleByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TDoubleByteHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TDoubleByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TDoubleByteHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TDoubleByteHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleByteHashMap(TDoubleHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleByteHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleByteHashMap(int initialCapacity, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleByteHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleByteHashMap(int initialCapacity, float loadFactor, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TDoubleByteHashMap m = (TDoubleByteHashMap)super.clone();
++ m._values = (byte[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TDoubleByteIterator with access to this map's keys and values
++ */
++ public TDoubleByteIterator iterator() {
++ return new TDoubleByteIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new byte[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>double</code> value
++ * @param value an <code>byte</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (double)0 if none was found.
++ */
++ public byte put(double key, byte value) {
++ byte previousState;
++ byte previous = (byte)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ double oldKeys[] = _set;
++ byte oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new double[newCapacity];
++ _values = new byte[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ double o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>double</code> value
++ * @return the value of <tt>key</tt> or (double)0 if no such mapping exists.
++ */
++ public byte get(double key) {
++ int index = index(key);
++ return index < 0 ? (byte)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ double[] keys = _set;
++ byte[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (double)0;
++ vals[i] = (byte)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>double</code> value
++ * @return an <code>byte</code> value, or (double)0 if no mapping for key exists
++ */
++ public byte remove(double key) {
++ byte prev = (byte)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TDoubleByteHashMap)) {
++ return false;
++ }
++ TDoubleByteHashMap that = (TDoubleByteHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TDoubleByteProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(double key, byte value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TDoubleByteProcedure {
++ private final TDoubleByteHashMap _otherMap;
++
++ EqProcedure(TDoubleByteHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(double key, byte value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two bytes for equality.
++ */
++ private final boolean eq(byte v1, byte v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (byte)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public byte[] getValues() {
++ byte[] vals = new byte[size()];
++ byte[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public double[] keys() {
++ double[] keys = new double[size()];
++ double[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(byte val) {
++ byte[] states = _states;
++ byte[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(double key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TDoubleProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TByteProcedure procedure) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TODoubleByteProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TDoubleByteProcedure procedure) {
++ byte[] states = _states;
++ double[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TDoubleByteProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ double[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TByteFunction</code> value
++ */
++ public void transformValues(TByteFunction function) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(double key) {
++ return adjustValue(key, (byte)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(double key, byte amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ double key = in.readDouble();
++ byte val = in.readByte();
++ put(key, val);
++ }
++ }
++} // TDoubleByteHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleByteIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type double and byte.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TDoubleByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TDoubleByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TDoubleByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TDoubleByteIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TDoubleByteIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TDoubleByteHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TDoubleByteIterator(TDoubleByteHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public double key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public byte value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public byte setValue(byte val) {
++ byte old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TDoubleByteIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleByteProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type double and byte.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleByteProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>double</code> value
++ * @param b a <code>byte</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(double a, byte b);
++}// TDoubleByteProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleDoubleHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for double keys and double values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TDoubleDoubleHashMap extends TDoubleHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient double[] _values;
++
++ /**
++ * Creates a new <code>TDoubleDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TDoubleDoubleHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TDoubleDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TDoubleDoubleHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TDoubleDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TDoubleDoubleHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TDoubleDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleDoubleHashMap(TDoubleHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleDoubleHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleDoubleHashMap(int initialCapacity, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleDoubleHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleDoubleHashMap(int initialCapacity, float loadFactor, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TDoubleDoubleHashMap m = (TDoubleDoubleHashMap)super.clone();
++ m._values = (double[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TDoubleDoubleIterator with access to this map's keys and values
++ */
++ public TDoubleDoubleIterator iterator() {
++ return new TDoubleDoubleIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new double[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>double</code> value
++ * @param value an <code>double</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (double)0 if none was found.
++ */
++ public double put(double key, double value) {
++ byte previousState;
++ double previous = (double)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ double oldKeys[] = _set;
++ double oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new double[newCapacity];
++ _values = new double[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ double o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>double</code> value
++ * @return the value of <tt>key</tt> or (double)0 if no such mapping exists.
++ */
++ public double get(double key) {
++ int index = index(key);
++ return index < 0 ? (double)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ double[] keys = _set;
++ double[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (double)0;
++ vals[i] = (double)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>double</code> value
++ * @return an <code>double</code> value, or (double)0 if no mapping for key exists
++ */
++ public double remove(double key) {
++ double prev = (double)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TDoubleDoubleHashMap)) {
++ return false;
++ }
++ TDoubleDoubleHashMap that = (TDoubleDoubleHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TDoubleDoubleProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(double key, double value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TDoubleDoubleProcedure {
++ private final TDoubleDoubleHashMap _otherMap;
++
++ EqProcedure(TDoubleDoubleHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(double key, double value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two doubles for equality.
++ */
++ private final boolean eq(double v1, double v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (double)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public double[] getValues() {
++ double[] vals = new double[size()];
++ double[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public double[] keys() {
++ double[] keys = new double[size()];
++ double[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(double val) {
++ byte[] states = _states;
++ double[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(double key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TDoubleProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TDoubleProcedure procedure) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TODoubleDoubleProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TDoubleDoubleProcedure procedure) {
++ byte[] states = _states;
++ double[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TDoubleDoubleProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ double[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TDoubleFunction</code> value
++ */
++ public void transformValues(TDoubleFunction function) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(double key) {
++ return adjustValue(key, (double)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(double key, double amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ double key = in.readDouble();
++ double val = in.readDouble();
++ put(key, val);
++ }
++ }
++} // TDoubleDoubleHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleDoubleIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type double and double.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TDoubleDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TDoubleDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TDoubleDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TDoubleDoubleIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TDoubleDoubleIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TDoubleDoubleHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TDoubleDoubleIterator(TDoubleDoubleHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public double key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public double value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public double setValue(double val) {
++ double old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TDoubleDoubleIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleDoubleProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type double and double.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleDoubleProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>double</code> value
++ * @param b a <code>double</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(double a, double b);
++}// TDoubleDoubleProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleFloatHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for double keys and float values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TDoubleFloatHashMap extends TDoubleHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient float[] _values;
++
++ /**
++ * Creates a new <code>TDoubleFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TDoubleFloatHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TDoubleFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TDoubleFloatHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TDoubleFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TDoubleFloatHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TDoubleFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleFloatHashMap(TDoubleHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleFloatHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleFloatHashMap(int initialCapacity, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleFloatHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleFloatHashMap(int initialCapacity, float loadFactor, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TDoubleFloatHashMap m = (TDoubleFloatHashMap)super.clone();
++ m._values = (float[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TDoubleFloatIterator with access to this map's keys and values
++ */
++ public TDoubleFloatIterator iterator() {
++ return new TDoubleFloatIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new float[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>double</code> value
++ * @param value an <code>float</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (double)0 if none was found.
++ */
++ public float put(double key, float value) {
++ byte previousState;
++ float previous = (float)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ double oldKeys[] = _set;
++ float oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new double[newCapacity];
++ _values = new float[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ double o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>double</code> value
++ * @return the value of <tt>key</tt> or (double)0 if no such mapping exists.
++ */
++ public float get(double key) {
++ int index = index(key);
++ return index < 0 ? (float)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ double[] keys = _set;
++ float[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (double)0;
++ vals[i] = (float)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>double</code> value
++ * @return an <code>float</code> value, or (double)0 if no mapping for key exists
++ */
++ public float remove(double key) {
++ float prev = (float)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TDoubleFloatHashMap)) {
++ return false;
++ }
++ TDoubleFloatHashMap that = (TDoubleFloatHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TDoubleFloatProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(double key, float value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TDoubleFloatProcedure {
++ private final TDoubleFloatHashMap _otherMap;
++
++ EqProcedure(TDoubleFloatHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(double key, float value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two floats for equality.
++ */
++ private final boolean eq(float v1, float v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (float)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public float[] getValues() {
++ float[] vals = new float[size()];
++ float[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public double[] keys() {
++ double[] keys = new double[size()];
++ double[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(float val) {
++ byte[] states = _states;
++ float[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(double key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TDoubleProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TFloatProcedure procedure) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TODoubleFloatProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TDoubleFloatProcedure procedure) {
++ byte[] states = _states;
++ double[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TDoubleFloatProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ double[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TFloatFunction</code> value
++ */
++ public void transformValues(TFloatFunction function) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(double key) {
++ return adjustValue(key, (float)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(double key, float amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ double key = in.readDouble();
++ float val = in.readFloat();
++ put(key, val);
++ }
++ }
++} // TDoubleFloatHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleFloatIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type double and float.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TDoubleFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TDoubleFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TDoubleFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TDoubleFloatIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TDoubleFloatIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TDoubleFloatHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TDoubleFloatIterator(TDoubleFloatHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public double key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public float value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public float setValue(float val) {
++ float old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TDoubleFloatIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleFloatProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type double and float.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleFloatProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>double</code> value
++ * @param b a <code>float</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(double a, float b);
++}// TDoubleFloatProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleFunction.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,43 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for functions that accept and return one double primitive.
++ *
++ * Created: Mon Nov 5 22:19:36 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PFunction.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleFunction {
++ /**
++ * Execute this function with <tt>value</tt>
++ *
++ * @param value a <code>double</code> input
++ * @return a <code>double</code> result
++ */
++ public double execute(double value);
++}// TDoubleFunction
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleHash.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,289 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed hashing implementation for double primitives.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHash.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++abstract public class TDoubleHash extends TPrimitiveHash implements TDoubleHashingStrategy {
++
++ /** the set of doubles */
++ protected transient double[] _set;
++
++ /** strategy used to hash values in this collection */
++ protected TDoubleHashingStrategy _hashingStrategy;
++
++ /**
++ * Creates a new <code>TDoubleHash</code> instance with the default
++ * capacity and load factor.
++ */
++ public TDoubleHash() {
++ super();
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TDoubleHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TDoubleHash(int initialCapacity) {
++ super(initialCapacity);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TDoubleHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ */
++ public TDoubleHash(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TDoubleHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleHash(TDoubleHashingStrategy strategy) {
++ super();
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TDoubleHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleHash(int initialCapacity, TDoubleHashingStrategy strategy) {
++ super(initialCapacity);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TDoubleHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleHash(int initialCapacity, float loadFactor, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TDoubleHash h = (TDoubleHash)super.clone();
++ h._set = (double[])this._set.clone();
++ return h;
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _set = new double[capacity];
++ return capacity;
++ }
++
++ /**
++ * Searches the set for <tt>val</tt>
++ *
++ * @param val an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean contains(double val) {
++ return index(val) >= 0;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each element in the set.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the set terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEach(TDoubleProcedure procedure) {
++ byte[] states = _states;
++ double[] set = _set;
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(set[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Releases the element currently stored at <tt>index</tt>.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _set[index] = (double)0;
++ super.removeAt(index);
++ }
++
++ /**
++ * Locates the index of <tt>val</tt>.
++ *
++ * @param val an <code>double</code> value
++ * @return the index of <tt>val</tt> or -1 if it isn't in the set.
++ */
++ protected int index(double val) {
++ int hash, probe, index, length;
++ double[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ // see Knuth, p. 529
++ probe = 1 + (hash % (length - 2));
++
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val));
++ }
++
++ return states[index] == FREE ? -1 : index;
++ }
++
++ /**
++ * Locates the index at which <tt>val</tt> can be inserted. if
++ * there is already a value equal()ing <tt>val</tt> in the set,
++ * returns that value as a negative integer.
++ *
++ * @param val an <code>double</code> value
++ * @return an <code>int</code> value
++ */
++ protected int insertionIndex(double val) {
++ int hash, probe, index, length;
++ double[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] == FREE) {
++ return index; // empty, all done
++ } else if (states[index] == FULL && set[index] == val) {
++ return -index -1; // already stored
++ } else { // already FULL or REMOVED, must probe
++ // compute the double hash
++ probe = 1 + (hash % (length - 2));
++
++ // if the slot we landed on is FULL (but not removed), probe
++ // until we find an empty slot, a REMOVED slot, or an element
++ // equal to the one we are trying to insert.
++ // finding an empty slot means that the value is not present
++ // and that we should use that slot as the insertion point;
++ // finding a REMOVED slot means that we need to keep searching,
++ // however we want to remember the offset of that REMOVED slot
++ // so we can reuse it in case a "new" insertion (i.e. not an update)
++ // is possible.
++ // finding a matching value means that we've found that our desired
++ // key is already in the table
++
++ if (states[index] != REMOVED) {
++ // starting at the natural offset, probe until we find an
++ // offset that isn't full.
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] == FULL && set[index] != val);
++ }
++
++ // if the index we found was removed: continue probing until we
++ // locate a free location or an element which equal()s the
++ // one we have.
++ if (states[index] == REMOVED) {
++ int firstRemoved = index;
++ while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ }
++ return states[index] == FULL ? -index -1 : firstRemoved;
++ }
++ // if it's full, the key is already stored
++ return states[index] == FULL ? -index -1 : index;
++ }
++ }
++
++ /**
++ * Default implementation of TDoubleHashingStrategy:
++ * delegates hashing to HashFunctions.hash(double).
++ *
++ * @param val the value to hash
++ * @return the hashcode.
++ */
++ public final int computeHashCode(double val) {
++ return HashFunctions.hash(val);
++ }
++} // TDoubleHash
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleHashingStrategy.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,49 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Serializable;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface to support pluggable hashing strategies in maps and sets.
++ * Implementors can use this interface to make the trove hashing
++ * algorithms use an optimal strategy when computing hashcodes.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHashingStrategy.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleHashingStrategy extends Serializable {
++ /**
++ * Computes a hash code for the specified double. Implementors
++ * can use the double's own value or a custom scheme designed to
++ * minimize collisions for a known set of input.
++ *
++ * @param val double for which the hashcode is to be computed
++ * @return the hashCode
++ */
++ public int computeHashCode(double val);
++} // TDoubleHashingStrategy
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleHashSet.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,371 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed set implementation for double primitives.
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TDoubleHashSet extends TDoubleHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /**
++ * Creates a new <code>TDoubleHashSet</code> instance with the default
++ * capacity and load factor.
++ */
++ public TDoubleHashSet() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TDoubleHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TDoubleHashSet(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TDoubleHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TDoubleHashSet(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TDoubleHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>double</code> primitives
++ */
++ public TDoubleHashSet(double[] array) {
++ this(array.length);
++ addAll(array);
++ }
++
++ /**
++ * Creates a new <code>TDoubleHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleHashSet(TDoubleHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleHashSet(int initialCapacity, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleHashSet(int initialCapacity, float loadFactor, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>double</code> primitives
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleHashSet(double[] array, TDoubleHashingStrategy strategy) {
++ this(array.length, strategy);
++ addAll(array);
++ }
++
++ /**
++ * @return a TDoubleIterator with access to the values in this set
++ */
++ public TDoubleIterator iterator() {
++ return new TDoubleIterator(this);
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param val an <code>double</code> value
++ * @return true if the set was modified by the add operation
++ */
++ public boolean add(double val) {
++ int index = insertionIndex(val);
++
++ if (index < 0) {
++ return false; // already present in set, nothing to add
++ }
++
++ byte previousState = _states[index];
++ _set[index] = val;
++ _states[index] = FULL;
++ postInsertHook(previousState == FREE);
++
++ return true; // yes, we added something
++ }
++
++ /**
++ * Expands the set to accomodate new values.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ double oldSet[] = _set;
++ byte oldStates[] = _states;
++
++ _set = new double[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ double o = oldSet[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * Returns a new array containing the values in the set.
++ *
++ * @return an <code>double[]</code> value
++ */
++ public double[] toArray() {
++ double[] result = new double[size()];
++ double[] set = _set;
++ byte[] states = _states;
++
++ for (int i = states.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ result[j++] = set[i];
++ }
++ }
++ return result;
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ super.clear();
++ double[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ set[i] = (double)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TDoubleHashSet)) {
++ return false;
++ }
++ final TDoubleHashSet that = (TDoubleHashSet)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEach(new TDoubleProcedure() {
++ public final boolean execute(double value) {
++ return that.contains(value);
++ }
++ });
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEach(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TDoubleProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(double key) {
++ h += _hashingStrategy.computeHashCode(key);
++ return true;
++ }
++ }
++
++ /**
++ * Removes <tt>val</tt> from the set.
++ *
++ * @param val an <code>double</code> value
++ * @return true if the set was modified by the remove operation.
++ */
++ public boolean remove(double val) {
++ int index = index(val);
++ if (index >= 0) {
++ removeAt(index);
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Tests the set to determine if all of the elements in
++ * <tt>array</tt> are present.
++ *
++ * @param array an <code>array</code> of double primitives.
++ * @return true if all elements were present in the set.
++ */
++ public boolean containsAll(double[] array) {
++ for (int i = array.length; i-- > 0;) {
++ if (! contains(array[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Adds all of the elements in <tt>array</tt> to the set.
++ *
++ * @param array an <code>array</code> of double primitives.
++ * @return true if the set was modified by the add all operation.
++ */
++ public boolean addAll(double[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (add(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes all of the elements in <tt>array</tt> from the set.
++ *
++ * @param array an <code>array</code> of double primitives.
++ * @return true if the set was modified by the remove all operation.
++ */
++ public boolean removeAll(double[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (remove(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes any values in the set which are not contained in
++ * <tt>array</tt>.
++ *
++ * @param array an <code>array</code> of double primitives.
++ * @return true if the set was modified by the retain all operation
++ */
++ public boolean retainAll(double[] array) {
++ boolean changed = false;
++ Arrays.sort(array);
++ double[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && (Arrays.binarySearch(array,set[i]) < 0)) {
++ remove(set[i]);
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure(out);
++ if (! forEach(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++
++ // ENTRIES
++ setUp(size);
++ while (size-- > 0) {
++ double val = in.readDouble();
++ add(val);
++ }
++ }
++} // TDoubleHashSet
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleIntHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for double keys and int values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TDoubleIntHashMap extends TDoubleHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient int[] _values;
++
++ /**
++ * Creates a new <code>TDoubleIntHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TDoubleIntHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TDoubleIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TDoubleIntHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TDoubleIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TDoubleIntHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TDoubleIntHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleIntHashMap(TDoubleHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleIntHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleIntHashMap(int initialCapacity, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleIntHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleIntHashMap(int initialCapacity, float loadFactor, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TDoubleIntHashMap m = (TDoubleIntHashMap)super.clone();
++ m._values = (int[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TDoubleIntIterator with access to this map's keys and values
++ */
++ public TDoubleIntIterator iterator() {
++ return new TDoubleIntIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new int[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>double</code> value
++ * @param value an <code>int</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (double)0 if none was found.
++ */
++ public int put(double key, int value) {
++ byte previousState;
++ int previous = (int)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ double oldKeys[] = _set;
++ int oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new double[newCapacity];
++ _values = new int[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ double o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>double</code> value
++ * @return the value of <tt>key</tt> or (double)0 if no such mapping exists.
++ */
++ public int get(double key) {
++ int index = index(key);
++ return index < 0 ? (int)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ double[] keys = _set;
++ int[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (double)0;
++ vals[i] = (int)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>double</code> value
++ * @return an <code>int</code> value, or (double)0 if no mapping for key exists
++ */
++ public int remove(double key) {
++ int prev = (int)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TDoubleIntHashMap)) {
++ return false;
++ }
++ TDoubleIntHashMap that = (TDoubleIntHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TDoubleIntProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(double key, int value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TDoubleIntProcedure {
++ private final TDoubleIntHashMap _otherMap;
++
++ EqProcedure(TDoubleIntHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(double key, int value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two ints for equality.
++ */
++ private final boolean eq(int v1, int v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (int)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public int[] getValues() {
++ int[] vals = new int[size()];
++ int[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public double[] keys() {
++ double[] keys = new double[size()];
++ double[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(int val) {
++ byte[] states = _states;
++ int[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(double key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TDoubleProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TIntProcedure procedure) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TODoubleIntProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TDoubleIntProcedure procedure) {
++ byte[] states = _states;
++ double[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TDoubleIntProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ double[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TIntFunction</code> value
++ */
++ public void transformValues(TIntFunction function) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(double key) {
++ return adjustValue(key, (int)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(double key, int amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ double key = in.readDouble();
++ int val = in.readInt();
++ put(key, val);
++ }
++ }
++} // TDoubleIntHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleIntIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type double and int.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TDoubleIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TDoubleIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TDoubleIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TDoubleIntIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TDoubleIntIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TDoubleIntHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TDoubleIntIterator(TDoubleIntHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public double key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public int value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public int setValue(int val) {
++ int old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TDoubleIntIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleIntProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type double and int.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleIntProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>double</code> value
++ * @param b a <code>int</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(double a, int b);
++}// TDoubleIntProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,56 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for double collections.
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TDoubleIterator extends TPrimitiveIterator {
++ /** the collection on which the iterator operates */
++ private final TDoubleHash _hash;
++
++ /**
++ * Creates a TDoubleIterator for the elements in the specified collection.
++ */
++ public TDoubleIterator(TDoubleHash hash) {
++ super(hash);
++ this._hash = hash;
++ }
++
++ /**
++ * Advances the iterator to the next element in the underlying collection
++ * and returns it.
++ *
++ * @return the next double in the collection
++ * @exception NoSuchElementException if the iterator is already exhausted
++ */
++ public double next() {
++ moveToNextIndex();
++ return _hash._set[_index];
++ }
++}// TDoubleIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleLongHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for double keys and long values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TDoubleLongHashMap extends TDoubleHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient long[] _values;
++
++ /**
++ * Creates a new <code>TDoubleLongHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TDoubleLongHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TDoubleLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TDoubleLongHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TDoubleLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TDoubleLongHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TDoubleLongHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleLongHashMap(TDoubleHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleLongHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleLongHashMap(int initialCapacity, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleLongHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleLongHashMap(int initialCapacity, float loadFactor, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TDoubleLongHashMap m = (TDoubleLongHashMap)super.clone();
++ m._values = (long[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TDoubleLongIterator with access to this map's keys and values
++ */
++ public TDoubleLongIterator iterator() {
++ return new TDoubleLongIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new long[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>double</code> value
++ * @param value an <code>long</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (double)0 if none was found.
++ */
++ public long put(double key, long value) {
++ byte previousState;
++ long previous = (long)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ double oldKeys[] = _set;
++ long oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new double[newCapacity];
++ _values = new long[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ double o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>double</code> value
++ * @return the value of <tt>key</tt> or (double)0 if no such mapping exists.
++ */
++ public long get(double key) {
++ int index = index(key);
++ return index < 0 ? (long)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ double[] keys = _set;
++ long[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (double)0;
++ vals[i] = (long)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>double</code> value
++ * @return an <code>long</code> value, or (double)0 if no mapping for key exists
++ */
++ public long remove(double key) {
++ long prev = (long)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TDoubleLongHashMap)) {
++ return false;
++ }
++ TDoubleLongHashMap that = (TDoubleLongHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TDoubleLongProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(double key, long value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TDoubleLongProcedure {
++ private final TDoubleLongHashMap _otherMap;
++
++ EqProcedure(TDoubleLongHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(double key, long value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two longs for equality.
++ */
++ private final boolean eq(long v1, long v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (long)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public long[] getValues() {
++ long[] vals = new long[size()];
++ long[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public double[] keys() {
++ double[] keys = new double[size()];
++ double[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(long val) {
++ byte[] states = _states;
++ long[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(double key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TDoubleProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TLongProcedure procedure) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TODoubleLongProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TDoubleLongProcedure procedure) {
++ byte[] states = _states;
++ double[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TDoubleLongProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ double[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TLongFunction</code> value
++ */
++ public void transformValues(TLongFunction function) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(double key) {
++ return adjustValue(key, (long)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(double key, long amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ double key = in.readDouble();
++ long val = in.readLong();
++ put(key, val);
++ }
++ }
++} // TDoubleLongHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleLongIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type double and long.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TDoubleLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TDoubleLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TDoubleLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TDoubleLongIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TDoubleLongIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TDoubleLongHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TDoubleLongIterator(TDoubleLongHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public double key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public long value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public long setValue(long val) {
++ long old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TDoubleLongIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleLongProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type double and long.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleLongProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>double</code> value
++ * @param b a <code>long</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(double a, long b);
++}// TDoubleLongProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleObjectHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,507 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for double keys and Object values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TDoubleObjectHashMap<V> extends TDoubleHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient V[] _values;
++
++ /**
++ * Creates a new <code>TDoubleObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TDoubleObjectHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TDoubleObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TDoubleObjectHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TDoubleObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TDoubleObjectHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TDoubleObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleObjectHashMap(TDoubleHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleObjectHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleObjectHashMap(int initialCapacity, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleObjectHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleObjectHashMap(int initialCapacity, float loadFactor, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public TDoubleObjectHashMap<V> clone() {
++ TDoubleObjectHashMap<V> m = (TDoubleObjectHashMap<V>)super.clone();
++ m._values = (V[]) this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TDoubleObjectIterator with access to this map's keys and values
++ */
++ public TDoubleObjectIterator<V> iterator() {
++ return new TDoubleObjectIterator<V>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = (V[]) new Object[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>double</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (double)0 if none was found.
++ */
++ public V put(double key, V value) {
++ byte previousState;
++ V previous = null;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ double oldKeys[] = _set;
++ V oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new double[newCapacity];
++ _values = (V[]) new Object[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ double o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>double</code> value
++ * @return the value of <tt>key</tt> or (double)0 if no such mapping exists.
++ */
++ public V get(double key) {
++ int index = index(key);
++ return index < 0 ? null : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ double[] keys = _set;
++ Object[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (double)0;
++ vals[i] = null;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>double</code> value
++ * @return an <code>Object</code> value or (double)0 if no such mapping exists.
++ */
++ public V remove(double key) {
++ V prev = null;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TDoubleObjectHashMap)) {
++ return false;
++ }
++ TDoubleObjectHashMap that = (TDoubleObjectHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TDoubleObjectProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(double key, Object value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TDoubleObjectProcedure {
++ private final TDoubleObjectHashMap _otherMap;
++
++ EqProcedure(TDoubleObjectHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(double key, Object value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two objects for equality.
++ */
++ private final boolean eq(Object o1, Object o2) {
++ return o1 == o2 || ((o1 != null) && o1.equals(o2));
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = null;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public Object[] getValues() {
++ Object[] vals = new Object[size()];
++ V[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public double[] keys() {
++ double[] keys = new double[size()];
++ double[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(V val) {
++ byte[] states = _states;
++ V[] vals = _values;
++
++ // special case null values so that we don't have to
++ // perform null checks before every call to equals()
++ if (null == val) {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ val == vals[i]) {
++ return true;
++ }
++ }
++ } else {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ (val == vals[i] || val.equals(vals[i]))) {
++ return true;
++ }
++ }
++ } // end of else
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(double key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TDoubleProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TODoubleObjectProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TDoubleObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ double[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TDoubleObjectProcedure<V> procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ double[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TObjectFunction</code> value
++ */
++ public void transformValues(TObjectFunction<V,V> function) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ double key = in.readDouble();
++ V val = (V) in.readObject();
++ put(key, val);
++ }
++ }
++} // TDoubleObjectHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleObjectIterator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,151 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type double and Object.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TDoubleObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TDoubleObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TDoubleObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TDoubleObjectIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TDoubleObjectIterator<V> extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TDoubleObjectHashMap<V> _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TDoubleObjectIterator(TDoubleObjectHashMap<V> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException
++ * if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public double key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public V value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public V setValue(V val) {
++ V old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TDoubleObjectIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleObjectProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type double and Object.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleObjectProcedure<T> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>double</code> value
++ * @param b an <code>Object</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(double a, T b);
++}// TDoubleObjectProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,46 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures with one double paramater.
++ *
++ * Created: Mon Nov 5 21:45:49 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleProcedure {
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param value a value of type <code>double</code>
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(double value);
++}// TDoubleProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleShortHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for double keys and short values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TDoubleShortHashMap extends TDoubleHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient short[] _values;
++
++ /**
++ * Creates a new <code>TDoubleShortHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TDoubleShortHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TDoubleShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TDoubleShortHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TDoubleShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TDoubleShortHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TDoubleShortHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleShortHashMap(TDoubleHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleShortHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleShortHashMap(int initialCapacity, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TDoubleShortHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TDoubleShortHashMap(int initialCapacity, float loadFactor, TDoubleHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TDoubleShortHashMap m = (TDoubleShortHashMap)super.clone();
++ m._values = (short[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TDoubleShortIterator with access to this map's keys and values
++ */
++ public TDoubleShortIterator iterator() {
++ return new TDoubleShortIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new short[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>double</code> value
++ * @param value an <code>short</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (double)0 if none was found.
++ */
++ public short put(double key, short value) {
++ byte previousState;
++ short previous = (short)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ double oldKeys[] = _set;
++ short oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new double[newCapacity];
++ _values = new short[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ double o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>double</code> value
++ * @return the value of <tt>key</tt> or (double)0 if no such mapping exists.
++ */
++ public short get(double key) {
++ int index = index(key);
++ return index < 0 ? (short)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ double[] keys = _set;
++ short[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (double)0;
++ vals[i] = (short)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>double</code> value
++ * @return an <code>short</code> value, or (double)0 if no mapping for key exists
++ */
++ public short remove(double key) {
++ short prev = (short)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TDoubleShortHashMap)) {
++ return false;
++ }
++ TDoubleShortHashMap that = (TDoubleShortHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TDoubleShortProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(double key, short value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TDoubleShortProcedure {
++ private final TDoubleShortHashMap _otherMap;
++
++ EqProcedure(TDoubleShortHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(double key, short value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two shorts for equality.
++ */
++ private final boolean eq(short v1, short v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (short)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public short[] getValues() {
++ short[] vals = new short[size()];
++ short[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public double[] keys() {
++ double[] keys = new double[size()];
++ double[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(short val) {
++ byte[] states = _states;
++ short[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(double key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TDoubleProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TShortProcedure procedure) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TODoubleShortProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TDoubleShortProcedure procedure) {
++ byte[] states = _states;
++ double[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TDoubleShortProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ double[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TShortFunction</code> value
++ */
++ public void transformValues(TShortFunction function) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(double key) {
++ return adjustValue(key, (short)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(double key, short amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ double key = in.readDouble();
++ short val = in.readShort();
++ put(key, val);
++ }
++ }
++} // TDoubleShortHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleShortIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type double and short.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TDoubleShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TDoubleShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TDoubleShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TDoubleShortIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TDoubleShortIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TDoubleShortHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TDoubleShortIterator(TDoubleShortHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public double key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public short value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public short setValue(short val) {
++ short old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TDoubleShortIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TDoubleShortProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type double and short.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TDoubleShortProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>double</code> value
++ * @param b a <code>short</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(double a, short b);
++}// TDoubleShortProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatArrayList.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,905 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Externalizable;
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.util.Arrays;
++import java.util.Random;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * A resizable, array-backed list of float primitives.
++ *
++ * Created: Sat Dec 29 14:21:12 2001
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TFloatArrayList implements Externalizable, Cloneable {
++ static final long serialVersionUID = 1L;
++
++ /** the data of the list */
++ protected float[] _data;
++
++ /** the index after the last entry in the list */
++ protected int _pos;
++
++ /** the default capacity for new lists */
++ protected static final int DEFAULT_CAPACITY = 10;
++
++ /**
++ * Creates a new <code>TFloatArrayList</code> instance with the
++ * default capacity.
++ */
++ public TFloatArrayList() {
++ this(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Creates a new <code>TFloatArrayList</code> instance with the
++ * specified capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public TFloatArrayList(int capacity) {
++ _data = new float[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Creates a new <code>TFloatArrayList</code> instance whose
++ * capacity is the greater of the length of <tt>values</tt> and
++ * DEFAULT_CAPACITY and whose initial contents are the specified
++ * values.
++ *
++ * @param values an <code>float[]</code> value
++ */
++ public TFloatArrayList(float[] values) {
++ this(Math.max(values.length, DEFAULT_CAPACITY));
++ add(values);
++ }
++
++ // sizing
++
++ /**
++ * Grow the internal array as needed to accomodate the specified
++ * number of elements. The size of the array floats on each
++ * resize unless <tt>capacity</tt> requires more than twice the
++ * current capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void ensureCapacity(int capacity) {
++ if (capacity > _data.length) {
++ int newCap = Math.max(_data.length << 1, capacity);
++ float[] tmp = new float[newCap];
++ System.arraycopy(_data, 0, tmp, 0, _data.length);
++ _data = tmp;
++ }
++ }
++
++ /**
++ * Returns the number of values in the list.
++ *
++ * @return the number of values in the list.
++ */
++ public int size() {
++ return _pos;
++ }
++
++ /**
++ * Tests whether this list contains any values.
++ *
++ * @return true if the list is empty.
++ */
++ public boolean isEmpty() {
++ return _pos == 0;
++ }
++
++ /**
++ * Sheds any excess capacity above and beyond the current size of
++ * the list.
++ */
++ public void trimToSize() {
++ if (_data.length > size()) {
++ float[] tmp = new float[size()];
++ toNativeArray(tmp, 0, tmp.length);
++ _data = tmp;
++ }
++ }
++
++ // modifying
++
++ /**
++ * Adds <tt>val</tt> to the end of the list, growing as needed.
++ *
++ * @param val an <code>float</code> value
++ */
++ public void add(float val) {
++ ensureCapacity(_pos + 1);
++ _data[_pos++] = val;
++ }
++
++ /**
++ * Adds the values in the array <tt>vals</tt> to the end of the
++ * list, in order.
++ *
++ * @param vals an <code>float[]</code> value
++ */
++ public void add(float[] vals) {
++ add(vals, 0, vals.length);
++ }
++
++ /**
++ * Adds a subset of the values in the array <tt>vals</tt> to the
++ * end of the list, in order.
++ *
++ * @param vals an <code>float[]</code> value
++ * @param offset the offset at which to start copying
++ * @param length the number of values to copy.
++ */
++ public void add(float[] vals, int offset, int length) {
++ ensureCapacity(_pos + length);
++ System.arraycopy(vals, offset, _data, _pos, length);
++ _pos += length;
++ }
++
++ /**
++ * Inserts <tt>value</tt> into the list at <tt>offset</tt>. All
++ * values including and to the right of <tt>offset</tt> are shifted
++ * to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param value an <code>float</code> value
++ */
++ public void insert(int offset, float value) {
++ if (offset == _pos) {
++ add(value);
++ return;
++ }
++ ensureCapacity(_pos + 1);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + 1, _pos - offset);
++ // insert
++ _data[offset] = value;
++ _pos++;
++ }
++
++ /**
++ * Inserts the array of <tt>values</tt> into the list at
++ * <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>float[]</code> value
++ */
++ public void insert(int offset, float[] values) {
++ insert(offset, values, 0, values.length);
++ }
++
++ /**
++ * Inserts a slice of the array of <tt>values</tt> into the list
++ * at <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>float[]</code> value
++ * @param valOffset the offset in the values array at which to
++ * start copying.
++ * @param len the number of values to copy from the values array
++ */
++ public void insert(int offset, float[] values, int valOffset, int len) {
++ if (offset == _pos) {
++ add(values, valOffset, len);
++ return;
++ }
++
++ ensureCapacity(_pos + len);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + len, _pos - offset);
++ // insert
++ System.arraycopy(values, valOffset, _data, offset, len);
++ _pos += len;
++ }
++
++ /**
++ * Returns the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>float</code> value
++ */
++ public float get(int offset) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ return _data[offset];
++ }
++
++ /**
++ * Returns the value at the specified offset without doing any
++ * bounds checking.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>float</code> value
++ */
++ public float getQuick(int offset) {
++ return _data[offset];
++ }
++
++ /**
++ * Sets the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>float</code> value
++ */
++ public void set(int offset, float val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ _data[offset] = val;
++ }
++
++ /**
++ * Sets the value at the specified offset and returns the
++ * previously stored value.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>float</code> value
++ * @return the value previously stored at offset.
++ */
++ public float getSet(int offset, float val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ float old = _data[offset];
++ _data[offset] = val;
++ return old;
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * the contents of the <tt>values</tt> array.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ */
++ public void set(int offset, float[] values) {
++ set(offset, values, 0, values.length);
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * <tt>length</tt> values from the <tt>values</tt> array, starting
++ * at valOffset.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ * @param valOffset the first value to copy from the values array
++ * @param length the number of values to copy
++ */
++ public void set(int offset, float[] values, int valOffset, int length) {
++ if (offset < 0 || offset + length > _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(values, valOffset, _data, offset, length);
++ }
++
++ /**
++ * Sets the value at the specified offset without doing any bounds
++ * checking.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>float</code> value
++ */
++ public void setQuick(int offset, float val) {
++ _data[offset] = val;
++ }
++
++ /**
++ * Flushes the internal state of the list, resetting the capacity
++ * to the default.
++ */
++ public void clear() {
++ clear(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Flushes the internal state of the list, setting the capacity of
++ * the empty list to <tt>capacity</tt>.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void clear(int capacity) {
++ _data = new float[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list without
++ * allocating new backing arrays.
++ *
++ * @see #clear
++ */
++ public void reset() {
++ _pos = 0;
++ fill((float)0);
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list
++ * without allocating new backing arrays. This method differs
++ * from {@link #reset reset} in that it does not clear the old
++ * values in the backing array. Thus, it is possible for {@link
++ * #getQuick getQuick} to return stale data if this method is used
++ * and the caller is careless about bounds checking.
++ *
++ * @see #reset
++ * @see #clear
++ * @see #getQuick
++ */
++ public void resetQuick() {
++ _pos = 0;
++ }
++
++ /**
++ * Removes the value at <tt>offset</tt> from the list.
++ *
++ * @param offset an <code>int</code> value
++ * @return the value previously stored at offset.
++ */
++ public float remove(int offset) {
++ float old = get(offset);
++ remove(offset, 1);
++ return old;
++ }
++
++ /**
++ * Removes <tt>length</tt> values from the list, starting at
++ * <tt>offset</tt>
++ *
++ * @param offset an <code>int</code> value
++ * @param length an <code>int</code> value
++ */
++ public void remove(int offset, int length) {
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++
++ if (offset == 0) {
++ // data at the front
++ System.arraycopy(_data, length, _data, 0, _pos - length);
++ } else if (_pos - length == offset) {
++ // no copy to make, decrementing pos "deletes" values at
++ // the end
++ } else {
++ // data in the middle
++ System.arraycopy(_data, offset + length,
++ _data, offset, _pos - (offset + length));
++ }
++ _pos -= length;
++ // no need to clear old values beyond _pos, because this is a
++ // primitive collection and 0 takes as much room as any other
++ // value
++ }
++
++ /**
++ * Transform each value in the list using the specified function.
++ *
++ * @param function a <code>TFloatFunction</code> value
++ */
++ public void transformValues(TFloatFunction function) {
++ for (int i = _pos; i-- > 0;) {
++ _data[i] = function.execute(_data[i]);
++ }
++ }
++
++ /**
++ * Reverse the order of the elements in the list.
++ */
++ public void reverse() {
++ reverse(0, _pos);
++ }
++
++ /**
++ * Reverse the order of the elements in the range of the list.
++ *
++ * @param from the inclusive index at which to start reversing
++ * @param to the exclusive index at which to stop reversing
++ */
++ public void reverse(int from, int to) {
++ if (from == to) {
++ return; // nothing to do
++ }
++ if (from > to) {
++ throw new IllegalArgumentException("from cannot be greater than to");
++ }
++ for (int i = from, j = to - 1; i < j; i++, j--) {
++ swap(i, j);
++ }
++ }
++
++ /**
++ * Shuffle the elements of the list using the specified random
++ * number generator.
++ *
++ * @param rand a <code>Random</code> value
++ */
++ public void shuffle(Random rand) {
++ for (int i = _pos; i-- > 1;) {
++ swap(i, rand.nextInt(i));
++ }
++ }
++
++ /**
++ * Swap the values at offsets <tt>i</tt> and <tt>j</tt>.
++ *
++ * @param i an offset into the data array
++ * @param j an offset into the data array
++ */
++ private final void swap(int i, int j) {
++ float tmp = _data[i];
++ _data[i] = _data[j];
++ _data[j] = tmp;
++ }
++
++ // copying
++
++ /**
++ * Returns a clone of this list. Since this is a primitive
++ * collection, this will be a deep clone.
++ *
++ * @return a deep clone of the list.
++ */
++ public Object clone() {
++ TFloatArrayList list = null;
++ try {
++ list = (TFloatArrayList) super.clone();
++ list._data = toNativeArray();
++ } catch (CloneNotSupportedException e) {
++ // it's supported
++ } // end of try-catch
++ return list;
++ }
++
++ /**
++ * Copies the contents of the list into a native array.
++ *
++ * @return an <code>float[]</code> value
++ */
++ public float[] toNativeArray() {
++ return toNativeArray(0, _pos);
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param offset the offset at which to start copying
++ * @param len the number of values to copy.
++ * @return an <code>float[]</code> value
++ */
++ public float[] toNativeArray(int offset, int len) {
++ float[] rv = new float[len];
++ toNativeArray(rv, offset, len);
++ return rv;
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param dest the array to copy into.
++ * @param offset the offset of the first value to copy
++ * @param len the number of values to copy.
++ */
++ public void toNativeArray(float[] dest, int offset, int len) {
++ if (len == 0) {
++ return; // nothing to copy
++ }
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(_data, offset, dest, 0, len);
++ }
++
++ // comparing
++
++ /**
++ * Compares this list to another list, value by value.
++ *
++ * @param other the object to compare against
++ * @return true if other is a TFloatArrayList and has exactly the
++ * same values.
++ */
++ public boolean equals(Object other) {
++ if (other == this) {
++ return true;
++ } else if (other instanceof TFloatArrayList) {
++ TFloatArrayList that = (TFloatArrayList)other;
++ if (that.size() != this.size()) {
++ return false;
++ } else {
++ for (int i = _pos; i-- > 0;) {
++ if (this._data[i] != that._data[i]) {
++ return false;
++ }
++ }
++ return true;
++ }
++ } else {
++ return false;
++ }
++ }
++
++ public int hashCode() {
++ int h = 0;
++ for (int i = _pos; i-- > 0;) {
++ h += HashFunctions.hash(_data[i]);
++ }
++ return h;
++ }
++
++ // procedures
++
++ /**
++ * Applies the procedure to each value in the list in ascending
++ * (front to back) order.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEach(TFloatProcedure procedure) {
++ for (int i = 0; i < _pos; i++) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Applies the procedure to each value in the list in descending
++ * (back to front) order.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEachDescending(TFloatProcedure procedure) {
++ for (int i = _pos; i-- > 0;) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ // sorting
++
++ /**
++ * Sort the values in the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @see java.util.Arrays#sort
++ */
++ public void sort() {
++ Arrays.sort(_data, 0, _pos);
++ }
++
++ /**
++ * Sort a slice of the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @param fromIndex the index at which to start sorting (inclusive)
++ * @param toIndex the index at which to stop sorting (exclusive)
++ * @see java.util.Arrays#sort
++ */
++ public void sort(int fromIndex, int toIndex) {
++ Arrays.sort(_data, fromIndex, toIndex);
++ }
++
++ // filling
++
++ /**
++ * Fills every slot in the list with the specified value.
++ *
++ * @param val the value to use when filling
++ */
++ public void fill(float val) {
++ Arrays.fill(_data, 0, _pos, val);
++ }
++
++ /**
++ * Fills a range in the list with the specified value.
++ *
++ * @param fromIndex the offset at which to start filling (inclusive)
++ * @param toIndex the offset at which to stop filling (exclusive)
++ * @param val the value to use when filling
++ */
++ public void fill(int fromIndex, int toIndex, float val) {
++ if (toIndex > _pos) {
++ ensureCapacity(toIndex);
++ _pos = toIndex;
++ }
++ Arrays.fill(_data, fromIndex, toIndex, val);
++ }
++
++ // searching
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the entire list.
++ * Note that you <b>must</b> @{link #sort sort} the list before
++ * doing a search.
++ *
++ * @param value the value to search for
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(float value) {
++ return binarySearch(value, 0, _pos);
++ }
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the specified
++ * range. Note that you <b>must</b> @{link #sort sort} the list
++ * or the range before doing a search.
++ *
++ * @param value the value to search for
++ * @param fromIndex the lower boundary of the range (inclusive)
++ * @param toIndex the upper boundary of the range (exclusive)
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(float value, int fromIndex, int toIndex) {
++ if (fromIndex < 0) {
++ throw new ArrayIndexOutOfBoundsException(fromIndex);
++ }
++ if (toIndex > _pos) {
++ throw new ArrayIndexOutOfBoundsException(toIndex);
++ }
++
++ int low = fromIndex;
++ int high = toIndex - 1;
++
++ while (low <= high) {
++ int mid = (low + high) >> 1;
++ float midVal = _data[mid];
++
++ if (midVal < value) {
++ low = mid + 1;
++ } else if (midVal > value) {
++ high = mid - 1;
++ } else {
++ return mid; // value found
++ }
++ }
++ return -(low + 1); // value not found.
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>float</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(float value) {
++ return indexOf(0, value);
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (inclusive)
++ * @param value an <code>float</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(int offset, float value) {
++ for (int i = offset; i < _pos; i++) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>float</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(float value) {
++ return lastIndexOf(_pos, value);
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (exclusive)
++ * @param value an <code>float</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(int offset, float value) {
++ for (int i = offset; i-- > 0;) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list for <tt>value</tt>
++ *
++ * @param value an <code>float</code> value
++ * @return true if value is in the list.
++ */
++ public boolean contains(float value) {
++ return lastIndexOf(value) >= 0;
++ }
++
++ /**
++ * Searches the list for values satisfying <tt>condition</tt> in
++ * the manner of the *nix <tt>grep</tt> utility.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which match the condition.
++ */
++ public TFloatArrayList grep(TFloatProcedure condition) {
++ TFloatArrayList list = new TFloatArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Searches the list for values which do <b>not</b> satisfy
++ * <tt>condition</tt>. This is akin to *nix <code>grep -v</code>.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which do not match the condition.
++ */
++ public TFloatArrayList inverseGrep(TFloatProcedure condition) {
++ TFloatArrayList list = new TFloatArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (! condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Finds the maximum value in the list.
++ *
++ * @return the largest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public float max() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find maximum of an empty list");
++ }
++ float max = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > max ) {
++ max = _data[_pos];
++ }
++ }
++ return max;
++ }
++
++ /**
++ * Finds the minimum value in the list.
++ *
++ * @return the smallest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public float min() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find minimum of an empty list");
++ }
++ float min = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > min ) {
++ min = _data[_pos];
++ }
++ }
++ return min;
++ }
++
++ // stringification
++
++ /**
++ * Returns a String representation of the list, front to back.
++ *
++ * @return a <code>String</code> value
++ */
++ public String toString() {
++ final StringBuffer buf = new StringBuffer("{");
++ for (int i = 0, end = _pos - 1; i < end; i++) {
++ buf.append(_data[i]);
++ buf.append(", ");
++ }
++ if (size() > 0) {
++ buf.append(_data[_pos - 1]);
++ }
++ buf.append("}");
++ return buf.toString();
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // POSITION
++ out.writeInt( _pos );
++
++ // ENTRIES
++ int len = _data.length;
++ out.writeInt( len );
++ for( int i = 0; i < len; i++ ) {
++ out.writeFloat( _data[ i ] );
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // POSITION
++ _pos = in.readInt();
++
++ // ENTRIES
++ int len = in.readInt();
++ _data = new float[ len ];
++ for( int i = 0; i < len; i++ ) {
++ _data[ i ] = in.readFloat();
++ }
++ }
++} // TFloatArrayList
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatByteHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for float keys and byte values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TFloatByteHashMap extends TFloatHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient byte[] _values;
++
++ /**
++ * Creates a new <code>TFloatByteHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TFloatByteHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TFloatByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TFloatByteHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TFloatByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TFloatByteHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TFloatByteHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatByteHashMap(TFloatHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatByteHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatByteHashMap(int initialCapacity, TFloatHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatByteHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatByteHashMap(int initialCapacity, float loadFactor, TFloatHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TFloatByteHashMap m = (TFloatByteHashMap)super.clone();
++ m._values = (byte[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TFloatByteIterator with access to this map's keys and values
++ */
++ public TFloatByteIterator iterator() {
++ return new TFloatByteIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new byte[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>float</code> value
++ * @param value an <code>byte</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (float)0 if none was found.
++ */
++ public byte put(float key, byte value) {
++ byte previousState;
++ byte previous = (byte)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ float oldKeys[] = _set;
++ byte oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new float[newCapacity];
++ _values = new byte[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ float o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>float</code> value
++ * @return the value of <tt>key</tt> or (float)0 if no such mapping exists.
++ */
++ public byte get(float key) {
++ int index = index(key);
++ return index < 0 ? (byte)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ float[] keys = _set;
++ byte[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (float)0;
++ vals[i] = (byte)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>float</code> value
++ * @return an <code>byte</code> value, or (float)0 if no mapping for key exists
++ */
++ public byte remove(float key) {
++ byte prev = (byte)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TFloatByteHashMap)) {
++ return false;
++ }
++ TFloatByteHashMap that = (TFloatByteHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TFloatByteProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(float key, byte value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TFloatByteProcedure {
++ private final TFloatByteHashMap _otherMap;
++
++ EqProcedure(TFloatByteHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(float key, byte value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two bytes for equality.
++ */
++ private final boolean eq(byte v1, byte v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (byte)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public byte[] getValues() {
++ byte[] vals = new byte[size()];
++ byte[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public float[] keys() {
++ float[] keys = new float[size()];
++ float[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(byte val) {
++ byte[] states = _states;
++ byte[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(float key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TFloatProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TByteProcedure procedure) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOFloatByteProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TFloatByteProcedure procedure) {
++ byte[] states = _states;
++ float[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TFloatByteProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ float[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TByteFunction</code> value
++ */
++ public void transformValues(TByteFunction function) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(float key) {
++ return adjustValue(key, (byte)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(float key, byte amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ float key = in.readFloat();
++ byte val = in.readByte();
++ put(key, val);
++ }
++ }
++} // TFloatByteHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatByteIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type float and byte.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TFloatByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TFloatByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TFloatByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TFloatByteIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TFloatByteIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TFloatByteHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TFloatByteIterator(TFloatByteHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public float key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public byte value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public byte setValue(byte val) {
++ byte old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TFloatByteIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatByteProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type float and byte.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatByteProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>float</code> value
++ * @param b a <code>byte</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(float a, byte b);
++}// TFloatByteProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatDoubleHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for float keys and double values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TFloatDoubleHashMap extends TFloatHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient double[] _values;
++
++ /**
++ * Creates a new <code>TFloatDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TFloatDoubleHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TFloatDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TFloatDoubleHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TFloatDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TFloatDoubleHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TFloatDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatDoubleHashMap(TFloatHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatDoubleHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatDoubleHashMap(int initialCapacity, TFloatHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatDoubleHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatDoubleHashMap(int initialCapacity, float loadFactor, TFloatHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TFloatDoubleHashMap m = (TFloatDoubleHashMap)super.clone();
++ m._values = (double[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TFloatDoubleIterator with access to this map's keys and values
++ */
++ public TFloatDoubleIterator iterator() {
++ return new TFloatDoubleIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new double[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>float</code> value
++ * @param value an <code>double</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (float)0 if none was found.
++ */
++ public double put(float key, double value) {
++ byte previousState;
++ double previous = (double)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ float oldKeys[] = _set;
++ double oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new float[newCapacity];
++ _values = new double[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ float o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>float</code> value
++ * @return the value of <tt>key</tt> or (float)0 if no such mapping exists.
++ */
++ public double get(float key) {
++ int index = index(key);
++ return index < 0 ? (double)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ float[] keys = _set;
++ double[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (float)0;
++ vals[i] = (double)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>float</code> value
++ * @return an <code>double</code> value, or (float)0 if no mapping for key exists
++ */
++ public double remove(float key) {
++ double prev = (double)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TFloatDoubleHashMap)) {
++ return false;
++ }
++ TFloatDoubleHashMap that = (TFloatDoubleHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TFloatDoubleProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(float key, double value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TFloatDoubleProcedure {
++ private final TFloatDoubleHashMap _otherMap;
++
++ EqProcedure(TFloatDoubleHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(float key, double value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two doubles for equality.
++ */
++ private final boolean eq(double v1, double v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (double)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public double[] getValues() {
++ double[] vals = new double[size()];
++ double[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public float[] keys() {
++ float[] keys = new float[size()];
++ float[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(double val) {
++ byte[] states = _states;
++ double[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(float key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TFloatProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TDoubleProcedure procedure) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOFloatDoubleProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TFloatDoubleProcedure procedure) {
++ byte[] states = _states;
++ float[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TFloatDoubleProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ float[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TDoubleFunction</code> value
++ */
++ public void transformValues(TDoubleFunction function) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(float key) {
++ return adjustValue(key, (double)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(float key, double amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ float key = in.readFloat();
++ double val = in.readDouble();
++ put(key, val);
++ }
++ }
++} // TFloatDoubleHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatDoubleIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type float and double.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TFloatDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TFloatDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TFloatDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TFloatDoubleIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TFloatDoubleIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TFloatDoubleHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TFloatDoubleIterator(TFloatDoubleHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public float key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public double value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public double setValue(double val) {
++ double old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TFloatDoubleIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatDoubleProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type float and double.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatDoubleProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>float</code> value
++ * @param b a <code>double</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(float a, double b);
++}// TFloatDoubleProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatFloatHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for float keys and float values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TFloatFloatHashMap extends TFloatHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient float[] _values;
++
++ /**
++ * Creates a new <code>TFloatFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TFloatFloatHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TFloatFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TFloatFloatHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TFloatFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TFloatFloatHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TFloatFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatFloatHashMap(TFloatHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatFloatHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatFloatHashMap(int initialCapacity, TFloatHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatFloatHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatFloatHashMap(int initialCapacity, float loadFactor, TFloatHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TFloatFloatHashMap m = (TFloatFloatHashMap)super.clone();
++ m._values = (float[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TFloatFloatIterator with access to this map's keys and values
++ */
++ public TFloatFloatIterator iterator() {
++ return new TFloatFloatIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new float[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>float</code> value
++ * @param value an <code>float</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (float)0 if none was found.
++ */
++ public float put(float key, float value) {
++ byte previousState;
++ float previous = (float)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ float oldKeys[] = _set;
++ float oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new float[newCapacity];
++ _values = new float[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ float o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>float</code> value
++ * @return the value of <tt>key</tt> or (float)0 if no such mapping exists.
++ */
++ public float get(float key) {
++ int index = index(key);
++ return index < 0 ? (float)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ float[] keys = _set;
++ float[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (float)0;
++ vals[i] = (float)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>float</code> value
++ * @return an <code>float</code> value, or (float)0 if no mapping for key exists
++ */
++ public float remove(float key) {
++ float prev = (float)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TFloatFloatHashMap)) {
++ return false;
++ }
++ TFloatFloatHashMap that = (TFloatFloatHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TFloatFloatProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(float key, float value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TFloatFloatProcedure {
++ private final TFloatFloatHashMap _otherMap;
++
++ EqProcedure(TFloatFloatHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(float key, float value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two floats for equality.
++ */
++ private final boolean eq(float v1, float v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (float)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public float[] getValues() {
++ float[] vals = new float[size()];
++ float[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public float[] keys() {
++ float[] keys = new float[size()];
++ float[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(float val) {
++ byte[] states = _states;
++ float[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(float key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TFloatProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TFloatProcedure procedure) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOFloatFloatProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TFloatFloatProcedure procedure) {
++ byte[] states = _states;
++ float[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TFloatFloatProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ float[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TFloatFunction</code> value
++ */
++ public void transformValues(TFloatFunction function) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(float key) {
++ return adjustValue(key, (float)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(float key, float amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ float key = in.readFloat();
++ float val = in.readFloat();
++ put(key, val);
++ }
++ }
++} // TFloatFloatHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatFloatIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type float and float.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TFloatFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TFloatFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TFloatFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TFloatFloatIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TFloatFloatIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TFloatFloatHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TFloatFloatIterator(TFloatFloatHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public float key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public float value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public float setValue(float val) {
++ float old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TFloatFloatIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatFloatProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type float and float.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatFloatProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>float</code> value
++ * @param b a <code>float</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(float a, float b);
++}// TFloatFloatProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatFunction.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,43 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for functions that accept and return one float primitive.
++ *
++ * Created: Mon Nov 5 22:19:36 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PFunction.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatFunction {
++ /**
++ * Execute this function with <tt>value</tt>
++ *
++ * @param value a <code>float</code> input
++ * @return a <code>float</code> result
++ */
++ public float execute(float value);
++}// TFloatFunction
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatHash.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,289 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed hashing implementation for float primitives.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHash.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++abstract public class TFloatHash extends TPrimitiveHash implements TFloatHashingStrategy {
++
++ /** the set of floats */
++ protected transient float[] _set;
++
++ /** strategy used to hash values in this collection */
++ protected TFloatHashingStrategy _hashingStrategy;
++
++ /**
++ * Creates a new <code>TFloatHash</code> instance with the default
++ * capacity and load factor.
++ */
++ public TFloatHash() {
++ super();
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TFloatHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TFloatHash(int initialCapacity) {
++ super(initialCapacity);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TFloatHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ */
++ public TFloatHash(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TFloatHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatHash(TFloatHashingStrategy strategy) {
++ super();
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TFloatHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatHash(int initialCapacity, TFloatHashingStrategy strategy) {
++ super(initialCapacity);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TFloatHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatHash(int initialCapacity, float loadFactor, TFloatHashingStrategy strategy) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TFloatHash h = (TFloatHash)super.clone();
++ h._set = (float[])this._set.clone();
++ return h;
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _set = new float[capacity];
++ return capacity;
++ }
++
++ /**
++ * Searches the set for <tt>val</tt>
++ *
++ * @param val an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean contains(float val) {
++ return index(val) >= 0;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each element in the set.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the set terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEach(TFloatProcedure procedure) {
++ byte[] states = _states;
++ float[] set = _set;
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(set[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Releases the element currently stored at <tt>index</tt>.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _set[index] = (float)0;
++ super.removeAt(index);
++ }
++
++ /**
++ * Locates the index of <tt>val</tt>.
++ *
++ * @param val an <code>float</code> value
++ * @return the index of <tt>val</tt> or -1 if it isn't in the set.
++ */
++ protected int index(float val) {
++ int hash, probe, index, length;
++ float[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ // see Knuth, p. 529
++ probe = 1 + (hash % (length - 2));
++
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val));
++ }
++
++ return states[index] == FREE ? -1 : index;
++ }
++
++ /**
++ * Locates the index at which <tt>val</tt> can be inserted. if
++ * there is already a value equal()ing <tt>val</tt> in the set,
++ * returns that value as a negative integer.
++ *
++ * @param val an <code>float</code> value
++ * @return an <code>int</code> value
++ */
++ protected int insertionIndex(float val) {
++ int hash, probe, index, length;
++ float[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] == FREE) {
++ return index; // empty, all done
++ } else if (states[index] == FULL && set[index] == val) {
++ return -index -1; // already stored
++ } else { // already FULL or REMOVED, must probe
++ // compute the double hash
++ probe = 1 + (hash % (length - 2));
++
++ // if the slot we landed on is FULL (but not removed), probe
++ // until we find an empty slot, a REMOVED slot, or an element
++ // equal to the one we are trying to insert.
++ // finding an empty slot means that the value is not present
++ // and that we should use that slot as the insertion point;
++ // finding a REMOVED slot means that we need to keep searching,
++ // however we want to remember the offset of that REMOVED slot
++ // so we can reuse it in case a "new" insertion (i.e. not an update)
++ // is possible.
++ // finding a matching value means that we've found that our desired
++ // key is already in the table
++
++ if (states[index] != REMOVED) {
++ // starting at the natural offset, probe until we find an
++ // offset that isn't full.
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] == FULL && set[index] != val);
++ }
++
++ // if the index we found was removed: continue probing until we
++ // locate a free location or an element which equal()s the
++ // one we have.
++ if (states[index] == REMOVED) {
++ int firstRemoved = index;
++ while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ }
++ return states[index] == FULL ? -index -1 : firstRemoved;
++ }
++ // if it's full, the key is already stored
++ return states[index] == FULL ? -index -1 : index;
++ }
++ }
++
++ /**
++ * Default implementation of TFloatHashingStrategy:
++ * delegates hashing to HashFunctions.hash(float).
++ *
++ * @param val the value to hash
++ * @return the hashcode.
++ */
++ public final int computeHashCode(float val) {
++ return HashFunctions.hash(val);
++ }
++} // TFloatHash
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatHashingStrategy.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,49 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Serializable;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface to support pluggable hashing strategies in maps and sets.
++ * Implementors can use this interface to make the trove hashing
++ * algorithms use an optimal strategy when computing hashcodes.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHashingStrategy.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatHashingStrategy extends Serializable {
++ /**
++ * Computes a hash code for the specified float. Implementors
++ * can use the float's own value or a custom scheme designed to
++ * minimize collisions for a known set of input.
++ *
++ * @param val float for which the hashcode is to be computed
++ * @return the hashCode
++ */
++ public int computeHashCode(float val);
++} // TFloatHashingStrategy
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatHashSet.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,371 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed set implementation for float primitives.
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TFloatHashSet extends TFloatHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /**
++ * Creates a new <code>TFloatHashSet</code> instance with the default
++ * capacity and load factor.
++ */
++ public TFloatHashSet() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TFloatHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TFloatHashSet(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TFloatHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TFloatHashSet(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TFloatHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>float</code> primitives
++ */
++ public TFloatHashSet(float[] array) {
++ this(array.length);
++ addAll(array);
++ }
++
++ /**
++ * Creates a new <code>TFloatHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatHashSet(TFloatHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatHashSet(int initialCapacity, TFloatHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatHashSet(int initialCapacity, float loadFactor, TFloatHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>float</code> primitives
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatHashSet(float[] array, TFloatHashingStrategy strategy) {
++ this(array.length, strategy);
++ addAll(array);
++ }
++
++ /**
++ * @return a TFloatIterator with access to the values in this set
++ */
++ public TFloatIterator iterator() {
++ return new TFloatIterator(this);
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param val an <code>float</code> value
++ * @return true if the set was modified by the add operation
++ */
++ public boolean add(float val) {
++ int index = insertionIndex(val);
++
++ if (index < 0) {
++ return false; // already present in set, nothing to add
++ }
++
++ byte previousState = _states[index];
++ _set[index] = val;
++ _states[index] = FULL;
++ postInsertHook(previousState == FREE);
++
++ return true; // yes, we added something
++ }
++
++ /**
++ * Expands the set to accomodate new values.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ float oldSet[] = _set;
++ byte oldStates[] = _states;
++
++ _set = new float[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ float o = oldSet[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * Returns a new array containing the values in the set.
++ *
++ * @return an <code>float[]</code> value
++ */
++ public float[] toArray() {
++ float[] result = new float[size()];
++ float[] set = _set;
++ byte[] states = _states;
++
++ for (int i = states.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ result[j++] = set[i];
++ }
++ }
++ return result;
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ super.clear();
++ float[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ set[i] = (float)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TFloatHashSet)) {
++ return false;
++ }
++ final TFloatHashSet that = (TFloatHashSet)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEach(new TFloatProcedure() {
++ public final boolean execute(float value) {
++ return that.contains(value);
++ }
++ });
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEach(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TFloatProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(float key) {
++ h += _hashingStrategy.computeHashCode(key);
++ return true;
++ }
++ }
++
++ /**
++ * Removes <tt>val</tt> from the set.
++ *
++ * @param val an <code>float</code> value
++ * @return true if the set was modified by the remove operation.
++ */
++ public boolean remove(float val) {
++ int index = index(val);
++ if (index >= 0) {
++ removeAt(index);
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Tests the set to determine if all of the elements in
++ * <tt>array</tt> are present.
++ *
++ * @param array an <code>array</code> of float primitives.
++ * @return true if all elements were present in the set.
++ */
++ public boolean containsAll(float[] array) {
++ for (int i = array.length; i-- > 0;) {
++ if (! contains(array[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Adds all of the elements in <tt>array</tt> to the set.
++ *
++ * @param array an <code>array</code> of float primitives.
++ * @return true if the set was modified by the add all operation.
++ */
++ public boolean addAll(float[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (add(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes all of the elements in <tt>array</tt> from the set.
++ *
++ * @param array an <code>array</code> of float primitives.
++ * @return true if the set was modified by the remove all operation.
++ */
++ public boolean removeAll(float[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (remove(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes any values in the set which are not contained in
++ * <tt>array</tt>.
++ *
++ * @param array an <code>array</code> of float primitives.
++ * @return true if the set was modified by the retain all operation
++ */
++ public boolean retainAll(float[] array) {
++ boolean changed = false;
++ Arrays.sort(array);
++ float[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && (Arrays.binarySearch(array,set[i]) < 0)) {
++ remove(set[i]);
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure(out);
++ if (! forEach(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++
++ // ENTRIES
++ setUp(size);
++ while (size-- > 0) {
++ float val = in.readFloat();
++ add(val);
++ }
++ }
++} // TFloatHashSet
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatIntHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for float keys and int values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TFloatIntHashMap extends TFloatHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient int[] _values;
++
++ /**
++ * Creates a new <code>TFloatIntHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TFloatIntHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TFloatIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TFloatIntHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TFloatIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TFloatIntHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TFloatIntHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatIntHashMap(TFloatHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatIntHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatIntHashMap(int initialCapacity, TFloatHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatIntHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatIntHashMap(int initialCapacity, float loadFactor, TFloatHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TFloatIntHashMap m = (TFloatIntHashMap)super.clone();
++ m._values = (int[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TFloatIntIterator with access to this map's keys and values
++ */
++ public TFloatIntIterator iterator() {
++ return new TFloatIntIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new int[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>float</code> value
++ * @param value an <code>int</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (float)0 if none was found.
++ */
++ public int put(float key, int value) {
++ byte previousState;
++ int previous = (int)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ float oldKeys[] = _set;
++ int oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new float[newCapacity];
++ _values = new int[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ float o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>float</code> value
++ * @return the value of <tt>key</tt> or (float)0 if no such mapping exists.
++ */
++ public int get(float key) {
++ int index = index(key);
++ return index < 0 ? (int)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ float[] keys = _set;
++ int[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (float)0;
++ vals[i] = (int)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>float</code> value
++ * @return an <code>int</code> value, or (float)0 if no mapping for key exists
++ */
++ public int remove(float key) {
++ int prev = (int)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TFloatIntHashMap)) {
++ return false;
++ }
++ TFloatIntHashMap that = (TFloatIntHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TFloatIntProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(float key, int value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TFloatIntProcedure {
++ private final TFloatIntHashMap _otherMap;
++
++ EqProcedure(TFloatIntHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(float key, int value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two ints for equality.
++ */
++ private final boolean eq(int v1, int v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (int)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public int[] getValues() {
++ int[] vals = new int[size()];
++ int[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public float[] keys() {
++ float[] keys = new float[size()];
++ float[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(int val) {
++ byte[] states = _states;
++ int[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(float key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TFloatProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TIntProcedure procedure) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOFloatIntProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TFloatIntProcedure procedure) {
++ byte[] states = _states;
++ float[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TFloatIntProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ float[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TIntFunction</code> value
++ */
++ public void transformValues(TIntFunction function) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(float key) {
++ return adjustValue(key, (int)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(float key, int amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ float key = in.readFloat();
++ int val = in.readInt();
++ put(key, val);
++ }
++ }
++} // TFloatIntHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatIntIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type float and int.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TFloatIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TFloatIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TFloatIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TFloatIntIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TFloatIntIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TFloatIntHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TFloatIntIterator(TFloatIntHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public float key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public int value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public int setValue(int val) {
++ int old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TFloatIntIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatIntProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type float and int.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatIntProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>float</code> value
++ * @param b a <code>int</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(float a, int b);
++}// TFloatIntProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,56 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for float collections.
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TFloatIterator extends TPrimitiveIterator {
++ /** the collection on which the iterator operates */
++ private final TFloatHash _hash;
++
++ /**
++ * Creates a TFloatIterator for the elements in the specified collection.
++ */
++ public TFloatIterator(TFloatHash hash) {
++ super(hash);
++ this._hash = hash;
++ }
++
++ /**
++ * Advances the iterator to the next element in the underlying collection
++ * and returns it.
++ *
++ * @return the next float in the collection
++ * @exception NoSuchElementException if the iterator is already exhausted
++ */
++ public float next() {
++ moveToNextIndex();
++ return _hash._set[_index];
++ }
++}// TFloatIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatLongHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for float keys and long values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TFloatLongHashMap extends TFloatHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient long[] _values;
++
++ /**
++ * Creates a new <code>TFloatLongHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TFloatLongHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TFloatLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TFloatLongHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TFloatLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TFloatLongHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TFloatLongHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatLongHashMap(TFloatHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatLongHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatLongHashMap(int initialCapacity, TFloatHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatLongHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatLongHashMap(int initialCapacity, float loadFactor, TFloatHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TFloatLongHashMap m = (TFloatLongHashMap)super.clone();
++ m._values = (long[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TFloatLongIterator with access to this map's keys and values
++ */
++ public TFloatLongIterator iterator() {
++ return new TFloatLongIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new long[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>float</code> value
++ * @param value an <code>long</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (float)0 if none was found.
++ */
++ public long put(float key, long value) {
++ byte previousState;
++ long previous = (long)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ float oldKeys[] = _set;
++ long oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new float[newCapacity];
++ _values = new long[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ float o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>float</code> value
++ * @return the value of <tt>key</tt> or (float)0 if no such mapping exists.
++ */
++ public long get(float key) {
++ int index = index(key);
++ return index < 0 ? (long)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ float[] keys = _set;
++ long[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (float)0;
++ vals[i] = (long)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>float</code> value
++ * @return an <code>long</code> value, or (float)0 if no mapping for key exists
++ */
++ public long remove(float key) {
++ long prev = (long)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TFloatLongHashMap)) {
++ return false;
++ }
++ TFloatLongHashMap that = (TFloatLongHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TFloatLongProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(float key, long value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TFloatLongProcedure {
++ private final TFloatLongHashMap _otherMap;
++
++ EqProcedure(TFloatLongHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(float key, long value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two longs for equality.
++ */
++ private final boolean eq(long v1, long v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (long)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public long[] getValues() {
++ long[] vals = new long[size()];
++ long[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public float[] keys() {
++ float[] keys = new float[size()];
++ float[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(long val) {
++ byte[] states = _states;
++ long[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(float key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TFloatProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TLongProcedure procedure) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOFloatLongProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TFloatLongProcedure procedure) {
++ byte[] states = _states;
++ float[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TFloatLongProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ float[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TLongFunction</code> value
++ */
++ public void transformValues(TLongFunction function) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(float key) {
++ return adjustValue(key, (long)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(float key, long amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ float key = in.readFloat();
++ long val = in.readLong();
++ put(key, val);
++ }
++ }
++} // TFloatLongHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatLongIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type float and long.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TFloatLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TFloatLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TFloatLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TFloatLongIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TFloatLongIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TFloatLongHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TFloatLongIterator(TFloatLongHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public float key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public long value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public long setValue(long val) {
++ long old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TFloatLongIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatLongProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type float and long.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatLongProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>float</code> value
++ * @param b a <code>long</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(float a, long b);
++}// TFloatLongProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatObjectHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,507 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for float keys and Object values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TFloatObjectHashMap<V> extends TFloatHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient V[] _values;
++
++ /**
++ * Creates a new <code>TFloatObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TFloatObjectHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TFloatObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TFloatObjectHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TFloatObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TFloatObjectHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TFloatObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatObjectHashMap(TFloatHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatObjectHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatObjectHashMap(int initialCapacity, TFloatHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatObjectHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatObjectHashMap(int initialCapacity, float loadFactor, TFloatHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public TFloatObjectHashMap<V> clone() {
++ TFloatObjectHashMap<V> m = (TFloatObjectHashMap<V>)super.clone();
++ m._values = (V[]) this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TFloatObjectIterator with access to this map's keys and values
++ */
++ public TFloatObjectIterator<V> iterator() {
++ return new TFloatObjectIterator<V>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = (V[]) new Object[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>float</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (float)0 if none was found.
++ */
++ public V put(float key, V value) {
++ byte previousState;
++ V previous = null;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ float oldKeys[] = _set;
++ V oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new float[newCapacity];
++ _values = (V[]) new Object[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ float o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>float</code> value
++ * @return the value of <tt>key</tt> or (float)0 if no such mapping exists.
++ */
++ public V get(float key) {
++ int index = index(key);
++ return index < 0 ? null : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ float[] keys = _set;
++ Object[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (float)0;
++ vals[i] = null;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>float</code> value
++ * @return an <code>Object</code> value or (float)0 if no such mapping exists.
++ */
++ public V remove(float key) {
++ V prev = null;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TFloatObjectHashMap)) {
++ return false;
++ }
++ TFloatObjectHashMap that = (TFloatObjectHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TFloatObjectProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(float key, Object value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TFloatObjectProcedure {
++ private final TFloatObjectHashMap _otherMap;
++
++ EqProcedure(TFloatObjectHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(float key, Object value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two objects for equality.
++ */
++ private final boolean eq(Object o1, Object o2) {
++ return o1 == o2 || ((o1 != null) && o1.equals(o2));
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = null;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public Object[] getValues() {
++ Object[] vals = new Object[size()];
++ V[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public float[] keys() {
++ float[] keys = new float[size()];
++ float[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(V val) {
++ byte[] states = _states;
++ V[] vals = _values;
++
++ // special case null values so that we don't have to
++ // perform null checks before every call to equals()
++ if (null == val) {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ val == vals[i]) {
++ return true;
++ }
++ }
++ } else {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ (val == vals[i] || val.equals(vals[i]))) {
++ return true;
++ }
++ }
++ } // end of else
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(float key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TFloatProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOFloatObjectProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TFloatObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ float[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TFloatObjectProcedure<V> procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ float[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TObjectFunction</code> value
++ */
++ public void transformValues(TObjectFunction<V,V> function) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ float key = in.readFloat();
++ V val = (V) in.readObject();
++ put(key, val);
++ }
++ }
++} // TFloatObjectHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatObjectIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,151 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type float and Object.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TFloatObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TFloatObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TFloatObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TFloatObjectIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TFloatObjectIterator<V> extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TFloatObjectHashMap<V> _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TFloatObjectIterator(TFloatObjectHashMap<V> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException
++ * if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public float key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public V value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public V setValue(V val) {
++ V old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TFloatObjectIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatObjectProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type float and Object.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatObjectProcedure<T> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>float</code> value
++ * @param b an <code>Object</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(float a, T b);
++}// TFloatObjectProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,46 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures with one float paramater.
++ *
++ * Created: Mon Nov 5 21:45:49 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatProcedure {
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param value a value of type <code>float</code>
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(float value);
++}// TFloatProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatShortHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for float keys and short values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TFloatShortHashMap extends TFloatHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient short[] _values;
++
++ /**
++ * Creates a new <code>TFloatShortHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TFloatShortHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TFloatShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TFloatShortHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TFloatShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TFloatShortHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TFloatShortHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatShortHashMap(TFloatHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatShortHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatShortHashMap(int initialCapacity, TFloatHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TFloatShortHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TFloatShortHashMap(int initialCapacity, float loadFactor, TFloatHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TFloatShortHashMap m = (TFloatShortHashMap)super.clone();
++ m._values = (short[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TFloatShortIterator with access to this map's keys and values
++ */
++ public TFloatShortIterator iterator() {
++ return new TFloatShortIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new short[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>float</code> value
++ * @param value an <code>short</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (float)0 if none was found.
++ */
++ public short put(float key, short value) {
++ byte previousState;
++ short previous = (short)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ float oldKeys[] = _set;
++ short oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new float[newCapacity];
++ _values = new short[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ float o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>float</code> value
++ * @return the value of <tt>key</tt> or (float)0 if no such mapping exists.
++ */
++ public short get(float key) {
++ int index = index(key);
++ return index < 0 ? (short)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ float[] keys = _set;
++ short[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (float)0;
++ vals[i] = (short)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>float</code> value
++ * @return an <code>short</code> value, or (float)0 if no mapping for key exists
++ */
++ public short remove(float key) {
++ short prev = (short)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TFloatShortHashMap)) {
++ return false;
++ }
++ TFloatShortHashMap that = (TFloatShortHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TFloatShortProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(float key, short value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TFloatShortProcedure {
++ private final TFloatShortHashMap _otherMap;
++
++ EqProcedure(TFloatShortHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(float key, short value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two shorts for equality.
++ */
++ private final boolean eq(short v1, short v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (short)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public short[] getValues() {
++ short[] vals = new short[size()];
++ short[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public float[] keys() {
++ float[] keys = new float[size()];
++ float[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(short val) {
++ byte[] states = _states;
++ short[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(float key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TFloatProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TShortProcedure procedure) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOFloatShortProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TFloatShortProcedure procedure) {
++ byte[] states = _states;
++ float[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TFloatShortProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ float[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TShortFunction</code> value
++ */
++ public void transformValues(TShortFunction function) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(float key) {
++ return adjustValue(key, (short)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(float key, short amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ float key = in.readFloat();
++ short val = in.readShort();
++ put(key, val);
++ }
++ }
++} // TFloatShortHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatShortIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type float and short.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TFloatShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TFloatShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TFloatShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TFloatShortIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TFloatShortIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TFloatShortHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TFloatShortIterator(TFloatShortHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public float key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public short value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public short setValue(short val) {
++ short old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TFloatShortIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TFloatShortProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type float and short.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TFloatShortProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>float</code> value
++ * @param b a <code>short</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(float a, short b);
++}// TFloatShortProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntArrayList.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,905 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Externalizable;
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.util.Arrays;
++import java.util.Random;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * A resizable, array-backed list of int primitives.
++ *
++ * Created: Sat Dec 29 14:21:12 2001
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TIntArrayList implements Externalizable, Cloneable {
++ static final long serialVersionUID = 1L;
++
++ /** the data of the list */
++ protected int[] _data;
++
++ /** the index after the last entry in the list */
++ protected int _pos;
++
++ /** the default capacity for new lists */
++ protected static final int DEFAULT_CAPACITY = 10;
++
++ /**
++ * Creates a new <code>TIntArrayList</code> instance with the
++ * default capacity.
++ */
++ public TIntArrayList() {
++ this(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Creates a new <code>TIntArrayList</code> instance with the
++ * specified capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public TIntArrayList(int capacity) {
++ _data = new int[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Creates a new <code>TIntArrayList</code> instance whose
++ * capacity is the greater of the length of <tt>values</tt> and
++ * DEFAULT_CAPACITY and whose initial contents are the specified
++ * values.
++ *
++ * @param values an <code>int[]</code> value
++ */
++ public TIntArrayList(int[] values) {
++ this(Math.max(values.length, DEFAULT_CAPACITY));
++ add(values);
++ }
++
++ // sizing
++
++ /**
++ * Grow the internal array as needed to accomodate the specified
++ * number of elements. The size of the array ints on each
++ * resize unless <tt>capacity</tt> requires more than twice the
++ * current capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void ensureCapacity(int capacity) {
++ if (capacity > _data.length) {
++ int newCap = Math.max(_data.length << 1, capacity);
++ int[] tmp = new int[newCap];
++ System.arraycopy(_data, 0, tmp, 0, _data.length);
++ _data = tmp;
++ }
++ }
++
++ /**
++ * Returns the number of values in the list.
++ *
++ * @return the number of values in the list.
++ */
++ public int size() {
++ return _pos;
++ }
++
++ /**
++ * Tests whether this list contains any values.
++ *
++ * @return true if the list is empty.
++ */
++ public boolean isEmpty() {
++ return _pos == 0;
++ }
++
++ /**
++ * Sheds any excess capacity above and beyond the current size of
++ * the list.
++ */
++ public void trimToSize() {
++ if (_data.length > size()) {
++ int[] tmp = new int[size()];
++ toNativeArray(tmp, 0, tmp.length);
++ _data = tmp;
++ }
++ }
++
++ // modifying
++
++ /**
++ * Adds <tt>val</tt> to the end of the list, growing as needed.
++ *
++ * @param val an <code>int</code> value
++ */
++ public void add(int val) {
++ ensureCapacity(_pos + 1);
++ _data[_pos++] = val;
++ }
++
++ /**
++ * Adds the values in the array <tt>vals</tt> to the end of the
++ * list, in order.
++ *
++ * @param vals an <code>int[]</code> value
++ */
++ public void add(int[] vals) {
++ add(vals, 0, vals.length);
++ }
++
++ /**
++ * Adds a subset of the values in the array <tt>vals</tt> to the
++ * end of the list, in order.
++ *
++ * @param vals an <code>int[]</code> value
++ * @param offset the offset at which to start copying
++ * @param length the number of values to copy.
++ */
++ public void add(int[] vals, int offset, int length) {
++ ensureCapacity(_pos + length);
++ System.arraycopy(vals, offset, _data, _pos, length);
++ _pos += length;
++ }
++
++ /**
++ * Inserts <tt>value</tt> into the list at <tt>offset</tt>. All
++ * values including and to the right of <tt>offset</tt> are shifted
++ * to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param value an <code>int</code> value
++ */
++ public void insert(int offset, int value) {
++ if (offset == _pos) {
++ add(value);
++ return;
++ }
++ ensureCapacity(_pos + 1);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + 1, _pos - offset);
++ // insert
++ _data[offset] = value;
++ _pos++;
++ }
++
++ /**
++ * Inserts the array of <tt>values</tt> into the list at
++ * <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>int[]</code> value
++ */
++ public void insert(int offset, int[] values) {
++ insert(offset, values, 0, values.length);
++ }
++
++ /**
++ * Inserts a slice of the array of <tt>values</tt> into the list
++ * at <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>int[]</code> value
++ * @param valOffset the offset in the values array at which to
++ * start copying.
++ * @param len the number of values to copy from the values array
++ */
++ public void insert(int offset, int[] values, int valOffset, int len) {
++ if (offset == _pos) {
++ add(values, valOffset, len);
++ return;
++ }
++
++ ensureCapacity(_pos + len);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + len, _pos - offset);
++ // insert
++ System.arraycopy(values, valOffset, _data, offset, len);
++ _pos += len;
++ }
++
++ /**
++ * Returns the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>int</code> value
++ */
++ public int get(int offset) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ return _data[offset];
++ }
++
++ /**
++ * Returns the value at the specified offset without doing any
++ * bounds checking.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>int</code> value
++ */
++ public int getQuick(int offset) {
++ return _data[offset];
++ }
++
++ /**
++ * Sets the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>int</code> value
++ */
++ public void set(int offset, int val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ _data[offset] = val;
++ }
++
++ /**
++ * Sets the value at the specified offset and returns the
++ * previously stored value.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>int</code> value
++ * @return the value previously stored at offset.
++ */
++ public int getSet(int offset, int val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ int old = _data[offset];
++ _data[offset] = val;
++ return old;
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * the contents of the <tt>values</tt> array.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ */
++ public void set(int offset, int[] values) {
++ set(offset, values, 0, values.length);
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * <tt>length</tt> values from the <tt>values</tt> array, starting
++ * at valOffset.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ * @param valOffset the first value to copy from the values array
++ * @param length the number of values to copy
++ */
++ public void set(int offset, int[] values, int valOffset, int length) {
++ if (offset < 0 || offset + length > _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(values, valOffset, _data, offset, length);
++ }
++
++ /**
++ * Sets the value at the specified offset without doing any bounds
++ * checking.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>int</code> value
++ */
++ public void setQuick(int offset, int val) {
++ _data[offset] = val;
++ }
++
++ /**
++ * Flushes the internal state of the list, resetting the capacity
++ * to the default.
++ */
++ public void clear() {
++ clear(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Flushes the internal state of the list, setting the capacity of
++ * the empty list to <tt>capacity</tt>.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void clear(int capacity) {
++ _data = new int[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list without
++ * allocating new backing arrays.
++ *
++ * @see #clear
++ */
++ public void reset() {
++ _pos = 0;
++ fill((int)0);
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list
++ * without allocating new backing arrays. This method differs
++ * from {@link #reset reset} in that it does not clear the old
++ * values in the backing array. Thus, it is possible for {@link
++ * #getQuick getQuick} to return stale data if this method is used
++ * and the caller is careless about bounds checking.
++ *
++ * @see #reset
++ * @see #clear
++ * @see #getQuick
++ */
++ public void resetQuick() {
++ _pos = 0;
++ }
++
++ /**
++ * Removes the value at <tt>offset</tt> from the list.
++ *
++ * @param offset an <code>int</code> value
++ * @return the value previously stored at offset.
++ */
++ public int remove(int offset) {
++ int old = get(offset);
++ remove(offset, 1);
++ return old;
++ }
++
++ /**
++ * Removes <tt>length</tt> values from the list, starting at
++ * <tt>offset</tt>
++ *
++ * @param offset an <code>int</code> value
++ * @param length an <code>int</code> value
++ */
++ public void remove(int offset, int length) {
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++
++ if (offset == 0) {
++ // data at the front
++ System.arraycopy(_data, length, _data, 0, _pos - length);
++ } else if (_pos - length == offset) {
++ // no copy to make, decrementing pos "deletes" values at
++ // the end
++ } else {
++ // data in the middle
++ System.arraycopy(_data, offset + length,
++ _data, offset, _pos - (offset + length));
++ }
++ _pos -= length;
++ // no need to clear old values beyond _pos, because this is a
++ // primitive collection and 0 takes as much room as any other
++ // value
++ }
++
++ /**
++ * Transform each value in the list using the specified function.
++ *
++ * @param function a <code>TIntFunction</code> value
++ */
++ public void transformValues(TIntFunction function) {
++ for (int i = _pos; i-- > 0;) {
++ _data[i] = function.execute(_data[i]);
++ }
++ }
++
++ /**
++ * Reverse the order of the elements in the list.
++ */
++ public void reverse() {
++ reverse(0, _pos);
++ }
++
++ /**
++ * Reverse the order of the elements in the range of the list.
++ *
++ * @param from the inclusive index at which to start reversing
++ * @param to the exclusive index at which to stop reversing
++ */
++ public void reverse(int from, int to) {
++ if (from == to) {
++ return; // nothing to do
++ }
++ if (from > to) {
++ throw new IllegalArgumentException("from cannot be greater than to");
++ }
++ for (int i = from, j = to - 1; i < j; i++, j--) {
++ swap(i, j);
++ }
++ }
++
++ /**
++ * Shuffle the elements of the list using the specified random
++ * number generator.
++ *
++ * @param rand a <code>Random</code> value
++ */
++ public void shuffle(Random rand) {
++ for (int i = _pos; i-- > 1;) {
++ swap(i, rand.nextInt(i));
++ }
++ }
++
++ /**
++ * Swap the values at offsets <tt>i</tt> and <tt>j</tt>.
++ *
++ * @param i an offset into the data array
++ * @param j an offset into the data array
++ */
++ private final void swap(int i, int j) {
++ int tmp = _data[i];
++ _data[i] = _data[j];
++ _data[j] = tmp;
++ }
++
++ // copying
++
++ /**
++ * Returns a clone of this list. Since this is a primitive
++ * collection, this will be a deep clone.
++ *
++ * @return a deep clone of the list.
++ */
++ public Object clone() {
++ TIntArrayList list = null;
++ try {
++ list = (TIntArrayList) super.clone();
++ list._data = toNativeArray();
++ } catch (CloneNotSupportedException e) {
++ // it's supported
++ } // end of try-catch
++ return list;
++ }
++
++ /**
++ * Copies the contents of the list into a native array.
++ *
++ * @return an <code>int[]</code> value
++ */
++ public int[] toNativeArray() {
++ return toNativeArray(0, _pos);
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param offset the offset at which to start copying
++ * @param len the number of values to copy.
++ * @return an <code>int[]</code> value
++ */
++ public int[] toNativeArray(int offset, int len) {
++ int[] rv = new int[len];
++ toNativeArray(rv, offset, len);
++ return rv;
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param dest the array to copy into.
++ * @param offset the offset of the first value to copy
++ * @param len the number of values to copy.
++ */
++ public void toNativeArray(int[] dest, int offset, int len) {
++ if (len == 0) {
++ return; // nothing to copy
++ }
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(_data, offset, dest, 0, len);
++ }
++
++ // comparing
++
++ /**
++ * Compares this list to another list, value by value.
++ *
++ * @param other the object to compare against
++ * @return true if other is a TIntArrayList and has exactly the
++ * same values.
++ */
++ public boolean equals(Object other) {
++ if (other == this) {
++ return true;
++ } else if (other instanceof TIntArrayList) {
++ TIntArrayList that = (TIntArrayList)other;
++ if (that.size() != this.size()) {
++ return false;
++ } else {
++ for (int i = _pos; i-- > 0;) {
++ if (this._data[i] != that._data[i]) {
++ return false;
++ }
++ }
++ return true;
++ }
++ } else {
++ return false;
++ }
++ }
++
++ public int hashCode() {
++ int h = 0;
++ for (int i = _pos; i-- > 0;) {
++ h += HashFunctions.hash(_data[i]);
++ }
++ return h;
++ }
++
++ // procedures
++
++ /**
++ * Applies the procedure to each value in the list in ascending
++ * (front to back) order.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEach(TIntProcedure procedure) {
++ for (int i = 0; i < _pos; i++) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Applies the procedure to each value in the list in descending
++ * (back to front) order.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEachDescending(TIntProcedure procedure) {
++ for (int i = _pos; i-- > 0;) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ // sorting
++
++ /**
++ * Sort the values in the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @see java.util.Arrays#sort
++ */
++ public void sort() {
++ Arrays.sort(_data, 0, _pos);
++ }
++
++ /**
++ * Sort a slice of the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @param fromIndex the index at which to start sorting (inclusive)
++ * @param toIndex the index at which to stop sorting (exclusive)
++ * @see java.util.Arrays#sort
++ */
++ public void sort(int fromIndex, int toIndex) {
++ Arrays.sort(_data, fromIndex, toIndex);
++ }
++
++ // filling
++
++ /**
++ * Fills every slot in the list with the specified value.
++ *
++ * @param val the value to use when filling
++ */
++ public void fill(int val) {
++ Arrays.fill(_data, 0, _pos, val);
++ }
++
++ /**
++ * Fills a range in the list with the specified value.
++ *
++ * @param fromIndex the offset at which to start filling (inclusive)
++ * @param toIndex the offset at which to stop filling (exclusive)
++ * @param val the value to use when filling
++ */
++ public void fill(int fromIndex, int toIndex, int val) {
++ if (toIndex > _pos) {
++ ensureCapacity(toIndex);
++ _pos = toIndex;
++ }
++ Arrays.fill(_data, fromIndex, toIndex, val);
++ }
++
++ // searching
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the entire list.
++ * Note that you <b>must</b> @{link #sort sort} the list before
++ * doing a search.
++ *
++ * @param value the value to search for
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(int value) {
++ return binarySearch(value, 0, _pos);
++ }
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the specified
++ * range. Note that you <b>must</b> @{link #sort sort} the list
++ * or the range before doing a search.
++ *
++ * @param value the value to search for
++ * @param fromIndex the lower boundary of the range (inclusive)
++ * @param toIndex the upper boundary of the range (exclusive)
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(int value, int fromIndex, int toIndex) {
++ if (fromIndex < 0) {
++ throw new ArrayIndexOutOfBoundsException(fromIndex);
++ }
++ if (toIndex > _pos) {
++ throw new ArrayIndexOutOfBoundsException(toIndex);
++ }
++
++ int low = fromIndex;
++ int high = toIndex - 1;
++
++ while (low <= high) {
++ int mid = (low + high) >> 1;
++ int midVal = _data[mid];
++
++ if (midVal < value) {
++ low = mid + 1;
++ } else if (midVal > value) {
++ high = mid - 1;
++ } else {
++ return mid; // value found
++ }
++ }
++ return -(low + 1); // value not found.
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>int</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(int value) {
++ return indexOf(0, value);
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (inclusive)
++ * @param value an <code>int</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(int offset, int value) {
++ for (int i = offset; i < _pos; i++) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>int</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(int value) {
++ return lastIndexOf(_pos, value);
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (exclusive)
++ * @param value an <code>int</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(int offset, int value) {
++ for (int i = offset; i-- > 0;) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list for <tt>value</tt>
++ *
++ * @param value an <code>int</code> value
++ * @return true if value is in the list.
++ */
++ public boolean contains(int value) {
++ return lastIndexOf(value) >= 0;
++ }
++
++ /**
++ * Searches the list for values satisfying <tt>condition</tt> in
++ * the manner of the *nix <tt>grep</tt> utility.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which match the condition.
++ */
++ public TIntArrayList grep(TIntProcedure condition) {
++ TIntArrayList list = new TIntArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Searches the list for values which do <b>not</b> satisfy
++ * <tt>condition</tt>. This is akin to *nix <code>grep -v</code>.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which do not match the condition.
++ */
++ public TIntArrayList inverseGrep(TIntProcedure condition) {
++ TIntArrayList list = new TIntArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (! condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Finds the maximum value in the list.
++ *
++ * @return the largest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public int max() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find maximum of an empty list");
++ }
++ int max = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > max ) {
++ max = _data[_pos];
++ }
++ }
++ return max;
++ }
++
++ /**
++ * Finds the minimum value in the list.
++ *
++ * @return the smallest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public int min() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find minimum of an empty list");
++ }
++ int min = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > min ) {
++ min = _data[_pos];
++ }
++ }
++ return min;
++ }
++
++ // stringification
++
++ /**
++ * Returns a String representation of the list, front to back.
++ *
++ * @return a <code>String</code> value
++ */
++ public String toString() {
++ final StringBuffer buf = new StringBuffer("{");
++ for (int i = 0, end = _pos - 1; i < end; i++) {
++ buf.append(_data[i]);
++ buf.append(", ");
++ }
++ if (size() > 0) {
++ buf.append(_data[_pos - 1]);
++ }
++ buf.append("}");
++ return buf.toString();
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // POSITION
++ out.writeInt( _pos );
++
++ // ENTRIES
++ int len = _data.length;
++ out.writeInt( len );
++ for( int i = 0; i < len; i++ ) {
++ out.writeInt( _data[ i ] );
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // POSITION
++ _pos = in.readInt();
++
++ // ENTRIES
++ int len = in.readInt();
++ _data = new int[ len ];
++ for( int i = 0; i < len; i++ ) {
++ _data[ i ] = in.readInt();
++ }
++ }
++} // TIntArrayList
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntByteHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for int keys and byte values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TIntByteHashMap extends TIntHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient byte[] _values;
++
++ /**
++ * Creates a new <code>TIntByteHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TIntByteHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TIntByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TIntByteHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TIntByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TIntByteHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TIntByteHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntByteHashMap(TIntHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntByteHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntByteHashMap(int initialCapacity, TIntHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntByteHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntByteHashMap(int initialCapacity, float loadFactor, TIntHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TIntByteHashMap m = (TIntByteHashMap)super.clone();
++ m._values = (byte[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TIntByteIterator with access to this map's keys and values
++ */
++ public TIntByteIterator iterator() {
++ return new TIntByteIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new byte[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>int</code> value
++ * @param value an <code>byte</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (int)0 if none was found.
++ */
++ public byte put(int key, byte value) {
++ byte previousState;
++ byte previous = (byte)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ int oldKeys[] = _set;
++ byte oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new int[newCapacity];
++ _values = new byte[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ int o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>int</code> value
++ * @return the value of <tt>key</tt> or (int)0 if no such mapping exists.
++ */
++ public byte get(int key) {
++ int index = index(key);
++ return index < 0 ? (byte)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ int[] keys = _set;
++ byte[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (int)0;
++ vals[i] = (byte)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>int</code> value
++ * @return an <code>byte</code> value, or (int)0 if no mapping for key exists
++ */
++ public byte remove(int key) {
++ byte prev = (byte)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TIntByteHashMap)) {
++ return false;
++ }
++ TIntByteHashMap that = (TIntByteHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TIntByteProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(int key, byte value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TIntByteProcedure {
++ private final TIntByteHashMap _otherMap;
++
++ EqProcedure(TIntByteHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(int key, byte value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two bytes for equality.
++ */
++ private final boolean eq(byte v1, byte v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (byte)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public byte[] getValues() {
++ byte[] vals = new byte[size()];
++ byte[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public int[] keys() {
++ int[] keys = new int[size()];
++ int[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(byte val) {
++ byte[] states = _states;
++ byte[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(int key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TIntProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TByteProcedure procedure) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOIntByteProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TIntByteProcedure procedure) {
++ byte[] states = _states;
++ int[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TIntByteProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ int[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TByteFunction</code> value
++ */
++ public void transformValues(TByteFunction function) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(int key) {
++ return adjustValue(key, (byte)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(int key, byte amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ int key = in.readInt();
++ byte val = in.readByte();
++ put(key, val);
++ }
++ }
++} // TIntByteHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntByteIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type int and byte.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TIntByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TIntByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TIntByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TIntByteIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TIntByteIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TIntByteHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TIntByteIterator(TIntByteHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public int key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public byte value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public byte setValue(byte val) {
++ byte old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TIntByteIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntByteProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type int and byte.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntByteProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>int</code> value
++ * @param b a <code>byte</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(int a, byte b);
++}// TIntByteProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntDoubleHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for int keys and double values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TIntDoubleHashMap extends TIntHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient double[] _values;
++
++ /**
++ * Creates a new <code>TIntDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TIntDoubleHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TIntDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TIntDoubleHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TIntDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TIntDoubleHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TIntDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntDoubleHashMap(TIntHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntDoubleHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntDoubleHashMap(int initialCapacity, TIntHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntDoubleHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntDoubleHashMap(int initialCapacity, float loadFactor, TIntHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TIntDoubleHashMap m = (TIntDoubleHashMap)super.clone();
++ m._values = (double[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TIntDoubleIterator with access to this map's keys and values
++ */
++ public TIntDoubleIterator iterator() {
++ return new TIntDoubleIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new double[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>int</code> value
++ * @param value an <code>double</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (int)0 if none was found.
++ */
++ public double put(int key, double value) {
++ byte previousState;
++ double previous = (double)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ int oldKeys[] = _set;
++ double oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new int[newCapacity];
++ _values = new double[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ int o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>int</code> value
++ * @return the value of <tt>key</tt> or (int)0 if no such mapping exists.
++ */
++ public double get(int key) {
++ int index = index(key);
++ return index < 0 ? (double)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ int[] keys = _set;
++ double[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (int)0;
++ vals[i] = (double)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>int</code> value
++ * @return an <code>double</code> value, or (int)0 if no mapping for key exists
++ */
++ public double remove(int key) {
++ double prev = (double)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TIntDoubleHashMap)) {
++ return false;
++ }
++ TIntDoubleHashMap that = (TIntDoubleHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TIntDoubleProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(int key, double value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TIntDoubleProcedure {
++ private final TIntDoubleHashMap _otherMap;
++
++ EqProcedure(TIntDoubleHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(int key, double value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two doubles for equality.
++ */
++ private final boolean eq(double v1, double v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (double)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public double[] getValues() {
++ double[] vals = new double[size()];
++ double[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public int[] keys() {
++ int[] keys = new int[size()];
++ int[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(double val) {
++ byte[] states = _states;
++ double[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(int key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TIntProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TDoubleProcedure procedure) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOIntDoubleProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TIntDoubleProcedure procedure) {
++ byte[] states = _states;
++ int[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TIntDoubleProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ int[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TDoubleFunction</code> value
++ */
++ public void transformValues(TDoubleFunction function) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(int key) {
++ return adjustValue(key, (double)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(int key, double amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ int key = in.readInt();
++ double val = in.readDouble();
++ put(key, val);
++ }
++ }
++} // TIntDoubleHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntDoubleIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type int and double.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TIntDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TIntDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TIntDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TIntDoubleIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TIntDoubleIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TIntDoubleHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TIntDoubleIterator(TIntDoubleHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public int key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public double value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public double setValue(double val) {
++ double old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TIntDoubleIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntDoubleProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type int and double.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntDoubleProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>int</code> value
++ * @param b a <code>double</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(int a, double b);
++}// TIntDoubleProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntFloatHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for int keys and float values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TIntFloatHashMap extends TIntHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient float[] _values;
++
++ /**
++ * Creates a new <code>TIntFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TIntFloatHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TIntFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TIntFloatHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TIntFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TIntFloatHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TIntFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntFloatHashMap(TIntHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntFloatHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntFloatHashMap(int initialCapacity, TIntHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntFloatHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntFloatHashMap(int initialCapacity, float loadFactor, TIntHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TIntFloatHashMap m = (TIntFloatHashMap)super.clone();
++ m._values = (float[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TIntFloatIterator with access to this map's keys and values
++ */
++ public TIntFloatIterator iterator() {
++ return new TIntFloatIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new float[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>int</code> value
++ * @param value an <code>float</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (int)0 if none was found.
++ */
++ public float put(int key, float value) {
++ byte previousState;
++ float previous = (float)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ int oldKeys[] = _set;
++ float oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new int[newCapacity];
++ _values = new float[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ int o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>int</code> value
++ * @return the value of <tt>key</tt> or (int)0 if no such mapping exists.
++ */
++ public float get(int key) {
++ int index = index(key);
++ return index < 0 ? (float)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ int[] keys = _set;
++ float[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (int)0;
++ vals[i] = (float)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>int</code> value
++ * @return an <code>float</code> value, or (int)0 if no mapping for key exists
++ */
++ public float remove(int key) {
++ float prev = (float)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TIntFloatHashMap)) {
++ return false;
++ }
++ TIntFloatHashMap that = (TIntFloatHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TIntFloatProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(int key, float value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TIntFloatProcedure {
++ private final TIntFloatHashMap _otherMap;
++
++ EqProcedure(TIntFloatHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(int key, float value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two floats for equality.
++ */
++ private final boolean eq(float v1, float v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (float)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public float[] getValues() {
++ float[] vals = new float[size()];
++ float[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public int[] keys() {
++ int[] keys = new int[size()];
++ int[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(float val) {
++ byte[] states = _states;
++ float[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(int key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TIntProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TFloatProcedure procedure) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOIntFloatProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TIntFloatProcedure procedure) {
++ byte[] states = _states;
++ int[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TIntFloatProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ int[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TFloatFunction</code> value
++ */
++ public void transformValues(TFloatFunction function) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(int key) {
++ return adjustValue(key, (float)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(int key, float amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ int key = in.readInt();
++ float val = in.readFloat();
++ put(key, val);
++ }
++ }
++} // TIntFloatHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntFloatIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type int and float.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TIntFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TIntFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TIntFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TIntFloatIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TIntFloatIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TIntFloatHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TIntFloatIterator(TIntFloatHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public int key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public float value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public float setValue(float val) {
++ float old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TIntFloatIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntFloatProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type int and float.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntFloatProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>int</code> value
++ * @param b a <code>float</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(int a, float b);
++}// TIntFloatProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntFunction.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,43 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for functions that accept and return one int primitive.
++ *
++ * Created: Mon Nov 5 22:19:36 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PFunction.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntFunction {
++ /**
++ * Execute this function with <tt>value</tt>
++ *
++ * @param value a <code>int</code> input
++ * @return a <code>int</code> result
++ */
++ public int execute(int value);
++}// TIntFunction
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntHash.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,289 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed hashing implementation for int primitives.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHash.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++abstract public class TIntHash extends TPrimitiveHash implements TIntHashingStrategy {
++
++ /** the set of ints */
++ protected transient int[] _set;
++
++ /** strategy used to hash values in this collection */
++ protected TIntHashingStrategy _hashingStrategy;
++
++ /**
++ * Creates a new <code>TIntHash</code> instance with the default
++ * capacity and load factor.
++ */
++ public TIntHash() {
++ super();
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TIntHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TIntHash(int initialCapacity) {
++ super(initialCapacity);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TIntHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ */
++ public TIntHash(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TIntHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntHash(TIntHashingStrategy strategy) {
++ super();
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TIntHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntHash(int initialCapacity, TIntHashingStrategy strategy) {
++ super(initialCapacity);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TIntHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntHash(int initialCapacity, float loadFactor, TIntHashingStrategy strategy) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TIntHash h = (TIntHash)super.clone();
++ h._set = (int[])this._set.clone();
++ return h;
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _set = new int[capacity];
++ return capacity;
++ }
++
++ /**
++ * Searches the set for <tt>val</tt>
++ *
++ * @param val an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean contains(int val) {
++ return index(val) >= 0;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each element in the set.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the set terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEach(TIntProcedure procedure) {
++ byte[] states = _states;
++ int[] set = _set;
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(set[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Releases the element currently stored at <tt>index</tt>.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _set[index] = (int)0;
++ super.removeAt(index);
++ }
++
++ /**
++ * Locates the index of <tt>val</tt>.
++ *
++ * @param val an <code>int</code> value
++ * @return the index of <tt>val</tt> or -1 if it isn't in the set.
++ */
++ protected int index(int val) {
++ int hash, probe, index, length;
++ int[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ // see Knuth, p. 529
++ probe = 1 + (hash % (length - 2));
++
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val));
++ }
++
++ return states[index] == FREE ? -1 : index;
++ }
++
++ /**
++ * Locates the index at which <tt>val</tt> can be inserted. if
++ * there is already a value equal()ing <tt>val</tt> in the set,
++ * returns that value as a negative integer.
++ *
++ * @param val an <code>int</code> value
++ * @return an <code>int</code> value
++ */
++ protected int insertionIndex(int val) {
++ int hash, probe, index, length;
++ int[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] == FREE) {
++ return index; // empty, all done
++ } else if (states[index] == FULL && set[index] == val) {
++ return -index -1; // already stored
++ } else { // already FULL or REMOVED, must probe
++ // compute the double hash
++ probe = 1 + (hash % (length - 2));
++
++ // if the slot we landed on is FULL (but not removed), probe
++ // until we find an empty slot, a REMOVED slot, or an element
++ // equal to the one we are trying to insert.
++ // finding an empty slot means that the value is not present
++ // and that we should use that slot as the insertion point;
++ // finding a REMOVED slot means that we need to keep searching,
++ // however we want to remember the offset of that REMOVED slot
++ // so we can reuse it in case a "new" insertion (i.e. not an update)
++ // is possible.
++ // finding a matching value means that we've found that our desired
++ // key is already in the table
++
++ if (states[index] != REMOVED) {
++ // starting at the natural offset, probe until we find an
++ // offset that isn't full.
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] == FULL && set[index] != val);
++ }
++
++ // if the index we found was removed: continue probing until we
++ // locate a free location or an element which equal()s the
++ // one we have.
++ if (states[index] == REMOVED) {
++ int firstRemoved = index;
++ while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ }
++ return states[index] == FULL ? -index -1 : firstRemoved;
++ }
++ // if it's full, the key is already stored
++ return states[index] == FULL ? -index -1 : index;
++ }
++ }
++
++ /**
++ * Default implementation of TIntHashingStrategy:
++ * delegates hashing to HashFunctions.hash(int).
++ *
++ * @param val the value to hash
++ * @return the hashcode.
++ */
++ public final int computeHashCode(int val) {
++ return HashFunctions.hash(val);
++ }
++} // TIntHash
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntHashingStrategy.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,49 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Serializable;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface to support pluggable hashing strategies in maps and sets.
++ * Implementors can use this interface to make the trove hashing
++ * algorithms use an optimal strategy when computing hashcodes.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHashingStrategy.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntHashingStrategy extends Serializable {
++ /**
++ * Computes a hash code for the specified int. Implementors
++ * can use the int's own value or a custom scheme designed to
++ * minimize collisions for a known set of input.
++ *
++ * @param val int for which the hashcode is to be computed
++ * @return the hashCode
++ */
++ public int computeHashCode(int val);
++} // TIntHashingStrategy
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntHashSet.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,371 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed set implementation for int primitives.
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TIntHashSet extends TIntHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /**
++ * Creates a new <code>TIntHashSet</code> instance with the default
++ * capacity and load factor.
++ */
++ public TIntHashSet() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TIntHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TIntHashSet(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TIntHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TIntHashSet(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TIntHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>int</code> primitives
++ */
++ public TIntHashSet(int[] array) {
++ this(array.length);
++ addAll(array);
++ }
++
++ /**
++ * Creates a new <code>TIntHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntHashSet(TIntHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntHashSet(int initialCapacity, TIntHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntHashSet(int initialCapacity, float loadFactor, TIntHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>int</code> primitives
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntHashSet(int[] array, TIntHashingStrategy strategy) {
++ this(array.length, strategy);
++ addAll(array);
++ }
++
++ /**
++ * @return a TIntIterator with access to the values in this set
++ */
++ public TIntIterator iterator() {
++ return new TIntIterator(this);
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param val an <code>int</code> value
++ * @return true if the set was modified by the add operation
++ */
++ public boolean add(int val) {
++ int index = insertionIndex(val);
++
++ if (index < 0) {
++ return false; // already present in set, nothing to add
++ }
++
++ byte previousState = _states[index];
++ _set[index] = val;
++ _states[index] = FULL;
++ postInsertHook(previousState == FREE);
++
++ return true; // yes, we added something
++ }
++
++ /**
++ * Expands the set to accomodate new values.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ int oldSet[] = _set;
++ byte oldStates[] = _states;
++
++ _set = new int[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ int o = oldSet[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * Returns a new array containing the values in the set.
++ *
++ * @return an <code>int[]</code> value
++ */
++ public int[] toArray() {
++ int[] result = new int[size()];
++ int[] set = _set;
++ byte[] states = _states;
++
++ for (int i = states.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ result[j++] = set[i];
++ }
++ }
++ return result;
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ super.clear();
++ int[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ set[i] = (int)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TIntHashSet)) {
++ return false;
++ }
++ final TIntHashSet that = (TIntHashSet)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEach(new TIntProcedure() {
++ public final boolean execute(int value) {
++ return that.contains(value);
++ }
++ });
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEach(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TIntProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(int key) {
++ h += _hashingStrategy.computeHashCode(key);
++ return true;
++ }
++ }
++
++ /**
++ * Removes <tt>val</tt> from the set.
++ *
++ * @param val an <code>int</code> value
++ * @return true if the set was modified by the remove operation.
++ */
++ public boolean remove(int val) {
++ int index = index(val);
++ if (index >= 0) {
++ removeAt(index);
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Tests the set to determine if all of the elements in
++ * <tt>array</tt> are present.
++ *
++ * @param array an <code>array</code> of int primitives.
++ * @return true if all elements were present in the set.
++ */
++ public boolean containsAll(int[] array) {
++ for (int i = array.length; i-- > 0;) {
++ if (! contains(array[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Adds all of the elements in <tt>array</tt> to the set.
++ *
++ * @param array an <code>array</code> of int primitives.
++ * @return true if the set was modified by the add all operation.
++ */
++ public boolean addAll(int[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (add(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes all of the elements in <tt>array</tt> from the set.
++ *
++ * @param array an <code>array</code> of int primitives.
++ * @return true if the set was modified by the remove all operation.
++ */
++ public boolean removeAll(int[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (remove(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes any values in the set which are not contained in
++ * <tt>array</tt>.
++ *
++ * @param array an <code>array</code> of int primitives.
++ * @return true if the set was modified by the retain all operation
++ */
++ public boolean retainAll(int[] array) {
++ boolean changed = false;
++ Arrays.sort(array);
++ int[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && (Arrays.binarySearch(array,set[i]) < 0)) {
++ remove(set[i]);
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure(out);
++ if (! forEach(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++
++ // ENTRIES
++ setUp(size);
++ while (size-- > 0) {
++ int val = in.readInt();
++ add(val);
++ }
++ }
++} // TIntHashSet
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntIntHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for int keys and int values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TIntIntHashMap extends TIntHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient int[] _values;
++
++ /**
++ * Creates a new <code>TIntIntHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TIntIntHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TIntIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TIntIntHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TIntIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TIntIntHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TIntIntHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntIntHashMap(TIntHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntIntHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntIntHashMap(int initialCapacity, TIntHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntIntHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntIntHashMap(int initialCapacity, float loadFactor, TIntHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TIntIntHashMap m = (TIntIntHashMap)super.clone();
++ m._values = (int[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TIntIntIterator with access to this map's keys and values
++ */
++ public TIntIntIterator iterator() {
++ return new TIntIntIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new int[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>int</code> value
++ * @param value an <code>int</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (int)0 if none was found.
++ */
++ public int put(int key, int value) {
++ byte previousState;
++ int previous = (int)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ int oldKeys[] = _set;
++ int oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new int[newCapacity];
++ _values = new int[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ int o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>int</code> value
++ * @return the value of <tt>key</tt> or (int)0 if no such mapping exists.
++ */
++ public int get(int key) {
++ int index = index(key);
++ return index < 0 ? (int)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ int[] keys = _set;
++ int[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (int)0;
++ vals[i] = (int)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>int</code> value
++ * @return an <code>int</code> value, or (int)0 if no mapping for key exists
++ */
++ public int remove(int key) {
++ int prev = (int)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TIntIntHashMap)) {
++ return false;
++ }
++ TIntIntHashMap that = (TIntIntHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TIntIntProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(int key, int value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TIntIntProcedure {
++ private final TIntIntHashMap _otherMap;
++
++ EqProcedure(TIntIntHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(int key, int value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two ints for equality.
++ */
++ private final boolean eq(int v1, int v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (int)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public int[] getValues() {
++ int[] vals = new int[size()];
++ int[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public int[] keys() {
++ int[] keys = new int[size()];
++ int[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(int val) {
++ byte[] states = _states;
++ int[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(int key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TIntProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TIntProcedure procedure) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOIntIntProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TIntIntProcedure procedure) {
++ byte[] states = _states;
++ int[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TIntIntProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ int[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TIntFunction</code> value
++ */
++ public void transformValues(TIntFunction function) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(int key) {
++ return adjustValue(key, (int)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(int key, int amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ int key = in.readInt();
++ int val = in.readInt();
++ put(key, val);
++ }
++ }
++} // TIntIntHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntIntIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type int and int.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TIntIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TIntIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TIntIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TIntIntIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TIntIntIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TIntIntHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TIntIntIterator(TIntIntHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public int key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public int value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public int setValue(int val) {
++ int old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TIntIntIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntIntProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type int and int.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntIntProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>int</code> value
++ * @param b a <code>int</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(int a, int b);
++}// TIntIntProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,56 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for int collections.
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TIntIterator extends TPrimitiveIterator {
++ /** the collection on which the iterator operates */
++ private final TIntHash _hash;
++
++ /**
++ * Creates a TIntIterator for the elements in the specified collection.
++ */
++ public TIntIterator(TIntHash hash) {
++ super(hash);
++ this._hash = hash;
++ }
++
++ /**
++ * Advances the iterator to the next element in the underlying collection
++ * and returns it.
++ *
++ * @return the next int in the collection
++ * @exception NoSuchElementException if the iterator is already exhausted
++ */
++ public int next() {
++ moveToNextIndex();
++ return _hash._set[_index];
++ }
++}// TIntIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntLongHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for int keys and long values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TIntLongHashMap extends TIntHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient long[] _values;
++
++ /**
++ * Creates a new <code>TIntLongHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TIntLongHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TIntLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TIntLongHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TIntLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TIntLongHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TIntLongHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntLongHashMap(TIntHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntLongHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntLongHashMap(int initialCapacity, TIntHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntLongHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntLongHashMap(int initialCapacity, float loadFactor, TIntHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TIntLongHashMap m = (TIntLongHashMap)super.clone();
++ m._values = (long[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TIntLongIterator with access to this map's keys and values
++ */
++ public TIntLongIterator iterator() {
++ return new TIntLongIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new long[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>int</code> value
++ * @param value an <code>long</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (int)0 if none was found.
++ */
++ public long put(int key, long value) {
++ byte previousState;
++ long previous = (long)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ int oldKeys[] = _set;
++ long oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new int[newCapacity];
++ _values = new long[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ int o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>int</code> value
++ * @return the value of <tt>key</tt> or (int)0 if no such mapping exists.
++ */
++ public long get(int key) {
++ int index = index(key);
++ return index < 0 ? (long)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ int[] keys = _set;
++ long[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (int)0;
++ vals[i] = (long)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>int</code> value
++ * @return an <code>long</code> value, or (int)0 if no mapping for key exists
++ */
++ public long remove(int key) {
++ long prev = (long)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TIntLongHashMap)) {
++ return false;
++ }
++ TIntLongHashMap that = (TIntLongHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TIntLongProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(int key, long value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TIntLongProcedure {
++ private final TIntLongHashMap _otherMap;
++
++ EqProcedure(TIntLongHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(int key, long value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two longs for equality.
++ */
++ private final boolean eq(long v1, long v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (long)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public long[] getValues() {
++ long[] vals = new long[size()];
++ long[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public int[] keys() {
++ int[] keys = new int[size()];
++ int[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(long val) {
++ byte[] states = _states;
++ long[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(int key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TIntProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TLongProcedure procedure) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOIntLongProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TIntLongProcedure procedure) {
++ byte[] states = _states;
++ int[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TIntLongProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ int[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TLongFunction</code> value
++ */
++ public void transformValues(TLongFunction function) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(int key) {
++ return adjustValue(key, (long)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(int key, long amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ int key = in.readInt();
++ long val = in.readLong();
++ put(key, val);
++ }
++ }
++} // TIntLongHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntLongIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type int and long.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TIntLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TIntLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TIntLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TIntLongIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TIntLongIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TIntLongHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TIntLongIterator(TIntLongHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public int key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public long value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public long setValue(long val) {
++ long old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TIntLongIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntLongProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type int and long.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntLongProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>int</code> value
++ * @param b a <code>long</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(int a, long b);
++}// TIntLongProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntObjectHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,507 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for int keys and Object values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TIntObjectHashMap<V> extends TIntHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient V[] _values;
++
++ /**
++ * Creates a new <code>TIntObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TIntObjectHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TIntObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TIntObjectHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TIntObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TIntObjectHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TIntObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntObjectHashMap(TIntHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntObjectHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntObjectHashMap(int initialCapacity, TIntHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntObjectHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntObjectHashMap(int initialCapacity, float loadFactor, TIntHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public TIntObjectHashMap<V> clone() {
++ TIntObjectHashMap<V> m = (TIntObjectHashMap<V>)super.clone();
++ m._values = (V[]) this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TIntObjectIterator with access to this map's keys and values
++ */
++ public TIntObjectIterator<V> iterator() {
++ return new TIntObjectIterator<V>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = (V[]) new Object[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>int</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (int)0 if none was found.
++ */
++ public V put(int key, V value) {
++ byte previousState;
++ V previous = null;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ int oldKeys[] = _set;
++ V oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new int[newCapacity];
++ _values = (V[]) new Object[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ int o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>int</code> value
++ * @return the value of <tt>key</tt> or (int)0 if no such mapping exists.
++ */
++ public V get(int key) {
++ int index = index(key);
++ return index < 0 ? null : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ int[] keys = _set;
++ Object[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (int)0;
++ vals[i] = null;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>int</code> value
++ * @return an <code>Object</code> value or (int)0 if no such mapping exists.
++ */
++ public V remove(int key) {
++ V prev = null;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TIntObjectHashMap)) {
++ return false;
++ }
++ TIntObjectHashMap that = (TIntObjectHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TIntObjectProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(int key, Object value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TIntObjectProcedure {
++ private final TIntObjectHashMap _otherMap;
++
++ EqProcedure(TIntObjectHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(int key, Object value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two objects for equality.
++ */
++ private final boolean eq(Object o1, Object o2) {
++ return o1 == o2 || ((o1 != null) && o1.equals(o2));
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = null;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public Object[] getValues() {
++ Object[] vals = new Object[size()];
++ V[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public int[] keys() {
++ int[] keys = new int[size()];
++ int[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(V val) {
++ byte[] states = _states;
++ V[] vals = _values;
++
++ // special case null values so that we don't have to
++ // perform null checks before every call to equals()
++ if (null == val) {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ val == vals[i]) {
++ return true;
++ }
++ }
++ } else {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ (val == vals[i] || val.equals(vals[i]))) {
++ return true;
++ }
++ }
++ } // end of else
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(int key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TIntProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOIntObjectProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TIntObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ int[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TIntObjectProcedure<V> procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ int[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TObjectFunction</code> value
++ */
++ public void transformValues(TObjectFunction<V,V> function) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ int key = in.readInt();
++ V val = (V) in.readObject();
++ put(key, val);
++ }
++ }
++} // TIntObjectHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntObjectIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,151 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type int and Object.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TIntObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TIntObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TIntObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TIntObjectIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TIntObjectIterator<V> extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TIntObjectHashMap<V> _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TIntObjectIterator(TIntObjectHashMap<V> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException
++ * if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public int key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public V value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public V setValue(V val) {
++ V old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TIntObjectIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntObjectProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type int and Object.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntObjectProcedure<T> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>int</code> value
++ * @param b an <code>Object</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(int a, T b);
++}// TIntObjectProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,46 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures with one int paramater.
++ *
++ * Created: Mon Nov 5 21:45:49 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntProcedure {
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param value a value of type <code>int</code>
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(int value);
++}// TIntProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntShortHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for int keys and short values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TIntShortHashMap extends TIntHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient short[] _values;
++
++ /**
++ * Creates a new <code>TIntShortHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TIntShortHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TIntShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TIntShortHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TIntShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TIntShortHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TIntShortHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntShortHashMap(TIntHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntShortHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntShortHashMap(int initialCapacity, TIntHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TIntShortHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TIntShortHashMap(int initialCapacity, float loadFactor, TIntHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TIntShortHashMap m = (TIntShortHashMap)super.clone();
++ m._values = (short[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TIntShortIterator with access to this map's keys and values
++ */
++ public TIntShortIterator iterator() {
++ return new TIntShortIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new short[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>int</code> value
++ * @param value an <code>short</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (int)0 if none was found.
++ */
++ public short put(int key, short value) {
++ byte previousState;
++ short previous = (short)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ int oldKeys[] = _set;
++ short oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new int[newCapacity];
++ _values = new short[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ int o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>int</code> value
++ * @return the value of <tt>key</tt> or (int)0 if no such mapping exists.
++ */
++ public short get(int key) {
++ int index = index(key);
++ return index < 0 ? (short)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ int[] keys = _set;
++ short[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (int)0;
++ vals[i] = (short)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>int</code> value
++ * @return an <code>short</code> value, or (int)0 if no mapping for key exists
++ */
++ public short remove(int key) {
++ short prev = (short)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TIntShortHashMap)) {
++ return false;
++ }
++ TIntShortHashMap that = (TIntShortHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TIntShortProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(int key, short value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TIntShortProcedure {
++ private final TIntShortHashMap _otherMap;
++
++ EqProcedure(TIntShortHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(int key, short value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two shorts for equality.
++ */
++ private final boolean eq(short v1, short v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (short)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public short[] getValues() {
++ short[] vals = new short[size()];
++ short[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public int[] keys() {
++ int[] keys = new int[size()];
++ int[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(short val) {
++ byte[] states = _states;
++ short[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(int key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TIntProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TShortProcedure procedure) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOIntShortProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TIntShortProcedure procedure) {
++ byte[] states = _states;
++ int[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TIntShortProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ int[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TShortFunction</code> value
++ */
++ public void transformValues(TShortFunction function) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(int key) {
++ return adjustValue(key, (short)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(int key, short amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ int key = in.readInt();
++ short val = in.readShort();
++ put(key, val);
++ }
++ }
++} // TIntShortHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntShortIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type int and short.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TIntShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TIntShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TIntShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TIntShortIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TIntShortIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TIntShortHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TIntShortIterator(TIntShortHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public int key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public short value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public short setValue(short val) {
++ short old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TIntShortIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TIntShortProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type int and short.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TIntShortProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>int</code> value
++ * @param b a <code>short</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(int a, short b);
++}// TIntShortProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongArrayList.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,905 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Externalizable;
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.util.Arrays;
++import java.util.Random;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * A resizable, array-backed list of long primitives.
++ *
++ * Created: Sat Dec 29 14:21:12 2001
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TLongArrayList implements Externalizable, Cloneable {
++ static final long serialVersionUID = 1L;
++
++ /** the data of the list */
++ protected long[] _data;
++
++ /** the index after the last entry in the list */
++ protected int _pos;
++
++ /** the default capacity for new lists */
++ protected static final int DEFAULT_CAPACITY = 10;
++
++ /**
++ * Creates a new <code>TLongArrayList</code> instance with the
++ * default capacity.
++ */
++ public TLongArrayList() {
++ this(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Creates a new <code>TLongArrayList</code> instance with the
++ * specified capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public TLongArrayList(int capacity) {
++ _data = new long[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Creates a new <code>TLongArrayList</code> instance whose
++ * capacity is the greater of the length of <tt>values</tt> and
++ * DEFAULT_CAPACITY and whose initial contents are the specified
++ * values.
++ *
++ * @param values an <code>long[]</code> value
++ */
++ public TLongArrayList(long[] values) {
++ this(Math.max(values.length, DEFAULT_CAPACITY));
++ add(values);
++ }
++
++ // sizing
++
++ /**
++ * Grow the internal array as needed to accomodate the specified
++ * number of elements. The size of the array longs on each
++ * resize unless <tt>capacity</tt> requires more than twice the
++ * current capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void ensureCapacity(int capacity) {
++ if (capacity > _data.length) {
++ int newCap = Math.max(_data.length << 1, capacity);
++ long[] tmp = new long[newCap];
++ System.arraycopy(_data, 0, tmp, 0, _data.length);
++ _data = tmp;
++ }
++ }
++
++ /**
++ * Returns the number of values in the list.
++ *
++ * @return the number of values in the list.
++ */
++ public int size() {
++ return _pos;
++ }
++
++ /**
++ * Tests whether this list contains any values.
++ *
++ * @return true if the list is empty.
++ */
++ public boolean isEmpty() {
++ return _pos == 0;
++ }
++
++ /**
++ * Sheds any excess capacity above and beyond the current size of
++ * the list.
++ */
++ public void trimToSize() {
++ if (_data.length > size()) {
++ long[] tmp = new long[size()];
++ toNativeArray(tmp, 0, tmp.length);
++ _data = tmp;
++ }
++ }
++
++ // modifying
++
++ /**
++ * Adds <tt>val</tt> to the end of the list, growing as needed.
++ *
++ * @param val an <code>long</code> value
++ */
++ public void add(long val) {
++ ensureCapacity(_pos + 1);
++ _data[_pos++] = val;
++ }
++
++ /**
++ * Adds the values in the array <tt>vals</tt> to the end of the
++ * list, in order.
++ *
++ * @param vals an <code>long[]</code> value
++ */
++ public void add(long[] vals) {
++ add(vals, 0, vals.length);
++ }
++
++ /**
++ * Adds a subset of the values in the array <tt>vals</tt> to the
++ * end of the list, in order.
++ *
++ * @param vals an <code>long[]</code> value
++ * @param offset the offset at which to start copying
++ * @param length the number of values to copy.
++ */
++ public void add(long[] vals, int offset, int length) {
++ ensureCapacity(_pos + length);
++ System.arraycopy(vals, offset, _data, _pos, length);
++ _pos += length;
++ }
++
++ /**
++ * Inserts <tt>value</tt> into the list at <tt>offset</tt>. All
++ * values including and to the right of <tt>offset</tt> are shifted
++ * to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param value an <code>long</code> value
++ */
++ public void insert(int offset, long value) {
++ if (offset == _pos) {
++ add(value);
++ return;
++ }
++ ensureCapacity(_pos + 1);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + 1, _pos - offset);
++ // insert
++ _data[offset] = value;
++ _pos++;
++ }
++
++ /**
++ * Inserts the array of <tt>values</tt> into the list at
++ * <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>long[]</code> value
++ */
++ public void insert(int offset, long[] values) {
++ insert(offset, values, 0, values.length);
++ }
++
++ /**
++ * Inserts a slice of the array of <tt>values</tt> into the list
++ * at <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>long[]</code> value
++ * @param valOffset the offset in the values array at which to
++ * start copying.
++ * @param len the number of values to copy from the values array
++ */
++ public void insert(int offset, long[] values, int valOffset, int len) {
++ if (offset == _pos) {
++ add(values, valOffset, len);
++ return;
++ }
++
++ ensureCapacity(_pos + len);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + len, _pos - offset);
++ // insert
++ System.arraycopy(values, valOffset, _data, offset, len);
++ _pos += len;
++ }
++
++ /**
++ * Returns the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>long</code> value
++ */
++ public long get(int offset) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ return _data[offset];
++ }
++
++ /**
++ * Returns the value at the specified offset without doing any
++ * bounds checking.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>long</code> value
++ */
++ public long getQuick(int offset) {
++ return _data[offset];
++ }
++
++ /**
++ * Sets the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>long</code> value
++ */
++ public void set(int offset, long val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ _data[offset] = val;
++ }
++
++ /**
++ * Sets the value at the specified offset and returns the
++ * previously stored value.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>long</code> value
++ * @return the value previously stored at offset.
++ */
++ public long getSet(int offset, long val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ long old = _data[offset];
++ _data[offset] = val;
++ return old;
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * the contents of the <tt>values</tt> array.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ */
++ public void set(int offset, long[] values) {
++ set(offset, values, 0, values.length);
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * <tt>length</tt> values from the <tt>values</tt> array, starting
++ * at valOffset.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ * @param valOffset the first value to copy from the values array
++ * @param length the number of values to copy
++ */
++ public void set(int offset, long[] values, int valOffset, int length) {
++ if (offset < 0 || offset + length > _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(values, valOffset, _data, offset, length);
++ }
++
++ /**
++ * Sets the value at the specified offset without doing any bounds
++ * checking.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>long</code> value
++ */
++ public void setQuick(int offset, long val) {
++ _data[offset] = val;
++ }
++
++ /**
++ * Flushes the internal state of the list, resetting the capacity
++ * to the default.
++ */
++ public void clear() {
++ clear(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Flushes the internal state of the list, setting the capacity of
++ * the empty list to <tt>capacity</tt>.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void clear(int capacity) {
++ _data = new long[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list without
++ * allocating new backing arrays.
++ *
++ * @see #clear
++ */
++ public void reset() {
++ _pos = 0;
++ fill((long)0);
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list
++ * without allocating new backing arrays. This method differs
++ * from {@link #reset reset} in that it does not clear the old
++ * values in the backing array. Thus, it is possible for {@link
++ * #getQuick getQuick} to return stale data if this method is used
++ * and the caller is careless about bounds checking.
++ *
++ * @see #reset
++ * @see #clear
++ * @see #getQuick
++ */
++ public void resetQuick() {
++ _pos = 0;
++ }
++
++ /**
++ * Removes the value at <tt>offset</tt> from the list.
++ *
++ * @param offset an <code>int</code> value
++ * @return the value previously stored at offset.
++ */
++ public long remove(int offset) {
++ long old = get(offset);
++ remove(offset, 1);
++ return old;
++ }
++
++ /**
++ * Removes <tt>length</tt> values from the list, starting at
++ * <tt>offset</tt>
++ *
++ * @param offset an <code>int</code> value
++ * @param length an <code>int</code> value
++ */
++ public void remove(int offset, int length) {
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++
++ if (offset == 0) {
++ // data at the front
++ System.arraycopy(_data, length, _data, 0, _pos - length);
++ } else if (_pos - length == offset) {
++ // no copy to make, decrementing pos "deletes" values at
++ // the end
++ } else {
++ // data in the middle
++ System.arraycopy(_data, offset + length,
++ _data, offset, _pos - (offset + length));
++ }
++ _pos -= length;
++ // no need to clear old values beyond _pos, because this is a
++ // primitive collection and 0 takes as much room as any other
++ // value
++ }
++
++ /**
++ * Transform each value in the list using the specified function.
++ *
++ * @param function a <code>TLongFunction</code> value
++ */
++ public void transformValues(TLongFunction function) {
++ for (int i = _pos; i-- > 0;) {
++ _data[i] = function.execute(_data[i]);
++ }
++ }
++
++ /**
++ * Reverse the order of the elements in the list.
++ */
++ public void reverse() {
++ reverse(0, _pos);
++ }
++
++ /**
++ * Reverse the order of the elements in the range of the list.
++ *
++ * @param from the inclusive index at which to start reversing
++ * @param to the exclusive index at which to stop reversing
++ */
++ public void reverse(int from, int to) {
++ if (from == to) {
++ return; // nothing to do
++ }
++ if (from > to) {
++ throw new IllegalArgumentException("from cannot be greater than to");
++ }
++ for (int i = from, j = to - 1; i < j; i++, j--) {
++ swap(i, j);
++ }
++ }
++
++ /**
++ * Shuffle the elements of the list using the specified random
++ * number generator.
++ *
++ * @param rand a <code>Random</code> value
++ */
++ public void shuffle(Random rand) {
++ for (int i = _pos; i-- > 1;) {
++ swap(i, rand.nextInt(i));
++ }
++ }
++
++ /**
++ * Swap the values at offsets <tt>i</tt> and <tt>j</tt>.
++ *
++ * @param i an offset into the data array
++ * @param j an offset into the data array
++ */
++ private final void swap(int i, int j) {
++ long tmp = _data[i];
++ _data[i] = _data[j];
++ _data[j] = tmp;
++ }
++
++ // copying
++
++ /**
++ * Returns a clone of this list. Since this is a primitive
++ * collection, this will be a deep clone.
++ *
++ * @return a deep clone of the list.
++ */
++ public Object clone() {
++ TLongArrayList list = null;
++ try {
++ list = (TLongArrayList) super.clone();
++ list._data = toNativeArray();
++ } catch (CloneNotSupportedException e) {
++ // it's supported
++ } // end of try-catch
++ return list;
++ }
++
++ /**
++ * Copies the contents of the list into a native array.
++ *
++ * @return an <code>long[]</code> value
++ */
++ public long[] toNativeArray() {
++ return toNativeArray(0, _pos);
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param offset the offset at which to start copying
++ * @param len the number of values to copy.
++ * @return an <code>long[]</code> value
++ */
++ public long[] toNativeArray(int offset, int len) {
++ long[] rv = new long[len];
++ toNativeArray(rv, offset, len);
++ return rv;
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param dest the array to copy into.
++ * @param offset the offset of the first value to copy
++ * @param len the number of values to copy.
++ */
++ public void toNativeArray(long[] dest, int offset, int len) {
++ if (len == 0) {
++ return; // nothing to copy
++ }
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(_data, offset, dest, 0, len);
++ }
++
++ // comparing
++
++ /**
++ * Compares this list to another list, value by value.
++ *
++ * @param other the object to compare against
++ * @return true if other is a TLongArrayList and has exactly the
++ * same values.
++ */
++ public boolean equals(Object other) {
++ if (other == this) {
++ return true;
++ } else if (other instanceof TLongArrayList) {
++ TLongArrayList that = (TLongArrayList)other;
++ if (that.size() != this.size()) {
++ return false;
++ } else {
++ for (int i = _pos; i-- > 0;) {
++ if (this._data[i] != that._data[i]) {
++ return false;
++ }
++ }
++ return true;
++ }
++ } else {
++ return false;
++ }
++ }
++
++ public int hashCode() {
++ int h = 0;
++ for (int i = _pos; i-- > 0;) {
++ h += HashFunctions.hash(_data[i]);
++ }
++ return h;
++ }
++
++ // procedures
++
++ /**
++ * Applies the procedure to each value in the list in ascending
++ * (front to back) order.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEach(TLongProcedure procedure) {
++ for (int i = 0; i < _pos; i++) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Applies the procedure to each value in the list in descending
++ * (back to front) order.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEachDescending(TLongProcedure procedure) {
++ for (int i = _pos; i-- > 0;) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ // sorting
++
++ /**
++ * Sort the values in the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @see java.util.Arrays#sort
++ */
++ public void sort() {
++ Arrays.sort(_data, 0, _pos);
++ }
++
++ /**
++ * Sort a slice of the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @param fromIndex the index at which to start sorting (inclusive)
++ * @param toIndex the index at which to stop sorting (exclusive)
++ * @see java.util.Arrays#sort
++ */
++ public void sort(int fromIndex, int toIndex) {
++ Arrays.sort(_data, fromIndex, toIndex);
++ }
++
++ // filling
++
++ /**
++ * Fills every slot in the list with the specified value.
++ *
++ * @param val the value to use when filling
++ */
++ public void fill(long val) {
++ Arrays.fill(_data, 0, _pos, val);
++ }
++
++ /**
++ * Fills a range in the list with the specified value.
++ *
++ * @param fromIndex the offset at which to start filling (inclusive)
++ * @param toIndex the offset at which to stop filling (exclusive)
++ * @param val the value to use when filling
++ */
++ public void fill(int fromIndex, int toIndex, long val) {
++ if (toIndex > _pos) {
++ ensureCapacity(toIndex);
++ _pos = toIndex;
++ }
++ Arrays.fill(_data, fromIndex, toIndex, val);
++ }
++
++ // searching
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the entire list.
++ * Note that you <b>must</b> @{link #sort sort} the list before
++ * doing a search.
++ *
++ * @param value the value to search for
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(long value) {
++ return binarySearch(value, 0, _pos);
++ }
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the specified
++ * range. Note that you <b>must</b> @{link #sort sort} the list
++ * or the range before doing a search.
++ *
++ * @param value the value to search for
++ * @param fromIndex the lower boundary of the range (inclusive)
++ * @param toIndex the upper boundary of the range (exclusive)
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(long value, int fromIndex, int toIndex) {
++ if (fromIndex < 0) {
++ throw new ArrayIndexOutOfBoundsException(fromIndex);
++ }
++ if (toIndex > _pos) {
++ throw new ArrayIndexOutOfBoundsException(toIndex);
++ }
++
++ int low = fromIndex;
++ int high = toIndex - 1;
++
++ while (low <= high) {
++ int mid = (low + high) >> 1;
++ long midVal = _data[mid];
++
++ if (midVal < value) {
++ low = mid + 1;
++ } else if (midVal > value) {
++ high = mid - 1;
++ } else {
++ return mid; // value found
++ }
++ }
++ return -(low + 1); // value not found.
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>long</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(long value) {
++ return indexOf(0, value);
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (inclusive)
++ * @param value an <code>long</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(int offset, long value) {
++ for (int i = offset; i < _pos; i++) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>long</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(long value) {
++ return lastIndexOf(_pos, value);
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (exclusive)
++ * @param value an <code>long</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(int offset, long value) {
++ for (int i = offset; i-- > 0;) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list for <tt>value</tt>
++ *
++ * @param value an <code>long</code> value
++ * @return true if value is in the list.
++ */
++ public boolean contains(long value) {
++ return lastIndexOf(value) >= 0;
++ }
++
++ /**
++ * Searches the list for values satisfying <tt>condition</tt> in
++ * the manner of the *nix <tt>grep</tt> utility.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which match the condition.
++ */
++ public TLongArrayList grep(TLongProcedure condition) {
++ TLongArrayList list = new TLongArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Searches the list for values which do <b>not</b> satisfy
++ * <tt>condition</tt>. This is akin to *nix <code>grep -v</code>.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which do not match the condition.
++ */
++ public TLongArrayList inverseGrep(TLongProcedure condition) {
++ TLongArrayList list = new TLongArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (! condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Finds the maximum value in the list.
++ *
++ * @return the largest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public long max() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find maximum of an empty list");
++ }
++ long max = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > max ) {
++ max = _data[_pos];
++ }
++ }
++ return max;
++ }
++
++ /**
++ * Finds the minimum value in the list.
++ *
++ * @return the smallest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public long min() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find minimum of an empty list");
++ }
++ long min = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > min ) {
++ min = _data[_pos];
++ }
++ }
++ return min;
++ }
++
++ // stringification
++
++ /**
++ * Returns a String representation of the list, front to back.
++ *
++ * @return a <code>String</code> value
++ */
++ public String toString() {
++ final StringBuffer buf = new StringBuffer("{");
++ for (int i = 0, end = _pos - 1; i < end; i++) {
++ buf.append(_data[i]);
++ buf.append(", ");
++ }
++ if (size() > 0) {
++ buf.append(_data[_pos - 1]);
++ }
++ buf.append("}");
++ return buf.toString();
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // POSITION
++ out.writeInt( _pos );
++
++ // ENTRIES
++ int len = _data.length;
++ out.writeInt( len );
++ for( int i = 0; i < len; i++ ) {
++ out.writeLong( _data[ i ] );
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // POSITION
++ _pos = in.readInt();
++
++ // ENTRIES
++ int len = in.readInt();
++ _data = new long[ len ];
++ for( int i = 0; i < len; i++ ) {
++ _data[ i ] = in.readLong();
++ }
++ }
++} // TLongArrayList
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongByteHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for long keys and byte values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TLongByteHashMap extends TLongHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient byte[] _values;
++
++ /**
++ * Creates a new <code>TLongByteHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TLongByteHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TLongByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TLongByteHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TLongByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TLongByteHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TLongByteHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongByteHashMap(TLongHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongByteHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongByteHashMap(int initialCapacity, TLongHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongByteHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongByteHashMap(int initialCapacity, float loadFactor, TLongHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TLongByteHashMap m = (TLongByteHashMap)super.clone();
++ m._values = (byte[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TLongByteIterator with access to this map's keys and values
++ */
++ public TLongByteIterator iterator() {
++ return new TLongByteIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new byte[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>long</code> value
++ * @param value an <code>byte</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (long)0 if none was found.
++ */
++ public byte put(long key, byte value) {
++ byte previousState;
++ byte previous = (byte)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ long oldKeys[] = _set;
++ byte oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new long[newCapacity];
++ _values = new byte[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ long o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>long</code> value
++ * @return the value of <tt>key</tt> or (long)0 if no such mapping exists.
++ */
++ public byte get(long key) {
++ int index = index(key);
++ return index < 0 ? (byte)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ long[] keys = _set;
++ byte[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (long)0;
++ vals[i] = (byte)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>long</code> value
++ * @return an <code>byte</code> value, or (long)0 if no mapping for key exists
++ */
++ public byte remove(long key) {
++ byte prev = (byte)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TLongByteHashMap)) {
++ return false;
++ }
++ TLongByteHashMap that = (TLongByteHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TLongByteProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(long key, byte value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TLongByteProcedure {
++ private final TLongByteHashMap _otherMap;
++
++ EqProcedure(TLongByteHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(long key, byte value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two bytes for equality.
++ */
++ private final boolean eq(byte v1, byte v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (byte)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public byte[] getValues() {
++ byte[] vals = new byte[size()];
++ byte[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public long[] keys() {
++ long[] keys = new long[size()];
++ long[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(byte val) {
++ byte[] states = _states;
++ byte[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(long key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TLongProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TByteProcedure procedure) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOLongByteProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TLongByteProcedure procedure) {
++ byte[] states = _states;
++ long[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TLongByteProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ long[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TByteFunction</code> value
++ */
++ public void transformValues(TByteFunction function) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(long key) {
++ return adjustValue(key, (byte)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(long key, byte amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ long key = in.readLong();
++ byte val = in.readByte();
++ put(key, val);
++ }
++ }
++} // TLongByteHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongByteIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type long and byte.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TLongByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TLongByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TLongByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TLongByteIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TLongByteIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TLongByteHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TLongByteIterator(TLongByteHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public long key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public byte value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public byte setValue(byte val) {
++ byte old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TLongByteIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongByteProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type long and byte.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongByteProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>long</code> value
++ * @param b a <code>byte</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(long a, byte b);
++}// TLongByteProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongDoubleHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for long keys and double values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TLongDoubleHashMap extends TLongHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient double[] _values;
++
++ /**
++ * Creates a new <code>TLongDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TLongDoubleHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TLongDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TLongDoubleHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TLongDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TLongDoubleHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TLongDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongDoubleHashMap(TLongHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongDoubleHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongDoubleHashMap(int initialCapacity, TLongHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongDoubleHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongDoubleHashMap(int initialCapacity, float loadFactor, TLongHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TLongDoubleHashMap m = (TLongDoubleHashMap)super.clone();
++ m._values = (double[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TLongDoubleIterator with access to this map's keys and values
++ */
++ public TLongDoubleIterator iterator() {
++ return new TLongDoubleIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new double[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>long</code> value
++ * @param value an <code>double</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (long)0 if none was found.
++ */
++ public double put(long key, double value) {
++ byte previousState;
++ double previous = (double)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ long oldKeys[] = _set;
++ double oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new long[newCapacity];
++ _values = new double[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ long o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>long</code> value
++ * @return the value of <tt>key</tt> or (long)0 if no such mapping exists.
++ */
++ public double get(long key) {
++ int index = index(key);
++ return index < 0 ? (double)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ long[] keys = _set;
++ double[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (long)0;
++ vals[i] = (double)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>long</code> value
++ * @return an <code>double</code> value, or (long)0 if no mapping for key exists
++ */
++ public double remove(long key) {
++ double prev = (double)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TLongDoubleHashMap)) {
++ return false;
++ }
++ TLongDoubleHashMap that = (TLongDoubleHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TLongDoubleProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(long key, double value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TLongDoubleProcedure {
++ private final TLongDoubleHashMap _otherMap;
++
++ EqProcedure(TLongDoubleHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(long key, double value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two doubles for equality.
++ */
++ private final boolean eq(double v1, double v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (double)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public double[] getValues() {
++ double[] vals = new double[size()];
++ double[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public long[] keys() {
++ long[] keys = new long[size()];
++ long[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(double val) {
++ byte[] states = _states;
++ double[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(long key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TLongProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TDoubleProcedure procedure) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOLongDoubleProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TLongDoubleProcedure procedure) {
++ byte[] states = _states;
++ long[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TLongDoubleProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ long[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TDoubleFunction</code> value
++ */
++ public void transformValues(TDoubleFunction function) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(long key) {
++ return adjustValue(key, (double)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(long key, double amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ long key = in.readLong();
++ double val = in.readDouble();
++ put(key, val);
++ }
++ }
++} // TLongDoubleHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongDoubleIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type long and double.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TLongDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TLongDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TLongDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TLongDoubleIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TLongDoubleIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TLongDoubleHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TLongDoubleIterator(TLongDoubleHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public long key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public double value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public double setValue(double val) {
++ double old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TLongDoubleIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongDoubleProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type long and double.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongDoubleProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>long</code> value
++ * @param b a <code>double</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(long a, double b);
++}// TLongDoubleProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongFloatHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for long keys and float values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TLongFloatHashMap extends TLongHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient float[] _values;
++
++ /**
++ * Creates a new <code>TLongFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TLongFloatHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TLongFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TLongFloatHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TLongFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TLongFloatHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TLongFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongFloatHashMap(TLongHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongFloatHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongFloatHashMap(int initialCapacity, TLongHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongFloatHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongFloatHashMap(int initialCapacity, float loadFactor, TLongHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TLongFloatHashMap m = (TLongFloatHashMap)super.clone();
++ m._values = (float[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TLongFloatIterator with access to this map's keys and values
++ */
++ public TLongFloatIterator iterator() {
++ return new TLongFloatIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new float[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>long</code> value
++ * @param value an <code>float</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (long)0 if none was found.
++ */
++ public float put(long key, float value) {
++ byte previousState;
++ float previous = (float)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ long oldKeys[] = _set;
++ float oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new long[newCapacity];
++ _values = new float[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ long o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>long</code> value
++ * @return the value of <tt>key</tt> or (long)0 if no such mapping exists.
++ */
++ public float get(long key) {
++ int index = index(key);
++ return index < 0 ? (float)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ long[] keys = _set;
++ float[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (long)0;
++ vals[i] = (float)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>long</code> value
++ * @return an <code>float</code> value, or (long)0 if no mapping for key exists
++ */
++ public float remove(long key) {
++ float prev = (float)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TLongFloatHashMap)) {
++ return false;
++ }
++ TLongFloatHashMap that = (TLongFloatHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TLongFloatProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(long key, float value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TLongFloatProcedure {
++ private final TLongFloatHashMap _otherMap;
++
++ EqProcedure(TLongFloatHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(long key, float value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two floats for equality.
++ */
++ private final boolean eq(float v1, float v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (float)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public float[] getValues() {
++ float[] vals = new float[size()];
++ float[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public long[] keys() {
++ long[] keys = new long[size()];
++ long[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(float val) {
++ byte[] states = _states;
++ float[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(long key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TLongProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TFloatProcedure procedure) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOLongFloatProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TLongFloatProcedure procedure) {
++ byte[] states = _states;
++ long[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TLongFloatProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ long[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TFloatFunction</code> value
++ */
++ public void transformValues(TFloatFunction function) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(long key) {
++ return adjustValue(key, (float)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(long key, float amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ long key = in.readLong();
++ float val = in.readFloat();
++ put(key, val);
++ }
++ }
++} // TLongFloatHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongFloatIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type long and float.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TLongFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TLongFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TLongFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TLongFloatIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TLongFloatIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TLongFloatHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TLongFloatIterator(TLongFloatHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public long key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public float value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public float setValue(float val) {
++ float old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TLongFloatIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongFloatProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type long and float.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongFloatProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>long</code> value
++ * @param b a <code>float</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(long a, float b);
++}// TLongFloatProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongFunction.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,43 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for functions that accept and return one long primitive.
++ *
++ * Created: Mon Nov 5 22:19:36 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PFunction.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongFunction {
++ /**
++ * Execute this function with <tt>value</tt>
++ *
++ * @param value a <code>long</code> input
++ * @return a <code>long</code> result
++ */
++ public long execute(long value);
++}// TLongFunction
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongHash.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,289 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed hashing implementation for long primitives.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHash.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++abstract public class TLongHash extends TPrimitiveHash implements TLongHashingStrategy {
++
++ /** the set of longs */
++ protected transient long[] _set;
++
++ /** strategy used to hash values in this collection */
++ protected TLongHashingStrategy _hashingStrategy;
++
++ /**
++ * Creates a new <code>TLongHash</code> instance with the default
++ * capacity and load factor.
++ */
++ public TLongHash() {
++ super();
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TLongHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TLongHash(int initialCapacity) {
++ super(initialCapacity);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TLongHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ */
++ public TLongHash(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TLongHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongHash(TLongHashingStrategy strategy) {
++ super();
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TLongHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongHash(int initialCapacity, TLongHashingStrategy strategy) {
++ super(initialCapacity);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TLongHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongHash(int initialCapacity, float loadFactor, TLongHashingStrategy strategy) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TLongHash h = (TLongHash)super.clone();
++ h._set = (long[])this._set.clone();
++ return h;
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _set = new long[capacity];
++ return capacity;
++ }
++
++ /**
++ * Searches the set for <tt>val</tt>
++ *
++ * @param val an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean contains(long val) {
++ return index(val) >= 0;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each element in the set.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the set terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEach(TLongProcedure procedure) {
++ byte[] states = _states;
++ long[] set = _set;
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(set[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Releases the element currently stored at <tt>index</tt>.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _set[index] = (long)0;
++ super.removeAt(index);
++ }
++
++ /**
++ * Locates the index of <tt>val</tt>.
++ *
++ * @param val an <code>long</code> value
++ * @return the index of <tt>val</tt> or -1 if it isn't in the set.
++ */
++ protected int index(long val) {
++ int hash, probe, index, length;
++ long[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ // see Knuth, p. 529
++ probe = 1 + (hash % (length - 2));
++
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val));
++ }
++
++ return states[index] == FREE ? -1 : index;
++ }
++
++ /**
++ * Locates the index at which <tt>val</tt> can be inserted. if
++ * there is already a value equal()ing <tt>val</tt> in the set,
++ * returns that value as a negative integer.
++ *
++ * @param val an <code>long</code> value
++ * @return an <code>int</code> value
++ */
++ protected int insertionIndex(long val) {
++ int hash, probe, index, length;
++ long[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] == FREE) {
++ return index; // empty, all done
++ } else if (states[index] == FULL && set[index] == val) {
++ return -index -1; // already stored
++ } else { // already FULL or REMOVED, must probe
++ // compute the double hash
++ probe = 1 + (hash % (length - 2));
++
++ // if the slot we landed on is FULL (but not removed), probe
++ // until we find an empty slot, a REMOVED slot, or an element
++ // equal to the one we are trying to insert.
++ // finding an empty slot means that the value is not present
++ // and that we should use that slot as the insertion point;
++ // finding a REMOVED slot means that we need to keep searching,
++ // however we want to remember the offset of that REMOVED slot
++ // so we can reuse it in case a "new" insertion (i.e. not an update)
++ // is possible.
++ // finding a matching value means that we've found that our desired
++ // key is already in the table
++
++ if (states[index] != REMOVED) {
++ // starting at the natural offset, probe until we find an
++ // offset that isn't full.
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] == FULL && set[index] != val);
++ }
++
++ // if the index we found was removed: continue probing until we
++ // locate a free location or an element which equal()s the
++ // one we have.
++ if (states[index] == REMOVED) {
++ int firstRemoved = index;
++ while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ }
++ return states[index] == FULL ? -index -1 : firstRemoved;
++ }
++ // if it's full, the key is already stored
++ return states[index] == FULL ? -index -1 : index;
++ }
++ }
++
++ /**
++ * Default implementation of TLongHashingStrategy:
++ * delegates hashing to HashFunctions.hash(long).
++ *
++ * @param val the value to hash
++ * @return the hashcode.
++ */
++ public final int computeHashCode(long val) {
++ return HashFunctions.hash(val);
++ }
++} // TLongHash
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongHashingStrategy.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,49 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Serializable;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface to support pluggable hashing strategies in maps and sets.
++ * Implementors can use this interface to make the trove hashing
++ * algorithms use an optimal strategy when computing hashcodes.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHashingStrategy.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongHashingStrategy extends Serializable {
++ /**
++ * Computes a hash code for the specified long. Implementors
++ * can use the long's own value or a custom scheme designed to
++ * minimize collisions for a known set of input.
++ *
++ * @param val long for which the hashcode is to be computed
++ * @return the hashCode
++ */
++ public int computeHashCode(long val);
++} // TLongHashingStrategy
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongHashSet.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,371 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed set implementation for long primitives.
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TLongHashSet extends TLongHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /**
++ * Creates a new <code>TLongHashSet</code> instance with the default
++ * capacity and load factor.
++ */
++ public TLongHashSet() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TLongHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TLongHashSet(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TLongHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TLongHashSet(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TLongHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>long</code> primitives
++ */
++ public TLongHashSet(long[] array) {
++ this(array.length);
++ addAll(array);
++ }
++
++ /**
++ * Creates a new <code>TLongHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongHashSet(TLongHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongHashSet(int initialCapacity, TLongHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongHashSet(int initialCapacity, float loadFactor, TLongHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>long</code> primitives
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongHashSet(long[] array, TLongHashingStrategy strategy) {
++ this(array.length, strategy);
++ addAll(array);
++ }
++
++ /**
++ * @return a TLongIterator with access to the values in this set
++ */
++ public TLongIterator iterator() {
++ return new TLongIterator(this);
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param val an <code>long</code> value
++ * @return true if the set was modified by the add operation
++ */
++ public boolean add(long val) {
++ int index = insertionIndex(val);
++
++ if (index < 0) {
++ return false; // already present in set, nothing to add
++ }
++
++ byte previousState = _states[index];
++ _set[index] = val;
++ _states[index] = FULL;
++ postInsertHook(previousState == FREE);
++
++ return true; // yes, we added something
++ }
++
++ /**
++ * Expands the set to accomodate new values.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ long oldSet[] = _set;
++ byte oldStates[] = _states;
++
++ _set = new long[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ long o = oldSet[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * Returns a new array containing the values in the set.
++ *
++ * @return an <code>long[]</code> value
++ */
++ public long[] toArray() {
++ long[] result = new long[size()];
++ long[] set = _set;
++ byte[] states = _states;
++
++ for (int i = states.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ result[j++] = set[i];
++ }
++ }
++ return result;
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ super.clear();
++ long[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ set[i] = (long)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TLongHashSet)) {
++ return false;
++ }
++ final TLongHashSet that = (TLongHashSet)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEach(new TLongProcedure() {
++ public final boolean execute(long value) {
++ return that.contains(value);
++ }
++ });
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEach(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TLongProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(long key) {
++ h += _hashingStrategy.computeHashCode(key);
++ return true;
++ }
++ }
++
++ /**
++ * Removes <tt>val</tt> from the set.
++ *
++ * @param val an <code>long</code> value
++ * @return true if the set was modified by the remove operation.
++ */
++ public boolean remove(long val) {
++ int index = index(val);
++ if (index >= 0) {
++ removeAt(index);
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Tests the set to determine if all of the elements in
++ * <tt>array</tt> are present.
++ *
++ * @param array an <code>array</code> of long primitives.
++ * @return true if all elements were present in the set.
++ */
++ public boolean containsAll(long[] array) {
++ for (int i = array.length; i-- > 0;) {
++ if (! contains(array[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Adds all of the elements in <tt>array</tt> to the set.
++ *
++ * @param array an <code>array</code> of long primitives.
++ * @return true if the set was modified by the add all operation.
++ */
++ public boolean addAll(long[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (add(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes all of the elements in <tt>array</tt> from the set.
++ *
++ * @param array an <code>array</code> of long primitives.
++ * @return true if the set was modified by the remove all operation.
++ */
++ public boolean removeAll(long[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (remove(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes any values in the set which are not contained in
++ * <tt>array</tt>.
++ *
++ * @param array an <code>array</code> of long primitives.
++ * @return true if the set was modified by the retain all operation
++ */
++ public boolean retainAll(long[] array) {
++ boolean changed = false;
++ Arrays.sort(array);
++ long[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && (Arrays.binarySearch(array,set[i]) < 0)) {
++ remove(set[i]);
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure(out);
++ if (! forEach(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++
++ // ENTRIES
++ setUp(size);
++ while (size-- > 0) {
++ long val = in.readLong();
++ add(val);
++ }
++ }
++} // TLongHashSet
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongIntHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for long keys and int values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TLongIntHashMap extends TLongHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient int[] _values;
++
++ /**
++ * Creates a new <code>TLongIntHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TLongIntHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TLongIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TLongIntHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TLongIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TLongIntHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TLongIntHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongIntHashMap(TLongHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongIntHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongIntHashMap(int initialCapacity, TLongHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongIntHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongIntHashMap(int initialCapacity, float loadFactor, TLongHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TLongIntHashMap m = (TLongIntHashMap)super.clone();
++ m._values = (int[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TLongIntIterator with access to this map's keys and values
++ */
++ public TLongIntIterator iterator() {
++ return new TLongIntIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new int[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>long</code> value
++ * @param value an <code>int</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (long)0 if none was found.
++ */
++ public int put(long key, int value) {
++ byte previousState;
++ int previous = (int)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ long oldKeys[] = _set;
++ int oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new long[newCapacity];
++ _values = new int[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ long o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>long</code> value
++ * @return the value of <tt>key</tt> or (long)0 if no such mapping exists.
++ */
++ public int get(long key) {
++ int index = index(key);
++ return index < 0 ? (int)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ long[] keys = _set;
++ int[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (long)0;
++ vals[i] = (int)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>long</code> value
++ * @return an <code>int</code> value, or (long)0 if no mapping for key exists
++ */
++ public int remove(long key) {
++ int prev = (int)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TLongIntHashMap)) {
++ return false;
++ }
++ TLongIntHashMap that = (TLongIntHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TLongIntProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(long key, int value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TLongIntProcedure {
++ private final TLongIntHashMap _otherMap;
++
++ EqProcedure(TLongIntHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(long key, int value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two ints for equality.
++ */
++ private final boolean eq(int v1, int v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (int)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public int[] getValues() {
++ int[] vals = new int[size()];
++ int[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public long[] keys() {
++ long[] keys = new long[size()];
++ long[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(int val) {
++ byte[] states = _states;
++ int[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(long key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TLongProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TIntProcedure procedure) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOLongIntProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TLongIntProcedure procedure) {
++ byte[] states = _states;
++ long[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TLongIntProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ long[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TIntFunction</code> value
++ */
++ public void transformValues(TIntFunction function) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(long key) {
++ return adjustValue(key, (int)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(long key, int amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ long key = in.readLong();
++ int val = in.readInt();
++ put(key, val);
++ }
++ }
++} // TLongIntHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongIntIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type long and int.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TLongIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TLongIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TLongIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TLongIntIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TLongIntIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TLongIntHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TLongIntIterator(TLongIntHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public long key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public int value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public int setValue(int val) {
++ int old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TLongIntIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongIntProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type long and int.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongIntProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>long</code> value
++ * @param b a <code>int</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(long a, int b);
++}// TLongIntProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,56 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for long collections.
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TLongIterator extends TPrimitiveIterator {
++ /** the collection on which the iterator operates */
++ private final TLongHash _hash;
++
++ /**
++ * Creates a TLongIterator for the elements in the specified collection.
++ */
++ public TLongIterator(TLongHash hash) {
++ super(hash);
++ this._hash = hash;
++ }
++
++ /**
++ * Advances the iterator to the next element in the underlying collection
++ * and returns it.
++ *
++ * @return the next long in the collection
++ * @exception NoSuchElementException if the iterator is already exhausted
++ */
++ public long next() {
++ moveToNextIndex();
++ return _hash._set[_index];
++ }
++}// TLongIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongLongHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for long keys and long values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TLongLongHashMap extends TLongHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient long[] _values;
++
++ /**
++ * Creates a new <code>TLongLongHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TLongLongHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TLongLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TLongLongHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TLongLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TLongLongHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TLongLongHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongLongHashMap(TLongHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongLongHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongLongHashMap(int initialCapacity, TLongHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongLongHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongLongHashMap(int initialCapacity, float loadFactor, TLongHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TLongLongHashMap m = (TLongLongHashMap)super.clone();
++ m._values = (long[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TLongLongIterator with access to this map's keys and values
++ */
++ public TLongLongIterator iterator() {
++ return new TLongLongIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new long[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>long</code> value
++ * @param value an <code>long</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (long)0 if none was found.
++ */
++ public long put(long key, long value) {
++ byte previousState;
++ long previous = (long)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ long oldKeys[] = _set;
++ long oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new long[newCapacity];
++ _values = new long[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ long o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>long</code> value
++ * @return the value of <tt>key</tt> or (long)0 if no such mapping exists.
++ */
++ public long get(long key) {
++ int index = index(key);
++ return index < 0 ? (long)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ long[] keys = _set;
++ long[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (long)0;
++ vals[i] = (long)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>long</code> value
++ * @return an <code>long</code> value, or (long)0 if no mapping for key exists
++ */
++ public long remove(long key) {
++ long prev = (long)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TLongLongHashMap)) {
++ return false;
++ }
++ TLongLongHashMap that = (TLongLongHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TLongLongProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(long key, long value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TLongLongProcedure {
++ private final TLongLongHashMap _otherMap;
++
++ EqProcedure(TLongLongHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(long key, long value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two longs for equality.
++ */
++ private final boolean eq(long v1, long v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (long)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public long[] getValues() {
++ long[] vals = new long[size()];
++ long[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public long[] keys() {
++ long[] keys = new long[size()];
++ long[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(long val) {
++ byte[] states = _states;
++ long[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(long key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TLongProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TLongProcedure procedure) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOLongLongProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TLongLongProcedure procedure) {
++ byte[] states = _states;
++ long[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TLongLongProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ long[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TLongFunction</code> value
++ */
++ public void transformValues(TLongFunction function) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(long key) {
++ return adjustValue(key, (long)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(long key, long amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ long key = in.readLong();
++ long val = in.readLong();
++ put(key, val);
++ }
++ }
++} // TLongLongHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongLongIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type long and long.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TLongLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TLongLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TLongLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TLongLongIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TLongLongIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TLongLongHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TLongLongIterator(TLongLongHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public long key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public long value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public long setValue(long val) {
++ long old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TLongLongIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongLongProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type long and long.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongLongProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>long</code> value
++ * @param b a <code>long</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(long a, long b);
++}// TLongLongProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongObjectHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,507 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for long keys and Object values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TLongObjectHashMap<V> extends TLongHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient V[] _values;
++
++ /**
++ * Creates a new <code>TLongObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TLongObjectHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TLongObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TLongObjectHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TLongObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TLongObjectHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TLongObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongObjectHashMap(TLongHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongObjectHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongObjectHashMap(int initialCapacity, TLongHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongObjectHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongObjectHashMap(int initialCapacity, float loadFactor, TLongHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public TLongObjectHashMap<V> clone() {
++ TLongObjectHashMap<V> m = (TLongObjectHashMap<V>)super.clone();
++ m._values = (V[]) this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TLongObjectIterator with access to this map's keys and values
++ */
++ public TLongObjectIterator<V> iterator() {
++ return new TLongObjectIterator<V>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = (V[]) new Object[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>long</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (long)0 if none was found.
++ */
++ public V put(long key, V value) {
++ byte previousState;
++ V previous = null;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ long oldKeys[] = _set;
++ V oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new long[newCapacity];
++ _values = (V[]) new Object[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ long o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>long</code> value
++ * @return the value of <tt>key</tt> or (long)0 if no such mapping exists.
++ */
++ public V get(long key) {
++ int index = index(key);
++ return index < 0 ? null : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ long[] keys = _set;
++ Object[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (long)0;
++ vals[i] = null;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>long</code> value
++ * @return an <code>Object</code> value or (long)0 if no such mapping exists.
++ */
++ public V remove(long key) {
++ V prev = null;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TLongObjectHashMap)) {
++ return false;
++ }
++ TLongObjectHashMap that = (TLongObjectHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TLongObjectProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(long key, Object value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TLongObjectProcedure {
++ private final TLongObjectHashMap _otherMap;
++
++ EqProcedure(TLongObjectHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(long key, Object value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two objects for equality.
++ */
++ private final boolean eq(Object o1, Object o2) {
++ return o1 == o2 || ((o1 != null) && o1.equals(o2));
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = null;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public Object[] getValues() {
++ Object[] vals = new Object[size()];
++ V[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public long[] keys() {
++ long[] keys = new long[size()];
++ long[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(V val) {
++ byte[] states = _states;
++ V[] vals = _values;
++
++ // special case null values so that we don't have to
++ // perform null checks before every call to equals()
++ if (null == val) {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ val == vals[i]) {
++ return true;
++ }
++ }
++ } else {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ (val == vals[i] || val.equals(vals[i]))) {
++ return true;
++ }
++ }
++ } // end of else
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(long key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TLongProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOLongObjectProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TLongObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ long[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TLongObjectProcedure<V> procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ long[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TObjectFunction</code> value
++ */
++ public void transformValues(TObjectFunction<V,V> function) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ long key = in.readLong();
++ V val = (V) in.readObject();
++ put(key, val);
++ }
++ }
++} // TLongObjectHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongObjectIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,151 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type long and Object.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TLongObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TLongObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TLongObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TLongObjectIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TLongObjectIterator<V> extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TLongObjectHashMap<V> _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TLongObjectIterator(TLongObjectHashMap<V> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException
++ * if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public long key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public V value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public V setValue(V val) {
++ V old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TLongObjectIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongObjectProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type long and Object.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongObjectProcedure<T> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>long</code> value
++ * @param b an <code>Object</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(long a, T b);
++}// TLongObjectProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,46 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures with one long paramater.
++ *
++ * Created: Mon Nov 5 21:45:49 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongProcedure {
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param value a value of type <code>long</code>
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(long value);
++}// TLongProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongShortHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for long keys and short values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TLongShortHashMap extends TLongHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient short[] _values;
++
++ /**
++ * Creates a new <code>TLongShortHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TLongShortHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TLongShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TLongShortHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TLongShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TLongShortHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TLongShortHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongShortHashMap(TLongHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongShortHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongShortHashMap(int initialCapacity, TLongHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TLongShortHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TLongShortHashMap(int initialCapacity, float loadFactor, TLongHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TLongShortHashMap m = (TLongShortHashMap)super.clone();
++ m._values = (short[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TLongShortIterator with access to this map's keys and values
++ */
++ public TLongShortIterator iterator() {
++ return new TLongShortIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new short[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>long</code> value
++ * @param value an <code>short</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (long)0 if none was found.
++ */
++ public short put(long key, short value) {
++ byte previousState;
++ short previous = (short)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ long oldKeys[] = _set;
++ short oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new long[newCapacity];
++ _values = new short[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ long o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>long</code> value
++ * @return the value of <tt>key</tt> or (long)0 if no such mapping exists.
++ */
++ public short get(long key) {
++ int index = index(key);
++ return index < 0 ? (short)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ long[] keys = _set;
++ short[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (long)0;
++ vals[i] = (short)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>long</code> value
++ * @return an <code>short</code> value, or (long)0 if no mapping for key exists
++ */
++ public short remove(long key) {
++ short prev = (short)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TLongShortHashMap)) {
++ return false;
++ }
++ TLongShortHashMap that = (TLongShortHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TLongShortProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(long key, short value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TLongShortProcedure {
++ private final TLongShortHashMap _otherMap;
++
++ EqProcedure(TLongShortHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(long key, short value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two shorts for equality.
++ */
++ private final boolean eq(short v1, short v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (short)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public short[] getValues() {
++ short[] vals = new short[size()];
++ short[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public long[] keys() {
++ long[] keys = new long[size()];
++ long[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(short val) {
++ byte[] states = _states;
++ short[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(long key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TLongProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TShortProcedure procedure) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOLongShortProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TLongShortProcedure procedure) {
++ byte[] states = _states;
++ long[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TLongShortProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ long[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TShortFunction</code> value
++ */
++ public void transformValues(TShortFunction function) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(long key) {
++ return adjustValue(key, (short)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(long key, short amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ long key = in.readLong();
++ short val = in.readShort();
++ put(key, val);
++ }
++ }
++} // TLongShortHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongShortIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type long and short.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TLongShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TLongShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TLongShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TLongShortIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TLongShortIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TLongShortHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TLongShortIterator(TLongShortHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public long key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public short value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public short setValue(short val) {
++ short old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TLongShortIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TLongShortProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type long and short.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TLongShortProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>long</code> value
++ * @param b a <code>short</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(long a, short b);
++}// TLongShortProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectByteHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,531 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for Object keys and byte values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectByteHashMap<K> extends TObjectHash<K> implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient byte[] _values;
++
++ /**
++ * Creates a new <code>TObjectByteHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TObjectByteHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TObjectByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TObjectByteHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TObjectByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TObjectByteHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TObjectByteHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectByteHashMap(TObjectHashingStrategy<K> strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectByteHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectByteHashMap(int initialCapacity, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectByteHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectByteHashMap(int initialCapacity, float loadFactor, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return an iterator over the entries in this map
++ */
++ public TObjectByteIterator<K> iterator() {
++ return new TObjectByteIterator<K>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new byte[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>byte</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (byte)0 if none was found.
++ */
++ public byte put(K key, byte value) {
++ byte previous = (byte)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ K oldKey = (K) _set[index];
++ _set[index] = key;
++ _values[index] = value;
++
++ if (isNewMapping) {
++ postInsertHook(oldKey == FREE);
++ }
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ K oldKeys[] = (K[]) _set;
++ byte oldVals[] = _values;
++
++ _set = new Object[newCapacity];
++ Arrays.fill(_set, FREE);
++ _values = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldKeys[i] != FREE && oldKeys[i] != REMOVED) {
++ K o = oldKeys[i];
++ int index = insertionIndex(o);
++ if (index < 0) {
++ throwObjectContractViolation(_set[(-index -1)], o);
++ }
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or (byte)0 if no such mapping exists.
++ */
++ public byte get(K key) {
++ int index = index(key);
++ return index < 0 ? (byte)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ Object[] keys = _set;
++ byte[] vals = _values;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = FREE;
++ vals[i] = (byte)0;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return an <code>byte</code> value or (byte)0 if no such mapping exists.
++ */
++ public byte remove(K key) {
++ byte prev = (byte)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TObjectByteHashMap)) {
++ return false;
++ }
++ TObjectByteHashMap that = (TObjectByteHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ /**
++ * {@inheritDoc}
++ */
++ @Override
++ public TObjectByteHashMap<K> clone() {
++ TObjectByteHashMap<K> clone = ( TObjectByteHashMap<K> ) super.clone();
++ clone._values = new byte[_values.length];
++ for( int i = 0 ; i < clone._values.length; i++ ) {
++ clone._values[i] = _values[i];
++ }
++ return clone;
++ }
++
++
++ private static final class EqProcedure implements TObjectByteProcedure {
++ private final TObjectByteHashMap _otherMap;
++
++ EqProcedure(TObjectByteHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(Object key, byte value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two bytes for equality.
++ */
++ private final boolean eq(byte v1, byte v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = 0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public byte[] getValues() {
++ byte[] vals = new byte[size()];
++ byte[] v = _values;
++ Object[] keys = _set;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Object[] keys() {
++ Object[] keys = new Object[size()];
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @param a the array into which the elements of the list are to
++ * be stored, if it is big enough; otherwise, a new array of the
++ * same runtime type is allocated for this purpose.
++ * @return a <code>Set</code> value
++ */
++ public K[] keys(K[] a) {
++ int size = size();
++ if (a.length < size) {
++ a = (K[]) java.lang.reflect.Array.newInstance(
++ a.getClass().getComponentType(), size);
++ }
++
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ a[j++] = k[i];
++ }
++ }
++ return a;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(byte val) {
++ Object[] keys = _set;
++ byte[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(K key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TObjectProcedure<K> procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TByteProcedure procedure) {
++ Object[] keys = _set;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED
++ && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOObjectByteProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TObjectByteProcedure<K> procedure) {
++ K[] keys = (K[]) _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TObjectByteProcedure<K> procedure) {
++ boolean modified = false;
++ K[] keys = (K[]) _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TByteFunction</code> value
++ */
++ public void transformValues(TByteFunction function) {
++ Object[] keys = _set;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != null && keys[i] != REMOVED) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(K key) {
++ return adjustValue(key, (byte)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(K key, byte amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ K key = (K) in.readObject();
++ byte val = in.readByte();
++ put(key, val);
++ }
++ }
++} // TObjectByteHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectByteIterator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,166 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.util.ConcurrentModificationException;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type Object and byte.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TObjectByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TObjectByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TObjectByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TObjectByteIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PIterator.template,v 1.2 2006/11/30 22:06:22 robeden Exp $
++ */
++
++public class TObjectByteIterator<K> extends TIterator {
++ private final TObjectByteHashMap<K> _map;
++
++ public TObjectByteIterator(TObjectByteHashMap<K> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Returns the index of the next value in the data structure
++ * or a negative value if the iterator is exhausted.
++ *
++ * @return an <code>byte</code> value
++ */
++ protected final int nextIndex() {
++ if (_expectedSize != _hash.size()) {
++ throw new ConcurrentModificationException();
++ }
++
++ Object[] set = _map._set;
++ int i = _index;
++ while (i-- > 0 && (set[i] == null || set[i] == TObjectHash.REMOVED ||
++ set[i] == TObjectHash.FREE)) ;
++ return i;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public K key() {
++ return (K) _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public byte value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public byte setValue(byte val) {
++ byte old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TObjectByteIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectByteProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type Object and byte.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TObjectByteProcedure<K> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a an <code>Object</code> value
++ * @param b a <code>byte</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(K a, byte b);
++}// TObjectByteProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectDoubleHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,531 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for Object keys and double values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectDoubleHashMap<K> extends TObjectHash<K> implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient double[] _values;
++
++ /**
++ * Creates a new <code>TObjectDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TObjectDoubleHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TObjectDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TObjectDoubleHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TObjectDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TObjectDoubleHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TObjectDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectDoubleHashMap(TObjectHashingStrategy<K> strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectDoubleHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectDoubleHashMap(int initialCapacity, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectDoubleHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectDoubleHashMap(int initialCapacity, float loadFactor, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return an iterator over the entries in this map
++ */
++ public TObjectDoubleIterator<K> iterator() {
++ return new TObjectDoubleIterator<K>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new double[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>double</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (double)0 if none was found.
++ */
++ public double put(K key, double value) {
++ double previous = (double)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ K oldKey = (K) _set[index];
++ _set[index] = key;
++ _values[index] = value;
++
++ if (isNewMapping) {
++ postInsertHook(oldKey == FREE);
++ }
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ K oldKeys[] = (K[]) _set;
++ double oldVals[] = _values;
++
++ _set = new Object[newCapacity];
++ Arrays.fill(_set, FREE);
++ _values = new double[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldKeys[i] != FREE && oldKeys[i] != REMOVED) {
++ K o = oldKeys[i];
++ int index = insertionIndex(o);
++ if (index < 0) {
++ throwObjectContractViolation(_set[(-index -1)], o);
++ }
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or (double)0 if no such mapping exists.
++ */
++ public double get(K key) {
++ int index = index(key);
++ return index < 0 ? (double)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ Object[] keys = _set;
++ double[] vals = _values;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = FREE;
++ vals[i] = (double)0;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return an <code>double</code> value or (double)0 if no such mapping exists.
++ */
++ public double remove(K key) {
++ double prev = (double)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TObjectDoubleHashMap)) {
++ return false;
++ }
++ TObjectDoubleHashMap that = (TObjectDoubleHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ /**
++ * {@inheritDoc}
++ */
++ @Override
++ public TObjectDoubleHashMap<K> clone() {
++ TObjectDoubleHashMap<K> clone = ( TObjectDoubleHashMap<K> ) super.clone();
++ clone._values = new double[_values.length];
++ for( int i = 0 ; i < clone._values.length; i++ ) {
++ clone._values[i] = _values[i];
++ }
++ return clone;
++ }
++
++
++ private static final class EqProcedure implements TObjectDoubleProcedure {
++ private final TObjectDoubleHashMap _otherMap;
++
++ EqProcedure(TObjectDoubleHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(Object key, double value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two doubles for equality.
++ */
++ private final boolean eq(double v1, double v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = 0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public double[] getValues() {
++ double[] vals = new double[size()];
++ double[] v = _values;
++ Object[] keys = _set;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Object[] keys() {
++ Object[] keys = new Object[size()];
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @param a the array into which the elements of the list are to
++ * be stored, if it is big enough; otherwise, a new array of the
++ * same runtime type is allocated for this purpose.
++ * @return a <code>Set</code> value
++ */
++ public K[] keys(K[] a) {
++ int size = size();
++ if (a.length < size) {
++ a = (K[]) java.lang.reflect.Array.newInstance(
++ a.getClass().getComponentType(), size);
++ }
++
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ a[j++] = k[i];
++ }
++ }
++ return a;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(double val) {
++ Object[] keys = _set;
++ double[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(K key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TObjectProcedure<K> procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TDoubleProcedure procedure) {
++ Object[] keys = _set;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED
++ && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOObjectDoubleProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TObjectDoubleProcedure<K> procedure) {
++ K[] keys = (K[]) _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TObjectDoubleProcedure<K> procedure) {
++ boolean modified = false;
++ K[] keys = (K[]) _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TDoubleFunction</code> value
++ */
++ public void transformValues(TDoubleFunction function) {
++ Object[] keys = _set;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != null && keys[i] != REMOVED) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(K key) {
++ return adjustValue(key, (double)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(K key, double amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ K key = (K) in.readObject();
++ double val = in.readDouble();
++ put(key, val);
++ }
++ }
++} // TObjectDoubleHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectDoubleIterator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,166 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.util.ConcurrentModificationException;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type Object and double.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TObjectDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TObjectDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TObjectDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TObjectDoubleIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PIterator.template,v 1.2 2006/11/30 22:06:22 robeden Exp $
++ */
++
++public class TObjectDoubleIterator<K> extends TIterator {
++ private final TObjectDoubleHashMap<K> _map;
++
++ public TObjectDoubleIterator(TObjectDoubleHashMap<K> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Returns the index of the next value in the data structure
++ * or a negative value if the iterator is exhausted.
++ *
++ * @return an <code>double</code> value
++ */
++ protected final int nextIndex() {
++ if (_expectedSize != _hash.size()) {
++ throw new ConcurrentModificationException();
++ }
++
++ Object[] set = _map._set;
++ int i = _index;
++ while (i-- > 0 && (set[i] == null || set[i] == TObjectHash.REMOVED ||
++ set[i] == TObjectHash.FREE)) ;
++ return i;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public K key() {
++ return (K) _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public double value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public double setValue(double val) {
++ double old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TObjectDoubleIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectDoubleProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type Object and double.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TObjectDoubleProcedure<K> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a an <code>Object</code> value
++ * @param b a <code>double</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(K a, double b);
++}// TObjectDoubleProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectFloatHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,531 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for Object keys and float values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectFloatHashMap<K> extends TObjectHash<K> implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient float[] _values;
++
++ /**
++ * Creates a new <code>TObjectFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TObjectFloatHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TObjectFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TObjectFloatHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TObjectFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TObjectFloatHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TObjectFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectFloatHashMap(TObjectHashingStrategy<K> strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectFloatHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectFloatHashMap(int initialCapacity, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectFloatHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectFloatHashMap(int initialCapacity, float loadFactor, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return an iterator over the entries in this map
++ */
++ public TObjectFloatIterator<K> iterator() {
++ return new TObjectFloatIterator<K>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new float[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>float</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (float)0 if none was found.
++ */
++ public float put(K key, float value) {
++ float previous = (float)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ K oldKey = (K) _set[index];
++ _set[index] = key;
++ _values[index] = value;
++
++ if (isNewMapping) {
++ postInsertHook(oldKey == FREE);
++ }
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ K oldKeys[] = (K[]) _set;
++ float oldVals[] = _values;
++
++ _set = new Object[newCapacity];
++ Arrays.fill(_set, FREE);
++ _values = new float[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldKeys[i] != FREE && oldKeys[i] != REMOVED) {
++ K o = oldKeys[i];
++ int index = insertionIndex(o);
++ if (index < 0) {
++ throwObjectContractViolation(_set[(-index -1)], o);
++ }
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or (float)0 if no such mapping exists.
++ */
++ public float get(K key) {
++ int index = index(key);
++ return index < 0 ? (float)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ Object[] keys = _set;
++ float[] vals = _values;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = FREE;
++ vals[i] = (float)0;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return an <code>float</code> value or (float)0 if no such mapping exists.
++ */
++ public float remove(K key) {
++ float prev = (float)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TObjectFloatHashMap)) {
++ return false;
++ }
++ TObjectFloatHashMap that = (TObjectFloatHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ /**
++ * {@inheritDoc}
++ */
++ @Override
++ public TObjectFloatHashMap<K> clone() {
++ TObjectFloatHashMap<K> clone = ( TObjectFloatHashMap<K> ) super.clone();
++ clone._values = new float[_values.length];
++ for( int i = 0 ; i < clone._values.length; i++ ) {
++ clone._values[i] = _values[i];
++ }
++ return clone;
++ }
++
++
++ private static final class EqProcedure implements TObjectFloatProcedure {
++ private final TObjectFloatHashMap _otherMap;
++
++ EqProcedure(TObjectFloatHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(Object key, float value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two floats for equality.
++ */
++ private final boolean eq(float v1, float v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = 0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public float[] getValues() {
++ float[] vals = new float[size()];
++ float[] v = _values;
++ Object[] keys = _set;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Object[] keys() {
++ Object[] keys = new Object[size()];
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @param a the array into which the elements of the list are to
++ * be stored, if it is big enough; otherwise, a new array of the
++ * same runtime type is allocated for this purpose.
++ * @return a <code>Set</code> value
++ */
++ public K[] keys(K[] a) {
++ int size = size();
++ if (a.length < size) {
++ a = (K[]) java.lang.reflect.Array.newInstance(
++ a.getClass().getComponentType(), size);
++ }
++
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ a[j++] = k[i];
++ }
++ }
++ return a;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(float val) {
++ Object[] keys = _set;
++ float[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(K key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TObjectProcedure<K> procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TFloatProcedure procedure) {
++ Object[] keys = _set;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED
++ && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOObjectFloatProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TObjectFloatProcedure<K> procedure) {
++ K[] keys = (K[]) _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TObjectFloatProcedure<K> procedure) {
++ boolean modified = false;
++ K[] keys = (K[]) _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TFloatFunction</code> value
++ */
++ public void transformValues(TFloatFunction function) {
++ Object[] keys = _set;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != null && keys[i] != REMOVED) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(K key) {
++ return adjustValue(key, (float)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(K key, float amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ K key = (K) in.readObject();
++ float val = in.readFloat();
++ put(key, val);
++ }
++ }
++} // TObjectFloatHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectFloatIterator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,166 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.util.ConcurrentModificationException;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type Object and float.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TObjectFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TObjectFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TObjectFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TObjectFloatIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PIterator.template,v 1.2 2006/11/30 22:06:22 robeden Exp $
++ */
++
++public class TObjectFloatIterator<K> extends TIterator {
++ private final TObjectFloatHashMap<K> _map;
++
++ public TObjectFloatIterator(TObjectFloatHashMap<K> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Returns the index of the next value in the data structure
++ * or a negative value if the iterator is exhausted.
++ *
++ * @return an <code>float</code> value
++ */
++ protected final int nextIndex() {
++ if (_expectedSize != _hash.size()) {
++ throw new ConcurrentModificationException();
++ }
++
++ Object[] set = _map._set;
++ int i = _index;
++ while (i-- > 0 && (set[i] == null || set[i] == TObjectHash.REMOVED ||
++ set[i] == TObjectHash.FREE)) ;
++ return i;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public K key() {
++ return (K) _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public float value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public float setValue(float val) {
++ float old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TObjectFloatIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectFloatProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type Object and float.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TObjectFloatProcedure<K> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a an <code>Object</code> value
++ * @param b a <code>float</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(K a, float b);
++}// TObjectFloatProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectIntHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,531 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for Object keys and int values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectIntHashMap<K> extends TObjectHash<K> implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient int[] _values;
++
++ /**
++ * Creates a new <code>TObjectIntHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TObjectIntHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TObjectIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TObjectIntHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TObjectIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TObjectIntHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TObjectIntHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectIntHashMap(TObjectHashingStrategy<K> strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectIntHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectIntHashMap(int initialCapacity, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectIntHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectIntHashMap(int initialCapacity, float loadFactor, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return an iterator over the entries in this map
++ */
++ public TObjectIntIterator<K> iterator() {
++ return new TObjectIntIterator<K>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new int[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>int</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (int)0 if none was found.
++ */
++ public int put(K key, int value) {
++ int previous = (int)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ K oldKey = (K) _set[index];
++ _set[index] = key;
++ _values[index] = value;
++
++ if (isNewMapping) {
++ postInsertHook(oldKey == FREE);
++ }
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ K oldKeys[] = (K[]) _set;
++ int oldVals[] = _values;
++
++ _set = new Object[newCapacity];
++ Arrays.fill(_set, FREE);
++ _values = new int[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldKeys[i] != FREE && oldKeys[i] != REMOVED) {
++ K o = oldKeys[i];
++ int index = insertionIndex(o);
++ if (index < 0) {
++ throwObjectContractViolation(_set[(-index -1)], o);
++ }
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or (int)0 if no such mapping exists.
++ */
++ public int get(K key) {
++ int index = index(key);
++ return index < 0 ? (int)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ Object[] keys = _set;
++ int[] vals = _values;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = FREE;
++ vals[i] = (int)0;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return an <code>int</code> value or (int)0 if no such mapping exists.
++ */
++ public int remove(K key) {
++ int prev = (int)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TObjectIntHashMap)) {
++ return false;
++ }
++ TObjectIntHashMap that = (TObjectIntHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ /**
++ * {@inheritDoc}
++ */
++ @Override
++ public TObjectIntHashMap<K> clone() {
++ TObjectIntHashMap<K> clone = ( TObjectIntHashMap<K> ) super.clone();
++ clone._values = new int[_values.length];
++ for( int i = 0 ; i < clone._values.length; i++ ) {
++ clone._values[i] = _values[i];
++ }
++ return clone;
++ }
++
++
++ private static final class EqProcedure implements TObjectIntProcedure {
++ private final TObjectIntHashMap _otherMap;
++
++ EqProcedure(TObjectIntHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(Object key, int value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two ints for equality.
++ */
++ private final boolean eq(int v1, int v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = 0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public int[] getValues() {
++ int[] vals = new int[size()];
++ int[] v = _values;
++ Object[] keys = _set;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Object[] keys() {
++ Object[] keys = new Object[size()];
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @param a the array into which the elements of the list are to
++ * be stored, if it is big enough; otherwise, a new array of the
++ * same runtime type is allocated for this purpose.
++ * @return a <code>Set</code> value
++ */
++ public K[] keys(K[] a) {
++ int size = size();
++ if (a.length < size) {
++ a = (K[]) java.lang.reflect.Array.newInstance(
++ a.getClass().getComponentType(), size);
++ }
++
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ a[j++] = k[i];
++ }
++ }
++ return a;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(int val) {
++ Object[] keys = _set;
++ int[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(K key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TObjectProcedure<K> procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TIntProcedure procedure) {
++ Object[] keys = _set;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED
++ && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOObjectIntProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TObjectIntProcedure<K> procedure) {
++ K[] keys = (K[]) _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TObjectIntProcedure<K> procedure) {
++ boolean modified = false;
++ K[] keys = (K[]) _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TIntFunction</code> value
++ */
++ public void transformValues(TIntFunction function) {
++ Object[] keys = _set;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != null && keys[i] != REMOVED) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(K key) {
++ return adjustValue(key, (int)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(K key, int amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ K key = (K) in.readObject();
++ int val = in.readInt();
++ put(key, val);
++ }
++ }
++} // TObjectIntHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectIntIterator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,166 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.util.ConcurrentModificationException;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type Object and int.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TObjectIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TObjectIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TObjectIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TObjectIntIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PIterator.template,v 1.2 2006/11/30 22:06:22 robeden Exp $
++ */
++
++public class TObjectIntIterator<K> extends TIterator {
++ private final TObjectIntHashMap<K> _map;
++
++ public TObjectIntIterator(TObjectIntHashMap<K> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Returns the index of the next value in the data structure
++ * or a negative value if the iterator is exhausted.
++ *
++ * @return an <code>int</code> value
++ */
++ protected final int nextIndex() {
++ if (_expectedSize != _hash.size()) {
++ throw new ConcurrentModificationException();
++ }
++
++ Object[] set = _map._set;
++ int i = _index;
++ while (i-- > 0 && (set[i] == null || set[i] == TObjectHash.REMOVED ||
++ set[i] == TObjectHash.FREE)) ;
++ return i;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public K key() {
++ return (K) _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public int value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public int setValue(int val) {
++ int old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TObjectIntIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectIntProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type Object and int.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TObjectIntProcedure<K> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a an <code>Object</code> value
++ * @param b a <code>int</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(K a, int b);
++}// TObjectIntProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectLongHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,531 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for Object keys and long values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectLongHashMap<K> extends TObjectHash<K> implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient long[] _values;
++
++ /**
++ * Creates a new <code>TObjectLongHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TObjectLongHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TObjectLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TObjectLongHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TObjectLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TObjectLongHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TObjectLongHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectLongHashMap(TObjectHashingStrategy<K> strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectLongHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectLongHashMap(int initialCapacity, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectLongHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectLongHashMap(int initialCapacity, float loadFactor, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return an iterator over the entries in this map
++ */
++ public TObjectLongIterator<K> iterator() {
++ return new TObjectLongIterator<K>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new long[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>long</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (long)0 if none was found.
++ */
++ public long put(K key, long value) {
++ long previous = (long)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ K oldKey = (K) _set[index];
++ _set[index] = key;
++ _values[index] = value;
++
++ if (isNewMapping) {
++ postInsertHook(oldKey == FREE);
++ }
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ K oldKeys[] = (K[]) _set;
++ long oldVals[] = _values;
++
++ _set = new Object[newCapacity];
++ Arrays.fill(_set, FREE);
++ _values = new long[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldKeys[i] != FREE && oldKeys[i] != REMOVED) {
++ K o = oldKeys[i];
++ int index = insertionIndex(o);
++ if (index < 0) {
++ throwObjectContractViolation(_set[(-index -1)], o);
++ }
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or (long)0 if no such mapping exists.
++ */
++ public long get(K key) {
++ int index = index(key);
++ return index < 0 ? (long)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ Object[] keys = _set;
++ long[] vals = _values;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = FREE;
++ vals[i] = (long)0;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return an <code>long</code> value or (long)0 if no such mapping exists.
++ */
++ public long remove(K key) {
++ long prev = (long)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TObjectLongHashMap)) {
++ return false;
++ }
++ TObjectLongHashMap that = (TObjectLongHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ /**
++ * {@inheritDoc}
++ */
++ @Override
++ public TObjectLongHashMap<K> clone() {
++ TObjectLongHashMap<K> clone = ( TObjectLongHashMap<K> ) super.clone();
++ clone._values = new long[_values.length];
++ for( int i = 0 ; i < clone._values.length; i++ ) {
++ clone._values[i] = _values[i];
++ }
++ return clone;
++ }
++
++
++ private static final class EqProcedure implements TObjectLongProcedure {
++ private final TObjectLongHashMap _otherMap;
++
++ EqProcedure(TObjectLongHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(Object key, long value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two longs for equality.
++ */
++ private final boolean eq(long v1, long v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = 0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public long[] getValues() {
++ long[] vals = new long[size()];
++ long[] v = _values;
++ Object[] keys = _set;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Object[] keys() {
++ Object[] keys = new Object[size()];
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @param a the array into which the elements of the list are to
++ * be stored, if it is big enough; otherwise, a new array of the
++ * same runtime type is allocated for this purpose.
++ * @return a <code>Set</code> value
++ */
++ public K[] keys(K[] a) {
++ int size = size();
++ if (a.length < size) {
++ a = (K[]) java.lang.reflect.Array.newInstance(
++ a.getClass().getComponentType(), size);
++ }
++
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ a[j++] = k[i];
++ }
++ }
++ return a;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(long val) {
++ Object[] keys = _set;
++ long[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(K key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TObjectProcedure<K> procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TLongProcedure procedure) {
++ Object[] keys = _set;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED
++ && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOObjectLongProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TObjectLongProcedure<K> procedure) {
++ K[] keys = (K[]) _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TObjectLongProcedure<K> procedure) {
++ boolean modified = false;
++ K[] keys = (K[]) _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TLongFunction</code> value
++ */
++ public void transformValues(TLongFunction function) {
++ Object[] keys = _set;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != null && keys[i] != REMOVED) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(K key) {
++ return adjustValue(key, (long)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(K key, long amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ K key = (K) in.readObject();
++ long val = in.readLong();
++ put(key, val);
++ }
++ }
++} // TObjectLongHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectLongIterator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,166 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.util.ConcurrentModificationException;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type Object and long.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TObjectLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TObjectLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TObjectLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TObjectLongIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PIterator.template,v 1.2 2006/11/30 22:06:22 robeden Exp $
++ */
++
++public class TObjectLongIterator<K> extends TIterator {
++ private final TObjectLongHashMap<K> _map;
++
++ public TObjectLongIterator(TObjectLongHashMap<K> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Returns the index of the next value in the data structure
++ * or a negative value if the iterator is exhausted.
++ *
++ * @return an <code>long</code> value
++ */
++ protected final int nextIndex() {
++ if (_expectedSize != _hash.size()) {
++ throw new ConcurrentModificationException();
++ }
++
++ Object[] set = _map._set;
++ int i = _index;
++ while (i-- > 0 && (set[i] == null || set[i] == TObjectHash.REMOVED ||
++ set[i] == TObjectHash.FREE)) ;
++ return i;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public K key() {
++ return (K) _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public long value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public long setValue(long val) {
++ long old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TObjectLongIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectLongProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type Object and long.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TObjectLongProcedure<K> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a an <code>Object</code> value
++ * @param b a <code>long</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(K a, long b);
++}// TObjectLongProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectShortHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,531 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for Object keys and short values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TObjectShortHashMap<K> extends TObjectHash<K> implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient short[] _values;
++
++ /**
++ * Creates a new <code>TObjectShortHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TObjectShortHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TObjectShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TObjectShortHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TObjectShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TObjectShortHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TObjectShortHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectShortHashMap(TObjectHashingStrategy<K> strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectShortHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectShortHashMap(int initialCapacity, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TObjectShortHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TObjectShortHashMap(int initialCapacity, float loadFactor, TObjectHashingStrategy<K> strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return an iterator over the entries in this map
++ */
++ public TObjectShortIterator<K> iterator() {
++ return new TObjectShortIterator<K>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new short[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>Object</code> value
++ * @param value an <code>short</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (short)0 if none was found.
++ */
++ public short put(K key, short value) {
++ short previous = (short)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ K oldKey = (K) _set[index];
++ _set[index] = key;
++ _values[index] = value;
++
++ if (isNewMapping) {
++ postInsertHook(oldKey == FREE);
++ }
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ K oldKeys[] = (K[]) _set;
++ short oldVals[] = _values;
++
++ _set = new Object[newCapacity];
++ Arrays.fill(_set, FREE);
++ _values = new short[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldKeys[i] != FREE && oldKeys[i] != REMOVED) {
++ K o = oldKeys[i];
++ int index = insertionIndex(o);
++ if (index < 0) {
++ throwObjectContractViolation(_set[(-index -1)], o);
++ }
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>Object</code> value
++ * @return the value of <tt>key</tt> or (short)0 if no such mapping exists.
++ */
++ public short get(K key) {
++ int index = index(key);
++ return index < 0 ? (short)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ Object[] keys = _set;
++ short[] vals = _values;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = FREE;
++ vals[i] = (short)0;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return an <code>short</code> value or (short)0 if no such mapping exists.
++ */
++ public short remove(K key) {
++ short prev = (short)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TObjectShortHashMap)) {
++ return false;
++ }
++ TObjectShortHashMap that = (TObjectShortHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ /**
++ * {@inheritDoc}
++ */
++ @Override
++ public TObjectShortHashMap<K> clone() {
++ TObjectShortHashMap<K> clone = ( TObjectShortHashMap<K> ) super.clone();
++ clone._values = new short[_values.length];
++ for( int i = 0 ; i < clone._values.length; i++ ) {
++ clone._values[i] = _values[i];
++ }
++ return clone;
++ }
++
++
++ private static final class EqProcedure implements TObjectShortProcedure {
++ private final TObjectShortHashMap _otherMap;
++
++ EqProcedure(TObjectShortHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(Object key, short value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two shorts for equality.
++ */
++ private final boolean eq(short v1, short v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = 0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public short[] getValues() {
++ short[] vals = new short[size()];
++ short[] v = _values;
++ Object[] keys = _set;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public Object[] keys() {
++ Object[] keys = new Object[size()];
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @param a the array into which the elements of the list are to
++ * be stored, if it is big enough; otherwise, a new array of the
++ * same runtime type is allocated for this purpose.
++ * @return a <code>Set</code> value
++ */
++ public K[] keys(K[] a) {
++ int size = size();
++ if (a.length < size) {
++ a = (K[]) java.lang.reflect.Array.newInstance(
++ a.getClass().getComponentType(), size);
++ }
++
++ K[] k = (K[]) _set;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (k[i] != FREE && k[i] != REMOVED) {
++ a[j++] = k[i];
++ }
++ }
++ return a;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(short val) {
++ Object[] keys = _set;
++ short[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(K key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TObjectProcedure<K> procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TShortProcedure procedure) {
++ Object[] keys = _set;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != FREE && keys[i] != REMOVED
++ && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOObjectShortProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TObjectShortProcedure<K> procedure) {
++ K[] keys = (K[]) _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TObjectShortProcedure<K> procedure) {
++ boolean modified = false;
++ K[] keys = (K[]) _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (keys[i] != FREE
++ && keys[i] != REMOVED
++ && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TShortFunction</code> value
++ */
++ public void transformValues(TShortFunction function) {
++ Object[] keys = _set;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (keys[i] != null && keys[i] != REMOVED) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(K key) {
++ return adjustValue(key, (short)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(K key, short amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ K key = (K) in.readObject();
++ short val = in.readShort();
++ put(key, val);
++ }
++ }
++} // TObjectShortHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectShortIterator.java 2007-04-18 06:49:35.000000000 +0000
+@@ -0,0 +1,166 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.util.ConcurrentModificationException;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type Object and short.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TObjectShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TObjectShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TObjectShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.forward();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TObjectShortIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PIterator.template,v 1.2 2006/11/30 22:06:22 robeden Exp $
++ */
++
++public class TObjectShortIterator<K> extends TIterator {
++ private final TObjectShortHashMap<K> _map;
++
++ public TObjectShortIterator(TObjectShortHashMap<K> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Returns the index of the next value in the data structure
++ * or a negative value if the iterator is exhausted.
++ *
++ * @return an <code>short</code> value
++ */
++ protected final int nextIndex() {
++ if (_expectedSize != _hash.size()) {
++ throw new ConcurrentModificationException();
++ }
++
++ Object[] set = _map._set;
++ int i = _index;
++ while (i-- > 0 && (set[i] == null || set[i] == TObjectHash.REMOVED ||
++ set[i] == TObjectHash.FREE)) ;
++ return i;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public K key() {
++ return (K) _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public short value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public short setValue(short val) {
++ short old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TObjectShortIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TObjectShortProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type Object and short.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: O2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TObjectShortProcedure<K> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a an <code>Object</code> value
++ * @param b a <code>short</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(K a, short b);
++}// TObjectShortProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortArrayList.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,905 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Externalizable;
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.util.Arrays;
++import java.util.Random;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * A resizable, array-backed list of short primitives.
++ *
++ * Created: Sat Dec 29 14:21:12 2001
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TShortArrayList implements Externalizable, Cloneable {
++ static final long serialVersionUID = 1L;
++
++ /** the data of the list */
++ protected short[] _data;
++
++ /** the index after the last entry in the list */
++ protected int _pos;
++
++ /** the default capacity for new lists */
++ protected static final int DEFAULT_CAPACITY = 10;
++
++ /**
++ * Creates a new <code>TShortArrayList</code> instance with the
++ * default capacity.
++ */
++ public TShortArrayList() {
++ this(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Creates a new <code>TShortArrayList</code> instance with the
++ * specified capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public TShortArrayList(int capacity) {
++ _data = new short[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Creates a new <code>TShortArrayList</code> instance whose
++ * capacity is the greater of the length of <tt>values</tt> and
++ * DEFAULT_CAPACITY and whose initial contents are the specified
++ * values.
++ *
++ * @param values an <code>short[]</code> value
++ */
++ public TShortArrayList(short[] values) {
++ this(Math.max(values.length, DEFAULT_CAPACITY));
++ add(values);
++ }
++
++ // sizing
++
++ /**
++ * Grow the internal array as needed to accomodate the specified
++ * number of elements. The size of the array shorts on each
++ * resize unless <tt>capacity</tt> requires more than twice the
++ * current capacity.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void ensureCapacity(int capacity) {
++ if (capacity > _data.length) {
++ int newCap = Math.max(_data.length << 1, capacity);
++ short[] tmp = new short[newCap];
++ System.arraycopy(_data, 0, tmp, 0, _data.length);
++ _data = tmp;
++ }
++ }
++
++ /**
++ * Returns the number of values in the list.
++ *
++ * @return the number of values in the list.
++ */
++ public int size() {
++ return _pos;
++ }
++
++ /**
++ * Tests whether this list contains any values.
++ *
++ * @return true if the list is empty.
++ */
++ public boolean isEmpty() {
++ return _pos == 0;
++ }
++
++ /**
++ * Sheds any excess capacity above and beyond the current size of
++ * the list.
++ */
++ public void trimToSize() {
++ if (_data.length > size()) {
++ short[] tmp = new short[size()];
++ toNativeArray(tmp, 0, tmp.length);
++ _data = tmp;
++ }
++ }
++
++ // modifying
++
++ /**
++ * Adds <tt>val</tt> to the end of the list, growing as needed.
++ *
++ * @param val an <code>short</code> value
++ */
++ public void add(short val) {
++ ensureCapacity(_pos + 1);
++ _data[_pos++] = val;
++ }
++
++ /**
++ * Adds the values in the array <tt>vals</tt> to the end of the
++ * list, in order.
++ *
++ * @param vals an <code>short[]</code> value
++ */
++ public void add(short[] vals) {
++ add(vals, 0, vals.length);
++ }
++
++ /**
++ * Adds a subset of the values in the array <tt>vals</tt> to the
++ * end of the list, in order.
++ *
++ * @param vals an <code>short[]</code> value
++ * @param offset the offset at which to start copying
++ * @param length the number of values to copy.
++ */
++ public void add(short[] vals, int offset, int length) {
++ ensureCapacity(_pos + length);
++ System.arraycopy(vals, offset, _data, _pos, length);
++ _pos += length;
++ }
++
++ /**
++ * Inserts <tt>value</tt> into the list at <tt>offset</tt>. All
++ * values including and to the right of <tt>offset</tt> are shifted
++ * to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param value an <code>short</code> value
++ */
++ public void insert(int offset, short value) {
++ if (offset == _pos) {
++ add(value);
++ return;
++ }
++ ensureCapacity(_pos + 1);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + 1, _pos - offset);
++ // insert
++ _data[offset] = value;
++ _pos++;
++ }
++
++ /**
++ * Inserts the array of <tt>values</tt> into the list at
++ * <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>short[]</code> value
++ */
++ public void insert(int offset, short[] values) {
++ insert(offset, values, 0, values.length);
++ }
++
++ /**
++ * Inserts a slice of the array of <tt>values</tt> into the list
++ * at <tt>offset</tt>. All values including and to the right of
++ * <tt>offset</tt> are shifted to the right.
++ *
++ * @param offset an <code>int</code> value
++ * @param values an <code>short[]</code> value
++ * @param valOffset the offset in the values array at which to
++ * start copying.
++ * @param len the number of values to copy from the values array
++ */
++ public void insert(int offset, short[] values, int valOffset, int len) {
++ if (offset == _pos) {
++ add(values, valOffset, len);
++ return;
++ }
++
++ ensureCapacity(_pos + len);
++ // shift right
++ System.arraycopy(_data, offset, _data, offset + len, _pos - offset);
++ // insert
++ System.arraycopy(values, valOffset, _data, offset, len);
++ _pos += len;
++ }
++
++ /**
++ * Returns the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>short</code> value
++ */
++ public short get(int offset) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ return _data[offset];
++ }
++
++ /**
++ * Returns the value at the specified offset without doing any
++ * bounds checking.
++ *
++ * @param offset an <code>int</code> value
++ * @return an <code>short</code> value
++ */
++ public short getQuick(int offset) {
++ return _data[offset];
++ }
++
++ /**
++ * Sets the value at the specified offset.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>short</code> value
++ */
++ public void set(int offset, short val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ _data[offset] = val;
++ }
++
++ /**
++ * Sets the value at the specified offset and returns the
++ * previously stored value.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>short</code> value
++ * @return the value previously stored at offset.
++ */
++ public short getSet(int offset, short val) {
++ if (offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ short old = _data[offset];
++ _data[offset] = val;
++ return old;
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * the contents of the <tt>values</tt> array.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ */
++ public void set(int offset, short[] values) {
++ set(offset, values, 0, values.length);
++ }
++
++ /**
++ * Replace the values in the list starting at <tt>offset</tt> with
++ * <tt>length</tt> values from the <tt>values</tt> array, starting
++ * at valOffset.
++ *
++ * @param offset the first offset to replace
++ * @param values the source of the new values
++ * @param valOffset the first value to copy from the values array
++ * @param length the number of values to copy
++ */
++ public void set(int offset, short[] values, int valOffset, int length) {
++ if (offset < 0 || offset + length > _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(values, valOffset, _data, offset, length);
++ }
++
++ /**
++ * Sets the value at the specified offset without doing any bounds
++ * checking.
++ *
++ * @param offset an <code>int</code> value
++ * @param val an <code>short</code> value
++ */
++ public void setQuick(int offset, short val) {
++ _data[offset] = val;
++ }
++
++ /**
++ * Flushes the internal state of the list, resetting the capacity
++ * to the default.
++ */
++ public void clear() {
++ clear(DEFAULT_CAPACITY);
++ }
++
++ /**
++ * Flushes the internal state of the list, setting the capacity of
++ * the empty list to <tt>capacity</tt>.
++ *
++ * @param capacity an <code>int</code> value
++ */
++ public void clear(int capacity) {
++ _data = new short[capacity];
++ _pos = 0;
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list without
++ * allocating new backing arrays.
++ *
++ * @see #clear
++ */
++ public void reset() {
++ _pos = 0;
++ fill((short)0);
++ }
++
++ /**
++ * Sets the size of the list to 0, but does not change its
++ * capacity. This method can be used as an alternative to the
++ * {@link #clear clear} method if you want to recyle a list
++ * without allocating new backing arrays. This method differs
++ * from {@link #reset reset} in that it does not clear the old
++ * values in the backing array. Thus, it is possible for {@link
++ * #getQuick getQuick} to return stale data if this method is used
++ * and the caller is careless about bounds checking.
++ *
++ * @see #reset
++ * @see #clear
++ * @see #getQuick
++ */
++ public void resetQuick() {
++ _pos = 0;
++ }
++
++ /**
++ * Removes the value at <tt>offset</tt> from the list.
++ *
++ * @param offset an <code>int</code> value
++ * @return the value previously stored at offset.
++ */
++ public short remove(int offset) {
++ short old = get(offset);
++ remove(offset, 1);
++ return old;
++ }
++
++ /**
++ * Removes <tt>length</tt> values from the list, starting at
++ * <tt>offset</tt>
++ *
++ * @param offset an <code>int</code> value
++ * @param length an <code>int</code> value
++ */
++ public void remove(int offset, int length) {
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++
++ if (offset == 0) {
++ // data at the front
++ System.arraycopy(_data, length, _data, 0, _pos - length);
++ } else if (_pos - length == offset) {
++ // no copy to make, decrementing pos "deletes" values at
++ // the end
++ } else {
++ // data in the middle
++ System.arraycopy(_data, offset + length,
++ _data, offset, _pos - (offset + length));
++ }
++ _pos -= length;
++ // no need to clear old values beyond _pos, because this is a
++ // primitive collection and 0 takes as much room as any other
++ // value
++ }
++
++ /**
++ * Transform each value in the list using the specified function.
++ *
++ * @param function a <code>TShortFunction</code> value
++ */
++ public void transformValues(TShortFunction function) {
++ for (int i = _pos; i-- > 0;) {
++ _data[i] = function.execute(_data[i]);
++ }
++ }
++
++ /**
++ * Reverse the order of the elements in the list.
++ */
++ public void reverse() {
++ reverse(0, _pos);
++ }
++
++ /**
++ * Reverse the order of the elements in the range of the list.
++ *
++ * @param from the inclusive index at which to start reversing
++ * @param to the exclusive index at which to stop reversing
++ */
++ public void reverse(int from, int to) {
++ if (from == to) {
++ return; // nothing to do
++ }
++ if (from > to) {
++ throw new IllegalArgumentException("from cannot be greater than to");
++ }
++ for (int i = from, j = to - 1; i < j; i++, j--) {
++ swap(i, j);
++ }
++ }
++
++ /**
++ * Shuffle the elements of the list using the specified random
++ * number generator.
++ *
++ * @param rand a <code>Random</code> value
++ */
++ public void shuffle(Random rand) {
++ for (int i = _pos; i-- > 1;) {
++ swap(i, rand.nextInt(i));
++ }
++ }
++
++ /**
++ * Swap the values at offsets <tt>i</tt> and <tt>j</tt>.
++ *
++ * @param i an offset into the data array
++ * @param j an offset into the data array
++ */
++ private final void swap(int i, int j) {
++ short tmp = _data[i];
++ _data[i] = _data[j];
++ _data[j] = tmp;
++ }
++
++ // copying
++
++ /**
++ * Returns a clone of this list. Since this is a primitive
++ * collection, this will be a deep clone.
++ *
++ * @return a deep clone of the list.
++ */
++ public Object clone() {
++ TShortArrayList list = null;
++ try {
++ list = (TShortArrayList) super.clone();
++ list._data = toNativeArray();
++ } catch (CloneNotSupportedException e) {
++ // it's supported
++ } // end of try-catch
++ return list;
++ }
++
++ /**
++ * Copies the contents of the list into a native array.
++ *
++ * @return an <code>short[]</code> value
++ */
++ public short[] toNativeArray() {
++ return toNativeArray(0, _pos);
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param offset the offset at which to start copying
++ * @param len the number of values to copy.
++ * @return an <code>short[]</code> value
++ */
++ public short[] toNativeArray(int offset, int len) {
++ short[] rv = new short[len];
++ toNativeArray(rv, offset, len);
++ return rv;
++ }
++
++ /**
++ * Copies a slice of the list into a native array.
++ *
++ * @param dest the array to copy into.
++ * @param offset the offset of the first value to copy
++ * @param len the number of values to copy.
++ */
++ public void toNativeArray(short[] dest, int offset, int len) {
++ if (len == 0) {
++ return; // nothing to copy
++ }
++ if (offset < 0 || offset >= _pos) {
++ throw new ArrayIndexOutOfBoundsException(offset);
++ }
++ System.arraycopy(_data, offset, dest, 0, len);
++ }
++
++ // comparing
++
++ /**
++ * Compares this list to another list, value by value.
++ *
++ * @param other the object to compare against
++ * @return true if other is a TShortArrayList and has exactly the
++ * same values.
++ */
++ public boolean equals(Object other) {
++ if (other == this) {
++ return true;
++ } else if (other instanceof TShortArrayList) {
++ TShortArrayList that = (TShortArrayList)other;
++ if (that.size() != this.size()) {
++ return false;
++ } else {
++ for (int i = _pos; i-- > 0;) {
++ if (this._data[i] != that._data[i]) {
++ return false;
++ }
++ }
++ return true;
++ }
++ } else {
++ return false;
++ }
++ }
++
++ public int hashCode() {
++ int h = 0;
++ for (int i = _pos; i-- > 0;) {
++ h += HashFunctions.hash(_data[i]);
++ }
++ return h;
++ }
++
++ // procedures
++
++ /**
++ * Applies the procedure to each value in the list in ascending
++ * (front to back) order.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEach(TShortProcedure procedure) {
++ for (int i = 0; i < _pos; i++) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Applies the procedure to each value in the list in descending
++ * (back to front) order.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return true if the procedure did not terminate prematurely.
++ */
++ public boolean forEachDescending(TShortProcedure procedure) {
++ for (int i = _pos; i-- > 0;) {
++ if (! procedure.execute(_data[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ // sorting
++
++ /**
++ * Sort the values in the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @see java.util.Arrays#sort
++ */
++ public void sort() {
++ Arrays.sort(_data, 0, _pos);
++ }
++
++ /**
++ * Sort a slice of the list (ascending) using the Sun quicksort
++ * implementation.
++ *
++ * @param fromIndex the index at which to start sorting (inclusive)
++ * @param toIndex the index at which to stop sorting (exclusive)
++ * @see java.util.Arrays#sort
++ */
++ public void sort(int fromIndex, int toIndex) {
++ Arrays.sort(_data, fromIndex, toIndex);
++ }
++
++ // filling
++
++ /**
++ * Fills every slot in the list with the specified value.
++ *
++ * @param val the value to use when filling
++ */
++ public void fill(short val) {
++ Arrays.fill(_data, 0, _pos, val);
++ }
++
++ /**
++ * Fills a range in the list with the specified value.
++ *
++ * @param fromIndex the offset at which to start filling (inclusive)
++ * @param toIndex the offset at which to stop filling (exclusive)
++ * @param val the value to use when filling
++ */
++ public void fill(int fromIndex, int toIndex, short val) {
++ if (toIndex > _pos) {
++ ensureCapacity(toIndex);
++ _pos = toIndex;
++ }
++ Arrays.fill(_data, fromIndex, toIndex, val);
++ }
++
++ // searching
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the entire list.
++ * Note that you <b>must</b> @{link #sort sort} the list before
++ * doing a search.
++ *
++ * @param value the value to search for
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(short value) {
++ return binarySearch(value, 0, _pos);
++ }
++
++ /**
++ * Performs a binary search for <tt>value</tt> in the specified
++ * range. Note that you <b>must</b> @{link #sort sort} the list
++ * or the range before doing a search.
++ *
++ * @param value the value to search for
++ * @param fromIndex the lower boundary of the range (inclusive)
++ * @param toIndex the upper boundary of the range (exclusive)
++ * @return the absolute offset in the list of the value, or its
++ * negative insertion point into the sorted list.
++ */
++ public int binarySearch(short value, int fromIndex, int toIndex) {
++ if (fromIndex < 0) {
++ throw new ArrayIndexOutOfBoundsException(fromIndex);
++ }
++ if (toIndex > _pos) {
++ throw new ArrayIndexOutOfBoundsException(toIndex);
++ }
++
++ int low = fromIndex;
++ int high = toIndex - 1;
++
++ while (low <= high) {
++ int mid = (low + high) >> 1;
++ short midVal = _data[mid];
++
++ if (midVal < value) {
++ low = mid + 1;
++ } else if (midVal > value) {
++ high = mid - 1;
++ } else {
++ return mid; // value found
++ }
++ }
++ return -(low + 1); // value not found.
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>short</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(short value) {
++ return indexOf(0, value);
++ }
++
++ /**
++ * Searches the list front to back for the index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (inclusive)
++ * @param value an <code>short</code> value
++ * @return the first offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int indexOf(int offset, short value) {
++ for (int i = offset; i < _pos; i++) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>.
++ *
++ * @param value an <code>short</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(short value) {
++ return lastIndexOf(_pos, value);
++ }
++
++ /**
++ * Searches the list back to front for the last index of
++ * <tt>value</tt>, starting at <tt>offset</tt>.
++ *
++ * @param offset the offset at which to start the linear search
++ * (exclusive)
++ * @param value an <code>short</code> value
++ * @return the last offset of the value, or -1 if it is not in
++ * the list.
++ * @see #binarySearch for faster searches on sorted lists
++ */
++ public int lastIndexOf(int offset, short value) {
++ for (int i = offset; i-- > 0;) {
++ if (_data[i] == value) {
++ return i;
++ }
++ }
++ return -1;
++ }
++
++ /**
++ * Searches the list for <tt>value</tt>
++ *
++ * @param value an <code>short</code> value
++ * @return true if value is in the list.
++ */
++ public boolean contains(short value) {
++ return lastIndexOf(value) >= 0;
++ }
++
++ /**
++ * Searches the list for values satisfying <tt>condition</tt> in
++ * the manner of the *nix <tt>grep</tt> utility.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which match the condition.
++ */
++ public TShortArrayList grep(TShortProcedure condition) {
++ TShortArrayList list = new TShortArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Searches the list for values which do <b>not</b> satisfy
++ * <tt>condition</tt>. This is akin to *nix <code>grep -v</code>.
++ *
++ * @param condition a condition to apply to each element in the list
++ * @return a list of values which do not match the condition.
++ */
++ public TShortArrayList inverseGrep(TShortProcedure condition) {
++ TShortArrayList list = new TShortArrayList();
++ for (int i = 0; i < _pos; i++) {
++ if (! condition.execute(_data[i])) {
++ list.add(_data[i]);
++ }
++ }
++ return list;
++ }
++
++ /**
++ * Finds the maximum value in the list.
++ *
++ * @return the largest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public short max() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find maximum of an empty list");
++ }
++ short max = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > max ) {
++ max = _data[_pos];
++ }
++ }
++ return max;
++ }
++
++ /**
++ * Finds the minimum value in the list.
++ *
++ * @return the smallest value in the list.
++ * @exception IllegalStateException if the list is empty
++ */
++ public short min() {
++ if (size() == 0) {
++ throw new IllegalStateException("cannot find minimum of an empty list");
++ }
++ short min = _data[_pos - 1];
++ for (int i = _pos - 1; i-- > 0;) {
++ if ( _data[_pos] > min ) {
++ min = _data[_pos];
++ }
++ }
++ return min;
++ }
++
++ // stringification
++
++ /**
++ * Returns a String representation of the list, front to back.
++ *
++ * @return a <code>String</code> value
++ */
++ public String toString() {
++ final StringBuffer buf = new StringBuffer("{");
++ for (int i = 0, end = _pos - 1; i < end; i++) {
++ buf.append(_data[i]);
++ buf.append(", ");
++ }
++ if (size() > 0) {
++ buf.append(_data[_pos - 1]);
++ }
++ buf.append("}");
++ return buf.toString();
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // POSITION
++ out.writeInt( _pos );
++
++ // ENTRIES
++ int len = _data.length;
++ out.writeInt( len );
++ for( int i = 0; i < len; i++ ) {
++ out.writeShort( _data[ i ] );
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // POSITION
++ _pos = in.readInt();
++
++ // ENTRIES
++ int len = in.readInt();
++ _data = new short[ len ];
++ for( int i = 0; i < len; i++ ) {
++ _data[ i ] = in.readShort();
++ }
++ }
++} // TShortArrayList
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortByteHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for short keys and byte values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TShortByteHashMap extends TShortHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient byte[] _values;
++
++ /**
++ * Creates a new <code>TShortByteHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TShortByteHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TShortByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TShortByteHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TShortByteHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TShortByteHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TShortByteHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortByteHashMap(TShortHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortByteHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortByteHashMap(int initialCapacity, TShortHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortByteHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortByteHashMap(int initialCapacity, float loadFactor, TShortHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TShortByteHashMap m = (TShortByteHashMap)super.clone();
++ m._values = (byte[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TShortByteIterator with access to this map's keys and values
++ */
++ public TShortByteIterator iterator() {
++ return new TShortByteIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new byte[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>short</code> value
++ * @param value an <code>byte</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (short)0 if none was found.
++ */
++ public byte put(short key, byte value) {
++ byte previousState;
++ byte previous = (byte)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ short oldKeys[] = _set;
++ byte oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new short[newCapacity];
++ _values = new byte[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ short o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>short</code> value
++ * @return the value of <tt>key</tt> or (short)0 if no such mapping exists.
++ */
++ public byte get(short key) {
++ int index = index(key);
++ return index < 0 ? (byte)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ short[] keys = _set;
++ byte[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (short)0;
++ vals[i] = (byte)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>short</code> value
++ * @return an <code>byte</code> value, or (short)0 if no mapping for key exists
++ */
++ public byte remove(short key) {
++ byte prev = (byte)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TShortByteHashMap)) {
++ return false;
++ }
++ TShortByteHashMap that = (TShortByteHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TShortByteProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(short key, byte value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TShortByteProcedure {
++ private final TShortByteHashMap _otherMap;
++
++ EqProcedure(TShortByteHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(short key, byte value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two bytes for equality.
++ */
++ private final boolean eq(byte v1, byte v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (byte)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public byte[] getValues() {
++ byte[] vals = new byte[size()];
++ byte[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public short[] keys() {
++ short[] keys = new short[size()];
++ short[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>byte</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(byte val) {
++ byte[] states = _states;
++ byte[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(short key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TShortProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TByteProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TByteProcedure procedure) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOShortByteProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TShortByteProcedure procedure) {
++ byte[] states = _states;
++ short[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TShortByteProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ short[] keys = _set;
++ byte[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TByteFunction</code> value
++ */
++ public void transformValues(TByteFunction function) {
++ byte[] states = _states;
++ byte[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(short key) {
++ return adjustValue(key, (byte)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(short key, byte amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ short key = in.readShort();
++ byte val = in.readByte();
++ put(key, val);
++ }
++ }
++} // TShortByteHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortByteIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type short and byte.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TShortByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TShortByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TShortByteIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TShortByteIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TShortByteIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TShortByteHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TShortByteIterator(TShortByteHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public short key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public byte value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public byte setValue(byte val) {
++ byte old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TShortByteIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortByteProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type short and byte.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortByteProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>short</code> value
++ * @param b a <code>byte</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(short a, byte b);
++}// TShortByteProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortDoubleHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for short keys and double values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TShortDoubleHashMap extends TShortHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient double[] _values;
++
++ /**
++ * Creates a new <code>TShortDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TShortDoubleHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TShortDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TShortDoubleHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TShortDoubleHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TShortDoubleHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TShortDoubleHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortDoubleHashMap(TShortHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortDoubleHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortDoubleHashMap(int initialCapacity, TShortHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortDoubleHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortDoubleHashMap(int initialCapacity, float loadFactor, TShortHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TShortDoubleHashMap m = (TShortDoubleHashMap)super.clone();
++ m._values = (double[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TShortDoubleIterator with access to this map's keys and values
++ */
++ public TShortDoubleIterator iterator() {
++ return new TShortDoubleIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new double[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>short</code> value
++ * @param value an <code>double</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (short)0 if none was found.
++ */
++ public double put(short key, double value) {
++ byte previousState;
++ double previous = (double)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ short oldKeys[] = _set;
++ double oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new short[newCapacity];
++ _values = new double[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ short o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>short</code> value
++ * @return the value of <tt>key</tt> or (short)0 if no such mapping exists.
++ */
++ public double get(short key) {
++ int index = index(key);
++ return index < 0 ? (double)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ short[] keys = _set;
++ double[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (short)0;
++ vals[i] = (double)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>short</code> value
++ * @return an <code>double</code> value, or (short)0 if no mapping for key exists
++ */
++ public double remove(short key) {
++ double prev = (double)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TShortDoubleHashMap)) {
++ return false;
++ }
++ TShortDoubleHashMap that = (TShortDoubleHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TShortDoubleProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(short key, double value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TShortDoubleProcedure {
++ private final TShortDoubleHashMap _otherMap;
++
++ EqProcedure(TShortDoubleHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(short key, double value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two doubles for equality.
++ */
++ private final boolean eq(double v1, double v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (double)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public double[] getValues() {
++ double[] vals = new double[size()];
++ double[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public short[] keys() {
++ short[] keys = new short[size()];
++ short[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>double</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(double val) {
++ byte[] states = _states;
++ double[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(short key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TShortProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TDoubleProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TDoubleProcedure procedure) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOShortDoubleProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TShortDoubleProcedure procedure) {
++ byte[] states = _states;
++ short[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TShortDoubleProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ short[] keys = _set;
++ double[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TDoubleFunction</code> value
++ */
++ public void transformValues(TDoubleFunction function) {
++ byte[] states = _states;
++ double[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(short key) {
++ return adjustValue(key, (double)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(short key, double amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ short key = in.readShort();
++ double val = in.readDouble();
++ put(key, val);
++ }
++ }
++} // TShortDoubleHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortDoubleIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type short and double.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TShortDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TShortDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TShortDoubleIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TShortDoubleIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TShortDoubleIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TShortDoubleHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TShortDoubleIterator(TShortDoubleHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public short key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public double value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public double setValue(double val) {
++ double old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TShortDoubleIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortDoubleProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type short and double.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortDoubleProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>short</code> value
++ * @param b a <code>double</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(short a, double b);
++}// TShortDoubleProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortFloatHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for short keys and float values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TShortFloatHashMap extends TShortHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient float[] _values;
++
++ /**
++ * Creates a new <code>TShortFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TShortFloatHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TShortFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TShortFloatHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TShortFloatHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TShortFloatHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TShortFloatHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortFloatHashMap(TShortHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortFloatHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortFloatHashMap(int initialCapacity, TShortHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortFloatHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortFloatHashMap(int initialCapacity, float loadFactor, TShortHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TShortFloatHashMap m = (TShortFloatHashMap)super.clone();
++ m._values = (float[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TShortFloatIterator with access to this map's keys and values
++ */
++ public TShortFloatIterator iterator() {
++ return new TShortFloatIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new float[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>short</code> value
++ * @param value an <code>float</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (short)0 if none was found.
++ */
++ public float put(short key, float value) {
++ byte previousState;
++ float previous = (float)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ short oldKeys[] = _set;
++ float oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new short[newCapacity];
++ _values = new float[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ short o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>short</code> value
++ * @return the value of <tt>key</tt> or (short)0 if no such mapping exists.
++ */
++ public float get(short key) {
++ int index = index(key);
++ return index < 0 ? (float)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ short[] keys = _set;
++ float[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (short)0;
++ vals[i] = (float)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>short</code> value
++ * @return an <code>float</code> value, or (short)0 if no mapping for key exists
++ */
++ public float remove(short key) {
++ float prev = (float)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TShortFloatHashMap)) {
++ return false;
++ }
++ TShortFloatHashMap that = (TShortFloatHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TShortFloatProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(short key, float value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TShortFloatProcedure {
++ private final TShortFloatHashMap _otherMap;
++
++ EqProcedure(TShortFloatHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(short key, float value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two floats for equality.
++ */
++ private final boolean eq(float v1, float v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (float)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public float[] getValues() {
++ float[] vals = new float[size()];
++ float[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public short[] keys() {
++ short[] keys = new short[size()];
++ short[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>float</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(float val) {
++ byte[] states = _states;
++ float[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(short key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TShortProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TFloatProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TFloatProcedure procedure) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOShortFloatProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TShortFloatProcedure procedure) {
++ byte[] states = _states;
++ short[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TShortFloatProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ short[] keys = _set;
++ float[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TFloatFunction</code> value
++ */
++ public void transformValues(TFloatFunction function) {
++ byte[] states = _states;
++ float[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(short key) {
++ return adjustValue(key, (float)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(short key, float amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ short key = in.readShort();
++ float val = in.readFloat();
++ put(key, val);
++ }
++ }
++} // TShortFloatHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortFloatIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type short and float.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TShortFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TShortFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TShortFloatIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TShortFloatIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TShortFloatIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TShortFloatHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TShortFloatIterator(TShortFloatHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public short key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public float value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public float setValue(float val) {
++ float old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TShortFloatIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortFloatProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type short and float.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortFloatProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>short</code> value
++ * @param b a <code>float</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(short a, float b);
++}// TShortFloatProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortFunction.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,43 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for functions that accept and return one short primitive.
++ *
++ * Created: Mon Nov 5 22:19:36 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PFunction.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortFunction {
++ /**
++ * Execute this function with <tt>value</tt>
++ *
++ * @param value a <code>short</code> input
++ * @return a <code>short</code> result
++ */
++ public short execute(short value);
++}// TShortFunction
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortHash.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,289 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed hashing implementation for short primitives.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHash.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++abstract public class TShortHash extends TPrimitiveHash implements TShortHashingStrategy {
++
++ /** the set of shorts */
++ protected transient short[] _set;
++
++ /** strategy used to hash values in this collection */
++ protected TShortHashingStrategy _hashingStrategy;
++
++ /**
++ * Creates a new <code>TShortHash</code> instance with the default
++ * capacity and load factor.
++ */
++ public TShortHash() {
++ super();
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TShortHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TShortHash(int initialCapacity) {
++ super(initialCapacity);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TShortHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ */
++ public TShortHash(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = this;
++ }
++
++ /**
++ * Creates a new <code>TShortHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortHash(TShortHashingStrategy strategy) {
++ super();
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TShortHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortHash(int initialCapacity, TShortHashingStrategy strategy) {
++ super(initialCapacity);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * Creates a new <code>TShortHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortHash(int initialCapacity, float loadFactor, TShortHashingStrategy strategy) {
++ super(initialCapacity, loadFactor);
++ this._hashingStrategy = strategy;
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TShortHash h = (TShortHash)super.clone();
++ h._set = (short[])this._set.clone();
++ return h;
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _set = new short[capacity];
++ return capacity;
++ }
++
++ /**
++ * Searches the set for <tt>val</tt>
++ *
++ * @param val an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean contains(short val) {
++ return index(val) >= 0;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each element in the set.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the set terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEach(TShortProcedure procedure) {
++ byte[] states = _states;
++ short[] set = _set;
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(set[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Releases the element currently stored at <tt>index</tt>.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _set[index] = (short)0;
++ super.removeAt(index);
++ }
++
++ /**
++ * Locates the index of <tt>val</tt>.
++ *
++ * @param val an <code>short</code> value
++ * @return the index of <tt>val</tt> or -1 if it isn't in the set.
++ */
++ protected int index(short val) {
++ int hash, probe, index, length;
++ short[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ // see Knuth, p. 529
++ probe = 1 + (hash % (length - 2));
++
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val));
++ }
++
++ return states[index] == FREE ? -1 : index;
++ }
++
++ /**
++ * Locates the index at which <tt>val</tt> can be inserted. if
++ * there is already a value equal()ing <tt>val</tt> in the set,
++ * returns that value as a negative integer.
++ *
++ * @param val an <code>short</code> value
++ * @return an <code>int</code> value
++ */
++ protected int insertionIndex(short val) {
++ int hash, probe, index, length;
++ short[] set;
++ byte[] states;
++
++ states = _states;
++ set = _set;
++ length = states.length;
++ hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff;
++ index = hash % length;
++
++ if (states[index] == FREE) {
++ return index; // empty, all done
++ } else if (states[index] == FULL && set[index] == val) {
++ return -index -1; // already stored
++ } else { // already FULL or REMOVED, must probe
++ // compute the double hash
++ probe = 1 + (hash % (length - 2));
++
++ // if the slot we landed on is FULL (but not removed), probe
++ // until we find an empty slot, a REMOVED slot, or an element
++ // equal to the one we are trying to insert.
++ // finding an empty slot means that the value is not present
++ // and that we should use that slot as the insertion point;
++ // finding a REMOVED slot means that we need to keep searching,
++ // however we want to remember the offset of that REMOVED slot
++ // so we can reuse it in case a "new" insertion (i.e. not an update)
++ // is possible.
++ // finding a matching value means that we've found that our desired
++ // key is already in the table
++
++ if (states[index] != REMOVED) {
++ // starting at the natural offset, probe until we find an
++ // offset that isn't full.
++ do {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ } while (states[index] == FULL && set[index] != val);
++ }
++
++ // if the index we found was removed: continue probing until we
++ // locate a free location or an element which equal()s the
++ // one we have.
++ if (states[index] == REMOVED) {
++ int firstRemoved = index;
++ while (states[index] != FREE &&
++ (states[index] == REMOVED || set[index] != val)) {
++ index -= probe;
++ if (index < 0) {
++ index += length;
++ }
++ }
++ return states[index] == FULL ? -index -1 : firstRemoved;
++ }
++ // if it's full, the key is already stored
++ return states[index] == FULL ? -index -1 : index;
++ }
++ }
++
++ /**
++ * Default implementation of TShortHashingStrategy:
++ * delegates hashing to HashFunctions.hash(short).
++ *
++ * @param val the value to hash
++ * @return the hashcode.
++ */
++ public final int computeHashCode(short val) {
++ return HashFunctions.hash(val);
++ }
++} // TShortHash
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortHashingStrategy.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,49 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.Serializable;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface to support pluggable hashing strategies in maps and sets.
++ * Implementors can use this interface to make the trove hashing
++ * algorithms use an optimal strategy when computing hashcodes.
++ *
++ * Created: Sun Nov 4 08:56:06 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PHashingStrategy.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortHashingStrategy extends Serializable {
++ /**
++ * Computes a hash code for the specified short. Implementors
++ * can use the short's own value or a custom scheme designed to
++ * minimize collisions for a known set of input.
++ *
++ * @param val short for which the hashcode is to be computed
++ * @return the hashCode
++ */
++ public int computeHashCode(short val);
++} // TShortHashingStrategy
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortHashSet.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,371 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++import java.util.Arrays;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed set implementation for short primitives.
++ *
++ * @author Eric D. Friedman
++ * @author Rob Eden
++ */
++
++public class TShortHashSet extends TShortHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /**
++ * Creates a new <code>TShortHashSet</code> instance with the default
++ * capacity and load factor.
++ */
++ public TShortHashSet() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TShortHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TShortHashSet(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TShortHashSet</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TShortHashSet(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TShortHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>short</code> primitives
++ */
++ public TShortHashSet(short[] array) {
++ this(array.length);
++ addAll(array);
++ }
++
++ /**
++ * Creates a new <code>TShortHash</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortHashSet(TShortHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortHash</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortHashSet(int initialCapacity, TShortHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortHash</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortHashSet(int initialCapacity, float loadFactor, TShortHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortHashSet</code> instance containing the
++ * elements of <tt>array</tt>.
++ *
++ * @param array an array of <code>short</code> primitives
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortHashSet(short[] array, TShortHashingStrategy strategy) {
++ this(array.length, strategy);
++ addAll(array);
++ }
++
++ /**
++ * @return a TShortIterator with access to the values in this set
++ */
++ public TShortIterator iterator() {
++ return new TShortIterator(this);
++ }
++
++ /**
++ * Inserts a value into the set.
++ *
++ * @param val an <code>short</code> value
++ * @return true if the set was modified by the add operation
++ */
++ public boolean add(short val) {
++ int index = insertionIndex(val);
++
++ if (index < 0) {
++ return false; // already present in set, nothing to add
++ }
++
++ byte previousState = _states[index];
++ _set[index] = val;
++ _states[index] = FULL;
++ postInsertHook(previousState == FREE);
++
++ return true; // yes, we added something
++ }
++
++ /**
++ * Expands the set to accomodate new values.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ short oldSet[] = _set;
++ byte oldStates[] = _states;
++
++ _set = new short[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ short o = oldSet[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * Returns a new array containing the values in the set.
++ *
++ * @return an <code>short[]</code> value
++ */
++ public short[] toArray() {
++ short[] result = new short[size()];
++ short[] set = _set;
++ byte[] states = _states;
++
++ for (int i = states.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ result[j++] = set[i];
++ }
++ }
++ return result;
++ }
++
++ /**
++ * Empties the set.
++ */
++ public void clear() {
++ super.clear();
++ short[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ set[i] = (short)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Compares this set with another set for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TShortHashSet)) {
++ return false;
++ }
++ final TShortHashSet that = (TShortHashSet)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEach(new TShortProcedure() {
++ public final boolean execute(short value) {
++ return that.contains(value);
++ }
++ });
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEach(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TShortProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(short key) {
++ h += _hashingStrategy.computeHashCode(key);
++ return true;
++ }
++ }
++
++ /**
++ * Removes <tt>val</tt> from the set.
++ *
++ * @param val an <code>short</code> value
++ * @return true if the set was modified by the remove operation.
++ */
++ public boolean remove(short val) {
++ int index = index(val);
++ if (index >= 0) {
++ removeAt(index);
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Tests the set to determine if all of the elements in
++ * <tt>array</tt> are present.
++ *
++ * @param array an <code>array</code> of short primitives.
++ * @return true if all elements were present in the set.
++ */
++ public boolean containsAll(short[] array) {
++ for (int i = array.length; i-- > 0;) {
++ if (! contains(array[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Adds all of the elements in <tt>array</tt> to the set.
++ *
++ * @param array an <code>array</code> of short primitives.
++ * @return true if the set was modified by the add all operation.
++ */
++ public boolean addAll(short[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (add(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes all of the elements in <tt>array</tt> from the set.
++ *
++ * @param array an <code>array</code> of short primitives.
++ * @return true if the set was modified by the remove all operation.
++ */
++ public boolean removeAll(short[] array) {
++ boolean changed = false;
++ for (int i = array.length; i-- > 0;) {
++ if (remove(array[i])) {
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++ /**
++ * Removes any values in the set which are not contained in
++ * <tt>array</tt>.
++ *
++ * @param array an <code>array</code> of short primitives.
++ * @return true if the set was modified by the retain all operation
++ */
++ public boolean retainAll(short[] array) {
++ boolean changed = false;
++ Arrays.sort(array);
++ short[] set = _set;
++ byte[] states = _states;
++
++ for (int i = set.length; i-- > 0;) {
++ if (states[i] == FULL && (Arrays.binarySearch(array,set[i]) < 0)) {
++ remove(set[i]);
++ changed = true;
++ }
++ }
++ return changed;
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure(out);
++ if (! forEach(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++
++ // ENTRIES
++ setUp(size);
++ while (size-- > 0) {
++ short val = in.readShort();
++ add(val);
++ }
++ }
++} // TShortHashSet
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortIntHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for short keys and int values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TShortIntHashMap extends TShortHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient int[] _values;
++
++ /**
++ * Creates a new <code>TShortIntHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TShortIntHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TShortIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TShortIntHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TShortIntHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TShortIntHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TShortIntHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortIntHashMap(TShortHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortIntHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortIntHashMap(int initialCapacity, TShortHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortIntHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortIntHashMap(int initialCapacity, float loadFactor, TShortHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TShortIntHashMap m = (TShortIntHashMap)super.clone();
++ m._values = (int[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TShortIntIterator with access to this map's keys and values
++ */
++ public TShortIntIterator iterator() {
++ return new TShortIntIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new int[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>short</code> value
++ * @param value an <code>int</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (short)0 if none was found.
++ */
++ public int put(short key, int value) {
++ byte previousState;
++ int previous = (int)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ short oldKeys[] = _set;
++ int oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new short[newCapacity];
++ _values = new int[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ short o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>short</code> value
++ * @return the value of <tt>key</tt> or (short)0 if no such mapping exists.
++ */
++ public int get(short key) {
++ int index = index(key);
++ return index < 0 ? (int)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ short[] keys = _set;
++ int[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (short)0;
++ vals[i] = (int)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>short</code> value
++ * @return an <code>int</code> value, or (short)0 if no mapping for key exists
++ */
++ public int remove(short key) {
++ int prev = (int)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TShortIntHashMap)) {
++ return false;
++ }
++ TShortIntHashMap that = (TShortIntHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TShortIntProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(short key, int value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TShortIntProcedure {
++ private final TShortIntHashMap _otherMap;
++
++ EqProcedure(TShortIntHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(short key, int value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two ints for equality.
++ */
++ private final boolean eq(int v1, int v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (int)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public int[] getValues() {
++ int[] vals = new int[size()];
++ int[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public short[] keys() {
++ short[] keys = new short[size()];
++ short[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>int</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(int val) {
++ byte[] states = _states;
++ int[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(short key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TShortProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TIntProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TIntProcedure procedure) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOShortIntProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TShortIntProcedure procedure) {
++ byte[] states = _states;
++ short[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TShortIntProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ short[] keys = _set;
++ int[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TIntFunction</code> value
++ */
++ public void transformValues(TIntFunction function) {
++ byte[] states = _states;
++ int[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(short key) {
++ return adjustValue(key, (int)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(short key, int amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ short key = in.readShort();
++ int val = in.readInt();
++ put(key, val);
++ }
++ }
++} // TShortIntHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortIntIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type short and int.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TShortIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TShortIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TShortIntIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TShortIntIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TShortIntIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TShortIntHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TShortIntIterator(TShortIntHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public short key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public int value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public int setValue(int val) {
++ int old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TShortIntIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortIntProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type short and int.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortIntProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>short</code> value
++ * @param b a <code>int</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(short a, int b);
++}// TShortIntProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,56 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for short collections.
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TShortIterator extends TPrimitiveIterator {
++ /** the collection on which the iterator operates */
++ private final TShortHash _hash;
++
++ /**
++ * Creates a TShortIterator for the elements in the specified collection.
++ */
++ public TShortIterator(TShortHash hash) {
++ super(hash);
++ this._hash = hash;
++ }
++
++ /**
++ * Advances the iterator to the next element in the underlying collection
++ * and returns it.
++ *
++ * @return the next short in the collection
++ * @exception NoSuchElementException if the iterator is already exhausted
++ */
++ public short next() {
++ moveToNextIndex();
++ return _hash._set[_index];
++ }
++}// TShortIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortLongHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for short keys and long values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TShortLongHashMap extends TShortHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient long[] _values;
++
++ /**
++ * Creates a new <code>TShortLongHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TShortLongHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TShortLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TShortLongHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TShortLongHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TShortLongHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TShortLongHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortLongHashMap(TShortHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortLongHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortLongHashMap(int initialCapacity, TShortHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortLongHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortLongHashMap(int initialCapacity, float loadFactor, TShortHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TShortLongHashMap m = (TShortLongHashMap)super.clone();
++ m._values = (long[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TShortLongIterator with access to this map's keys and values
++ */
++ public TShortLongIterator iterator() {
++ return new TShortLongIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new long[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>short</code> value
++ * @param value an <code>long</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (short)0 if none was found.
++ */
++ public long put(short key, long value) {
++ byte previousState;
++ long previous = (long)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ short oldKeys[] = _set;
++ long oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new short[newCapacity];
++ _values = new long[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ short o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>short</code> value
++ * @return the value of <tt>key</tt> or (short)0 if no such mapping exists.
++ */
++ public long get(short key) {
++ int index = index(key);
++ return index < 0 ? (long)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ short[] keys = _set;
++ long[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (short)0;
++ vals[i] = (long)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>short</code> value
++ * @return an <code>long</code> value, or (short)0 if no mapping for key exists
++ */
++ public long remove(short key) {
++ long prev = (long)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TShortLongHashMap)) {
++ return false;
++ }
++ TShortLongHashMap that = (TShortLongHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TShortLongProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(short key, long value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TShortLongProcedure {
++ private final TShortLongHashMap _otherMap;
++
++ EqProcedure(TShortLongHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(short key, long value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two longs for equality.
++ */
++ private final boolean eq(long v1, long v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (long)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public long[] getValues() {
++ long[] vals = new long[size()];
++ long[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public short[] keys() {
++ short[] keys = new short[size()];
++ short[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>long</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(long val) {
++ byte[] states = _states;
++ long[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(short key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TShortProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TLongProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TLongProcedure procedure) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOShortLongProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TShortLongProcedure procedure) {
++ byte[] states = _states;
++ short[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TShortLongProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ short[] keys = _set;
++ long[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TLongFunction</code> value
++ */
++ public void transformValues(TLongFunction function) {
++ byte[] states = _states;
++ long[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(short key) {
++ return adjustValue(key, (long)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(short key, long amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ short key = in.readShort();
++ long val = in.readLong();
++ put(key, val);
++ }
++ }
++} // TShortLongHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortLongIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type short and long.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TShortLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TShortLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TShortLongIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TShortLongIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TShortLongIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TShortLongHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TShortLongIterator(TShortLongHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public short key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public long value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public long setValue(long val) {
++ long old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TShortLongIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortLongProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type short and long.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortLongProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>short</code> value
++ * @param b a <code>long</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(short a, long b);
++}// TShortLongProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortObjectHashMap.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,507 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for short keys and Object values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TShortObjectHashMap<V> extends TShortHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient V[] _values;
++
++ /**
++ * Creates a new <code>TShortObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TShortObjectHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TShortObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TShortObjectHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TShortObjectHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TShortObjectHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TShortObjectHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortObjectHashMap(TShortHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortObjectHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortObjectHashMap(int initialCapacity, TShortHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortObjectHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortObjectHashMap(int initialCapacity, float loadFactor, TShortHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public TShortObjectHashMap<V> clone() {
++ TShortObjectHashMap<V> m = (TShortObjectHashMap<V>)super.clone();
++ m._values = (V[]) this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TShortObjectIterator with access to this map's keys and values
++ */
++ public TShortObjectIterator<V> iterator() {
++ return new TShortObjectIterator<V>(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = (V[]) new Object[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>short</code> value
++ * @param value an <code>Object</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (short)0 if none was found.
++ */
++ public V put(short key, V value) {
++ byte previousState;
++ V previous = null;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ short oldKeys[] = _set;
++ V oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new short[newCapacity];
++ _values = (V[]) new Object[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ short o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>short</code> value
++ * @return the value of <tt>key</tt> or (short)0 if no such mapping exists.
++ */
++ public V get(short key) {
++ int index = index(key);
++ return index < 0 ? null : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ short[] keys = _set;
++ Object[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (short)0;
++ vals[i] = null;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>short</code> value
++ * @return an <code>Object</code> value or (short)0 if no such mapping exists.
++ */
++ public V remove(short key) {
++ V prev = null;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TShortObjectHashMap)) {
++ return false;
++ }
++ TShortObjectHashMap that = (TShortObjectHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TShortObjectProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(short key, Object value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TShortObjectProcedure {
++ private final TShortObjectHashMap _otherMap;
++
++ EqProcedure(TShortObjectHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(short key, Object value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two objects for equality.
++ */
++ private final boolean eq(Object o1, Object o2) {
++ return o1 == o2 || ((o1 != null) && o1.equals(o2));
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = null;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public Object[] getValues() {
++ Object[] vals = new Object[size()];
++ V[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public short[] keys() {
++ short[] keys = new short[size()];
++ short[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(V val) {
++ byte[] states = _states;
++ V[] vals = _values;
++
++ // special case null values so that we don't have to
++ // perform null checks before every call to equals()
++ if (null == val) {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ val == vals[i]) {
++ return true;
++ }
++ }
++ } else {
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL &&
++ (val == vals[i] || val.equals(vals[i]))) {
++ return true;
++ }
++ }
++ } // end of else
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(short key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TShortProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TObjectProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOShortObjectProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TShortObjectProcedure<V> procedure) {
++ byte[] states = _states;
++ short[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TShortObjectProcedure<V> procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ short[] keys = _set;
++ V[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TObjectFunction</code> value
++ */
++ public void transformValues(TObjectFunction<V,V> function) {
++ byte[] states = _states;
++ V[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ short key = in.readShort();
++ V val = (V) in.readObject();
++ put(key, val);
++ }
++ }
++} // TShortObjectHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortObjectIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,151 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type short and Object.
++ * <p/>
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ * <p/>
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ * <p/>
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ * <p/>
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ * <p/>
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TShortObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TShortObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TShortObjectIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ * <p/>
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TShortObjectIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TShortObjectIterator<V> extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TShortObjectHashMap<V> _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TShortObjectIterator(TShortObjectHashMap<V> map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException
++ * if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public short key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public V value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public V setValue(V val) {
++ V old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TShortObjectIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortObjectProcedure.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type short and Object.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2OProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortObjectProcedure<T> {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>short</code> value
++ * @param b an <code>Object</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(short a, T b);
++}// TShortObjectProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,46 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures with one short paramater.
++ *
++ * Created: Mon Nov 5 21:45:49 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortProcedure {
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param value a value of type <code>short</code>
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(short value);
++}// TShortProcedure
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortShortHashMap.java 2007-04-18 06:49:38.000000000 +0000
+@@ -0,0 +1,520 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.io.Externalizable;
++
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * An open addressed Map implementation for short keys and short values.
++ *
++ * Created: Sun Nov 4 08:52:45 2001
++ *
++ * @author Eric D. Friedman
++ */
++public class TShortShortHashMap extends TShortHash implements Externalizable {
++ static final long serialVersionUID = 1L;
++
++ /** the values of the map */
++ protected transient short[] _values;
++
++ /**
++ * Creates a new <code>TShortShortHashMap</code> instance with the default
++ * capacity and load factor.
++ */
++ public TShortShortHashMap() {
++ super();
++ }
++
++ /**
++ * Creates a new <code>TShortShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the default load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ */
++ public TShortShortHashMap(int initialCapacity) {
++ super(initialCapacity);
++ }
++
++ /**
++ * Creates a new <code>TShortShortHashMap</code> instance with a prime
++ * capacity equal to or greater than <tt>initialCapacity</tt> and
++ * with the specified load factor.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param loadFactor a <code>float</code> value
++ */
++ public TShortShortHashMap(int initialCapacity, float loadFactor) {
++ super(initialCapacity, loadFactor);
++ }
++
++ /**
++ * Creates a new <code>TShortShortHashMap</code> instance with the default
++ * capacity and load factor.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortShortHashMap(TShortHashingStrategy strategy) {
++ super(strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortShortHashMap</code> instance whose capacity
++ * is the next highest prime above <tt>initialCapacity + 1</tt>
++ * unless that value is already prime.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortShortHashMap(int initialCapacity, TShortHashingStrategy strategy) {
++ super(initialCapacity, strategy);
++ }
++
++ /**
++ * Creates a new <code>TShortShortHashMap</code> instance with a prime
++ * value at or near the specified capacity and load factor.
++ *
++ * @param initialCapacity used to find a prime capacity for the table.
++ * @param loadFactor used to calculate the threshold over which
++ * rehashing takes place.
++ * @param strategy used to compute hash codes and to compare keys.
++ */
++ public TShortShortHashMap(int initialCapacity, float loadFactor, TShortHashingStrategy strategy) {
++ super(initialCapacity, loadFactor, strategy);
++ }
++
++ /**
++ * @return a deep clone of this collection
++ */
++ public Object clone() {
++ TShortShortHashMap m = (TShortShortHashMap)super.clone();
++ m._values = (short[])this._values.clone();
++ return m;
++ }
++
++ /**
++ * @return a TShortShortIterator with access to this map's keys and values
++ */
++ public TShortShortIterator iterator() {
++ return new TShortShortIterator(this);
++ }
++
++ /**
++ * initializes the hashtable to a prime capacity which is at least
++ * <tt>initialCapacity + 1</tt>.
++ *
++ * @param initialCapacity an <code>int</code> value
++ * @return the actual capacity chosen
++ */
++ protected int setUp(int initialCapacity) {
++ int capacity;
++
++ capacity = super.setUp(initialCapacity);
++ _values = new short[capacity];
++ return capacity;
++ }
++
++ /**
++ * Inserts a key/value pair into the map.
++ *
++ * @param key an <code>short</code> value
++ * @param value an <code>short</code> value
++ * @return the previous value associated with <tt>key</tt>,
++ * or (short)0 if none was found.
++ */
++ public short put(short key, short value) {
++ byte previousState;
++ short previous = (short)0;
++ int index = insertionIndex(key);
++ boolean isNewMapping = true;
++ if (index < 0) {
++ index = -index -1;
++ previous = _values[index];
++ isNewMapping = false;
++ }
++ previousState = _states[index];
++ _set[index] = key;
++ _states[index] = FULL;
++ _values[index] = value;
++ if (isNewMapping) {
++ postInsertHook(previousState == FREE);
++ }
++
++ return previous;
++ }
++
++ /**
++ * rehashes the map to the new capacity.
++ *
++ * @param newCapacity an <code>int</code> value
++ */
++ protected void rehash(int newCapacity) {
++ int oldCapacity = _set.length;
++ short oldKeys[] = _set;
++ short oldVals[] = _values;
++ byte oldStates[] = _states;
++
++ _set = new short[newCapacity];
++ _values = new short[newCapacity];
++ _states = new byte[newCapacity];
++
++ for (int i = oldCapacity; i-- > 0;) {
++ if(oldStates[i] == FULL) {
++ short o = oldKeys[i];
++ int index = insertionIndex(o);
++ _set[index] = o;
++ _values[index] = oldVals[i];
++ _states[index] = FULL;
++ }
++ }
++ }
++
++ /**
++ * retrieves the value for <tt>key</tt>
++ *
++ * @param key an <code>short</code> value
++ * @return the value of <tt>key</tt> or (short)0 if no such mapping exists.
++ */
++ public short get(short key) {
++ int index = index(key);
++ return index < 0 ? (short)0 : _values[index];
++ }
++
++ /**
++ * Empties the map.
++ *
++ */
++ public void clear() {
++ super.clear();
++ short[] keys = _set;
++ short[] vals = _values;
++ byte[] states = _states;
++
++ for (int i = keys.length; i-- > 0;) {
++ keys[i] = (short)0;
++ vals[i] = (short)0;
++ states[i] = FREE;
++ }
++ }
++
++ /**
++ * Deletes a key/value pair from the map.
++ *
++ * @param key an <code>short</code> value
++ * @return an <code>short</code> value, or (short)0 if no mapping for key exists
++ */
++ public short remove(short key) {
++ short prev = (short)0;
++ int index = index(key);
++ if (index >= 0) {
++ prev = _values[index];
++ removeAt(index); // clear key,state; adjust size
++ }
++ return prev;
++ }
++
++ /**
++ * Compares this map with another map for equality of their stored
++ * entries.
++ *
++ * @param other an <code>Object</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean equals(Object other) {
++ if (! (other instanceof TShortShortHashMap)) {
++ return false;
++ }
++ TShortShortHashMap that = (TShortShortHashMap)other;
++ if (that.size() != this.size()) {
++ return false;
++ }
++ return forEachEntry(new EqProcedure(that));
++ }
++
++ public int hashCode() {
++ HashProcedure p = new HashProcedure();
++ forEachEntry(p);
++ return p.getHashCode();
++ }
++
++ private final class HashProcedure implements TShortShortProcedure {
++ private int h = 0;
++
++ public int getHashCode() {
++ return h;
++ }
++
++ public final boolean execute(short key, short value) {
++ h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value));
++ return true;
++ }
++ }
++
++ private static final class EqProcedure implements TShortShortProcedure {
++ private final TShortShortHashMap _otherMap;
++
++ EqProcedure(TShortShortHashMap otherMap) {
++ _otherMap = otherMap;
++ }
++
++ public final boolean execute(short key, short value) {
++ int index = _otherMap.index(key);
++ if (index >= 0 && eq(value, _otherMap.get(key))) {
++ return true;
++ }
++ return false;
++ }
++
++ /**
++ * Compare two shorts for equality.
++ */
++ private final boolean eq(short v1, short v2) {
++ return v1 == v2;
++ }
++
++ }
++
++ /**
++ * removes the mapping at <tt>index</tt> from the map.
++ *
++ * @param index an <code>int</code> value
++ */
++ protected void removeAt(int index) {
++ _values[index] = (short)0;
++ super.removeAt(index); // clear key, state; adjust size
++ }
++
++ /**
++ * Returns the values of the map.
++ *
++ * @return a <code>Collection</code> value
++ */
++ public short[] getValues() {
++ short[] vals = new short[size()];
++ short[] v = _values;
++ byte[] states = _states;
++
++ for (int i = v.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ vals[j++] = v[i];
++ }
++ }
++ return vals;
++ }
++
++ /**
++ * returns the keys of the map.
++ *
++ * @return a <code>Set</code> value
++ */
++ public short[] keys() {
++ short[] keys = new short[size()];
++ short[] k = _set;
++ byte[] states = _states;
++
++ for (int i = k.length, j = 0; i-- > 0;) {
++ if (states[i] == FULL) {
++ keys[j++] = k[i];
++ }
++ }
++ return keys;
++ }
++
++ /**
++ * checks for the presence of <tt>val</tt> in the values of the map.
++ *
++ * @param val an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsValue(short val) {
++ byte[] states = _states;
++ short[] vals = _values;
++
++ for (int i = vals.length; i-- > 0;) {
++ if (states[i] == FULL && val == vals[i]) {
++ return true;
++ }
++ }
++ return false;
++ }
++
++
++ /**
++ * checks for the present of <tt>key</tt> in the keys of the map.
++ *
++ * @param key an <code>short</code> value
++ * @return a <code>boolean</code> value
++ */
++ public boolean containsKey(short key) {
++ return contains(key);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the keys terminated because
++ * the procedure returned false for some key.
++ */
++ public boolean forEachKey(TShortProcedure procedure) {
++ return forEach(procedure);
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each value in the map.
++ *
++ * @param procedure a <code>TShortProcedure</code> value
++ * @return false if the loop over the values terminated because
++ * the procedure returned false for some value.
++ */
++ public boolean forEachValue(TShortProcedure procedure) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Executes <tt>procedure</tt> for each key/value entry in the
++ * map.
++ *
++ * @param procedure a <code>TOShortShortProcedure</code> value
++ * @return false if the loop over the entries terminated because
++ * the procedure returned false for some entry.
++ */
++ public boolean forEachEntry(TShortShortProcedure procedure) {
++ byte[] states = _states;
++ short[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ return false;
++ }
++ }
++ return true;
++ }
++
++ /**
++ * Retains only those entries in the map for which the procedure
++ * returns a true value.
++ *
++ * @param procedure determines which entries to keep
++ * @return true if the map was modified.
++ */
++ public boolean retainEntries(TShortShortProcedure procedure) {
++ boolean modified = false;
++ byte[] states = _states;
++ short[] keys = _set;
++ short[] values = _values;
++ for (int i = keys.length; i-- > 0;) {
++ if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
++ removeAt(i);
++ modified = true;
++ }
++ }
++ return modified;
++ }
++
++ /**
++ * Transform the values in this map using <tt>function</tt>.
++ *
++ * @param function a <code>TShortFunction</code> value
++ */
++ public void transformValues(TShortFunction function) {
++ byte[] states = _states;
++ short[] values = _values;
++ for (int i = values.length; i-- > 0;) {
++ if (states[i] == FULL) {
++ values[i] = function.execute(values[i]);
++ }
++ }
++ }
++
++ /**
++ * Increments the primitive value mapped to key by 1
++ *
++ * @param key the key of the value to increment
++ * @return true if a mapping was found and modified.
++ */
++ public boolean increment(short key) {
++ return adjustValue(key, (short)1);
++ }
++
++ /**
++ * Adjusts the primitive value mapped to key.
++ *
++ * @param key the key of the value to increment
++ * @param amount the amount to adjust the value by.
++ * @return true if a mapping was found and modified.
++ */
++ public boolean adjustValue(short key, short amount) {
++ int index = index(key);
++ if (index < 0) {
++ return false;
++ } else {
++ _values[index] += amount;
++ return true;
++ }
++ }
++
++
++ public void writeExternal( ObjectOutput out ) throws IOException {
++ // VERSION
++ out.writeByte( 0 );
++
++ // NUMBER OF ENTRIES
++ out.writeInt( _size );
++
++ // ENTRIES
++ SerializationProcedure writeProcedure = new SerializationProcedure( out );
++ if (! forEachEntry(writeProcedure)) {
++ throw writeProcedure.exception;
++ }
++ }
++
++ public void readExternal( ObjectInput in )
++ throws IOException, ClassNotFoundException {
++
++ // VERSION
++ in.readByte();
++
++ // NUMBER OF ENTRIES
++ int size = in.readInt();
++ setUp( size );
++
++ // ENTRIES
++ while (size-- > 0) {
++ short key = in.readShort();
++ short val = in.readShort();
++ put(key, val);
++ }
++ }
++} // TShortShortHashMap
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortShortIterator.java 2007-04-18 06:49:36.000000000 +0000
+@@ -0,0 +1,150 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Iterator for maps of type short and short.
++ *
++ * <p>The iterator semantics for Trove's primitive maps is slightly different
++ * from those defined in <tt>java.util.Iterator</tt>, but still well within
++ * the scope of the pattern, as defined by Gamma, et al.</p>
++ *
++ * <p>This iterator does <b>not</b> implicitly advance to the next entry when
++ * the value at the current position is retrieved. Rather, you must explicitly
++ * ask the iterator to <tt>advance()</tt> and then retrieve either the <tt>key()</tt>,
++ * the <tt>value()</tt> or both. This is done so that you have the option, but not
++ * the obligation, to retrieve keys and/or values as your application requires, and
++ * without introducing wrapper objects that would carry both. As the iteration is
++ * stateful, access to the key/value parts of the current map entry happens in
++ * constant time.</p>
++ *
++ * <p>In practice, the iterator is akin to a "search finger" that you move from
++ * position to position. Read or write operations affect the current entry only and
++ * do not assume responsibility for moving the finger.</p>
++ *
++ * <p>Here are some sample scenarios for this class of iterator:</p>
++ *
++ * <pre>
++ * // accessing keys/values through an iterator:
++ * for (TShortShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * doSomethingWithValue(it.value());
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // modifying values in-place through iteration:
++ * for (TShortShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.setValue(newValueForKey(it.key()));
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // deleting entries during iteration:
++ * for (TShortShortIterator it = map.iterator();
++ * it.hasNext();) {
++ * it.advance();
++ * if (satisfiesCondition(it.key()) {
++ * it.remove();
++ * }
++ * }
++ * </pre>
++ *
++ * <pre>
++ * // faster iteration by avoiding hasNext():
++ * TShortShortIterator iterator = map.iterator();
++ * for (int i = map.size(); i-- > 0;) {
++ * iterator.advance();
++ * doSomethingWithKeyAndValue(iterator.key(), iterator.value());
++ * }
++ * </pre>
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public class TShortShortIterator extends TPrimitiveIterator {
++ /** the collection being iterated over */
++ private final TShortShortHashMap _map;
++
++ /**
++ * Creates an iterator over the specified map
++ */
++ public TShortShortIterator(TShortShortHashMap map) {
++ super(map);
++ this._map = map;
++ }
++
++ /**
++ * Moves the iterator forward to the next entry in the underlying map.
++ *
++ * @throws java.util.NoSuchElementException if the iterator is already exhausted
++ */
++ public void advance() {
++ moveToNextIndex();
++ }
++
++ /**
++ * Provides access to the key of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the key of the entry at the iterator's current position.
++ */
++ public short key() {
++ return _map._set[_index];
++ }
++
++ /**
++ * Provides access to the value of the mapping at the iterator's position.
++ * Note that you must <tt>advance()</tt> the iterator at least once
++ * before invoking this method.
++ *
++ * @return the value of the entry at the iterator's current position.
++ */
++ public short value() {
++ return _map._values[_index];
++ }
++
++ /**
++ * Replace the value of the mapping at the iterator's position with the
++ * specified value. Note that you must <tt>advance()</tt> the iterator at
++ * least once before invoking this method.
++ *
++ * @param val the value to set in the current entry
++ * @return the old value of the entry.
++ */
++ public short setValue(short val) {
++ short old = value();
++ _map._values[_index] = val;
++ return old;
++ }
++}// TShortShortIterator
+--- /dev/null 2006-09-11 12:55:45.000000000 +0000
++++ output/gen_src/gnu/trove/TShortShortProcedure.java 2007-04-18 06:49:37.000000000 +0000
+@@ -0,0 +1,48 @@
++///////////////////////////////////////////////////////////////////////////////
++// Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
++//
++// This library is free software; you can redistribute it and/or
++// modify it under the terms of the GNU Lesser General Public
++// License as published by the Free Software Foundation; either
++// version 2.1 of the License, or (at your option) any later version.
++//
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU Lesser General Public
++// License along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++///////////////////////////////////////////////////////////////////////////////
++
++package gnu.trove;
++
++//////////////////////////////////////////////////
++// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
++//////////////////////////////////////////////////
++
++
++/**
++ * Interface for procedures that take two parameters of type short and short.
++ *
++ * Created: Mon Nov 5 22:03:30 2001
++ *
++ * @author Eric D. Friedman
++ * @version $Id: P2PProcedure.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
++ */
++
++public interface TShortShortProcedure {
++
++ /**
++ * Executes this procedure. A false return value indicates that
++ * the application executing this procedure should not invoke this
++ * procedure again.
++ *
++ * @param a a <code>short</code> value
++ * @param b a <code>short</code> value
++ * @return true if additional invocations of the procedure are
++ * allowed.
++ */
++ public boolean execute(short a, short b);
++}// TShortShortProcedure
diff --git a/debian/rules b/debian/rules
index 8c08b95..557e6ed 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,11 +7,29 @@ include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/ant.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk
-JAVA_HOME_DIRS := /usr/lib/j2sdk1.5-ibm /usr/lib/jvm/java-gcj/
+JAVA_HOME_DIRS := /usr/lib/jvm/java-gcj/
ANT_HOME := /usr/share/ant
DEB_JARS :=
-DEB_ANT_BUILD_TARGET := jar javadocs
+DEB_ANT_BUILD_TARGET := jar javadoc
-#clean::
-# -rm -rf build
+# override version number
+VERSION=2.0a2
+
+post-patches::
+ -mkdir output
+ -mv gen_src output
+
+cleanbuilddir::
+ -rm -rf output
+
+binary-post-install/libtrove-java::
+ mv ./output/lib/trove.jar ./output/lib/trove-$(VERSION).jar
+ dh_install -plibtrove-java ./output/lib/trove-$(VERSION).jar \
+ usr/share/java/
+ dh_link -plibtrove-java usr/share/java/trove-$(VERSION).jar \
+ usr/share/java/trove.jar
+
+binary-post-install/libtrove-java-doc::
+ dh_install -plibtrove-java-doc output/javadocs/* \
+ usr/share/doc/libtrove-java-doc/api
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/trove3.git
More information about the pkg-java-commits
mailing list