-// Copyright (C) 2003 Adam Megacz <adam@ibex.org> all rights reserved.
-//
-// You may modify, copy, and redistribute this code under the terms of
-// the GNU Library Public License version 2.1, with the exception of
-// the portion of clause 6a after the semicolon (aka the "obnoxious
-// relink clause")
+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Public Source License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
package org.ibex.util;
* Not threadsafe.
*/
public class Hash implements java.io.Serializable {
+
+ public static final long serialVersionUID = 8177551301264350283L;
+
/** this object is inserted as key in a slot when the
* corresponding value is removed -- this ensures that the
* probing sequence for any given key remains the same even if
/** the number of entries with a non-null value */
public int size() { return size; }
+ public Object[] dumpkeys() {
+ return dumpkeys(new Object[size]);
+ }
+ public Object[] dumpkeys(Object[] ret) {
+ int j = 0;
+ for(int i=0; i<keys1.length; i++)
+ if (keys1[i]!=null)
+ ret[j++] = keys1[i];
+ return ret;
+ }
+
+ public Object[] vals() {
+ Object[] ret = new Object[size()];
+ int j = 0;
+ for(int i=0; i<vals.length; i++)
+ if (vals[i] != null && vals[i] != placeholder)
+ ret[j++] = vals[i];
+ return ret;
+ }
+
/** empties the table */
public void clear() {
size = 0;
}
/** returns all the primary keys in the table */
- public Enumeration keys() { return new HashEnum(); }
+ public java.util.Enumeration enumerateKeys() { return new HashEnum(); }
public Hash() { this(25, 3); }
public Hash(int initialcapacity, int loadFactor) {