[kaffe] CVS kaffe (robilad): removed unused org.kaffe.util classes
Kaffe CVS
cvs-commits at kaffe.org
Sun Jul 16 10:39:18 PDT 2006
PatchSet 7357
Date: 2006/07/16 17:25:57
Author: robilad
Branch: HEAD
Tag: (none)
Log:
removed unused org.kaffe.util classes
2006-07-16 Dalibor Topic <robilad at kaffe.org>
* libraries/javalib/vmspecific/org/kaffe/util/Base64.java,
libraries/javalib/vmspecific/org/kaffe/util/DateParser.java,
libraries/javalib/vmspecific/org/kaffe/util/DateScanner.java,
libraries/javalib/vmspecific/org/kaffe/util/Deprecated.java,
libraries/javalib/vmspecific/org/kaffe/util/IdentityHashtable.java,
libraries/javalib/vmspecific/org/kaffe/util/IntegerHashtable.java,
libraries/javalib/vmspecific/org/kaffe/util/IntegerIntegerHashtable.java,
libraries/javalib/vmspecific/org/kaffe/util/LongHashtable.java,
libraries/javalib/vmspecific/org/kaffe/util/NotImplementedReport.java,
libraries/javalib/vmspecific/org/kaffe/util/UNIXTimeZone.java:
Removed unused classes.
Members:
ChangeLog:1.4861->1.4862
libraries/javalib/Makefile.am:1.443->1.444
libraries/javalib/Makefile.in:1.557->1.558
libraries/javalib/vmspecific/org/kaffe/util/Base64.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/util/DateParser.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/util/DateScanner.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/util/Deprecated.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/util/IdentityHashtable.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/util/IntegerHashtable.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/util/IntegerIntegerHashtable.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/util/LongHashtable.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/util/NotImplementedReport.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/util/UNIXTimeZone.java:1.1->1.2(DEAD)
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4861 kaffe/ChangeLog:1.4862
--- kaffe/ChangeLog:1.4861 Sun Jul 16 16:31:54 2006
+++ kaffe/ChangeLog Sun Jul 16 17:25:57 2006
@@ -1,5 +1,19 @@
2006-07-16 Dalibor Topic <robilad at kaffe.org>
+ * libraries/javalib/vmspecific/org/kaffe/util/Base64.java,
+ libraries/javalib/vmspecific/org/kaffe/util/DateParser.java,
+ libraries/javalib/vmspecific/org/kaffe/util/DateScanner.java,
+ libraries/javalib/vmspecific/org/kaffe/util/Deprecated.java,
+ libraries/javalib/vmspecific/org/kaffe/util/IdentityHashtable.java,
+ libraries/javalib/vmspecific/org/kaffe/util/IntegerHashtable.java,
+ libraries/javalib/vmspecific/org/kaffe/util/IntegerIntegerHashtable.java,
+ libraries/javalib/vmspecific/org/kaffe/util/LongHashtable.java,
+ libraries/javalib/vmspecific/org/kaffe/util/NotImplementedReport.java,
+ libraries/javalib/vmspecific/org/kaffe/util/UNIXTimeZone.java:
+ Removed unused classes.
+
+2006-07-16 Dalibor Topic <robilad at kaffe.org>
+
* libraries/javalib/vmspecific/org/kaffe/util/Timer.java,
libraries/javalib/vmspecific/org/kaffe/util/TimerClient.java,
libraries/javalib/vmspecific/org/kaffe/util/VectorSnapshot.java:
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.443 kaffe/libraries/javalib/Makefile.am:1.444
--- kaffe/libraries/javalib/Makefile.am:1.443 Sun Jul 16 16:32:03 2006
+++ kaffe/libraries/javalib/Makefile.am Sun Jul 16 17:26:02 2006
@@ -291,19 +291,9 @@
vmspecific/org/kaffe/security/provider/SHA1PRNG.java \
vmspecific/org/kaffe/security/provider/UpdateDigest.java \
vmspecific/org/kaffe/util/Assert.java \
- vmspecific/org/kaffe/util/Base64.java \
- vmspecific/org/kaffe/util/DateParser.java \
- vmspecific/org/kaffe/util/DateScanner.java \
- vmspecific/org/kaffe/util/Deprecated.java \
- vmspecific/org/kaffe/util/IdentityHashtable.java \
- vmspecific/org/kaffe/util/IntegerHashtable.java \
- vmspecific/org/kaffe/util/IntegerIntegerHashtable.java \
- vmspecific/org/kaffe/util/LongHashtable.java \
vmspecific/org/kaffe/util/NotImplemented.java \
- vmspecific/org/kaffe/util/NotImplementedReport.java \
vmspecific/org/kaffe/util/Ptr.java \
vmspecific/org/kaffe/util/SupportDisabled.java \
- vmspecific/org/kaffe/util/UNIXTimeZone.java \
vmspecific/org/kaffe/util/UTF8.java \
vmspecific/org/kaffe/util/zip/SwitchInflater.java \
vmspecific/org/objectweb/asm153/Attribute.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.557 kaffe/libraries/javalib/Makefile.in:1.558
--- kaffe/libraries/javalib/Makefile.in:1.557 Sun Jul 16 16:32:06 2006
+++ kaffe/libraries/javalib/Makefile.in Sun Jul 16 17:26:02 2006
@@ -605,19 +605,9 @@
vmspecific/org/kaffe/security/provider/SHA1PRNG.java \
vmspecific/org/kaffe/security/provider/UpdateDigest.java \
vmspecific/org/kaffe/util/Assert.java \
- vmspecific/org/kaffe/util/Base64.java \
- vmspecific/org/kaffe/util/DateParser.java \
- vmspecific/org/kaffe/util/DateScanner.java \
- vmspecific/org/kaffe/util/Deprecated.java \
- vmspecific/org/kaffe/util/IdentityHashtable.java \
- vmspecific/org/kaffe/util/IntegerHashtable.java \
- vmspecific/org/kaffe/util/IntegerIntegerHashtable.java \
- vmspecific/org/kaffe/util/LongHashtable.java \
vmspecific/org/kaffe/util/NotImplemented.java \
- vmspecific/org/kaffe/util/NotImplementedReport.java \
vmspecific/org/kaffe/util/Ptr.java \
vmspecific/org/kaffe/util/SupportDisabled.java \
- vmspecific/org/kaffe/util/UNIXTimeZone.java \
vmspecific/org/kaffe/util/UTF8.java \
vmspecific/org/kaffe/util/zip/SwitchInflater.java \
vmspecific/org/objectweb/asm153/Attribute.java \
===================================================================
Checking out kaffe/libraries/javalib/vmspecific/org/kaffe/util/Base64.java
RCS: /home/cvs/kaffe/kaffe/libraries/javalib/vmspecific/org/kaffe/util/Attic/Base64.java,v
VERS: 1.1
***************
--- kaffe/libraries/javalib/vmspecific/org/kaffe/util/Base64.java Sun Jul 16 17:39:17 2006
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,114 +0,0 @@
-
-/*
- * Java core library component.
- *
- * Copyright (c) 1999
- * Archie L. Cobbs. All rights reserved.
- * Copyright (c) 1999
- * Transvirtual Technologies, Inc. All rights reserved.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file.
- *
- * Author: Archie L. Cobbs <archie at whistle.com>
- */
-
-package org.kaffe.util;
-
-public final class Base64 {
- public static final String CHARSET =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- public static final char END_CHAR = '=';
-
- private Base64() {
- }
-
- public static byte[] encode(String s) {
- return encode(s.getBytes());
- }
-
- public static byte[] encode(byte[] buf) {
- return encode(buf, 0, buf.length);
- }
-
- public static byte[] encode(byte[] buf, int off, int len) {
- byte[] out = new byte[((len + 2) / 3) * 4];
- int index = 0, j = off;
-
- for (int i = 0; i < out.length; i++) {
- if (j >= off + len) {
- out[i] = (byte)END_CHAR;
- continue;
- }
- switch (i % 4) {
- case 0:
- index = (buf[j] >> 2) & 0x3f;
- break;
- case 1:
- index = ((buf[j++] << 4) & 0x30);
- if (j < off + len) {
- index |= ((buf[j] >> 4) & 0x0f);
- }
- break;
- case 2:
- index = ((buf[j++] << 2) & 0x3c);
- if (j < off + len) {
- index |= ((buf[j] >> 6) & 0x03);
- }
- break;
- case 3:
- index = buf[j++] & 0x3f;
- break;
- }
- out[i] = (byte)CHARSET.charAt(index & 0x3f);
- }
- return out;
- }
-
- public static byte[] decode(String s) {
- return decode(s.getBytes());
- }
-
- public static byte[] decode(byte[] buf) {
- return decode(buf, 0, buf.length);
- }
-
- public static byte[] decode(byte[] buf, int off, int len) {
- while (len > 0 && buf[off + len - 1] == (byte)END_CHAR) {
- len--;
- }
- byte[] out = new byte[(len * 3) / 4];
- int j = 0;
- for (int i = 0; i < len; i++) {
- byte ch = buf[off + i];
- int bits;
-
- if ((bits = CHARSET.indexOf((char)ch)) == -1) {
- throw new IllegalArgumentException();
- }
- switch (i % 4) {
- case 0:
- out[j] = (byte)(bits << 2);
- break;
- case 1:
- out[j++] |= (bits >> 4) & 0x03;
- if (j < out.length) {
- out[j] |= (bits << 4) & 0xf0;
- }
- break;
- case 2:
- out[j++] |= (bits >> 2) & 0x0f;
- if (j < out.length) {
- out[j] |= (bits << 6) & 0xc0;
- }
- break;
- case 3:
- out[j++] |= bits & 0x3f;
- break;
- }
- }
- return out;
- }
-
-}
-
===================================================================
Checking out kaffe/libraries/javalib/vmspecific/org/kaffe/util/DateParser.java
RCS: /home/cvs/kaffe/kaffe/libraries/javalib/vmspecific/org/kaffe/util/Attic/DateParser.java,v
VERS: 1.1
***************
--- kaffe/libraries/javalib/vmspecific/org/kaffe/util/DateParser.java Sun Jul 16 17:39:17 2006
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,142 +0,0 @@
-package org.kaffe.util;
-
-import java.text.DateFormatSymbols;
-import java.text.ParseException;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-/*
- * DateParser -
- *
- * Copyright (c) 1998
- * Transvirtual Technologies, Inc. All rights reserved.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file.
- *
- */
-public class DateParser
-{
-public static int getDayIdx( String day, DateFormatSymbols syms) {
- String[] arr;
- int idx;
-
- arr = syms.getWeekdays();
- for ( idx=0; idx<arr.length; idx++) {
- if ( arr[idx].equals( day) )
- return idx;
- }
-
- arr = syms.getShortWeekdays();
- for ( idx=0; idx<arr.length; idx++) {
- if ( arr[idx].equals( day) )
- return idx;
- }
-
- return -1;
-}
-
-public static int getMonthIdx( String day, DateFormatSymbols syms) {
- String[] arr;
- int idx;
-
- arr = syms.getMonths();
- for ( idx=0; idx<arr.length; idx++) {
- if ( arr[idx].equals( day) )
- return idx;
- }
-
- arr = syms.getShortMonths();
- for ( idx=0; idx<arr.length; idx++) {
- if ( arr[idx].equals( day) )
- return idx;
- }
-
- return -1;
-}
-
-public static void main( String[] args) {
- try {
- Date d = DateParser.parse( args[0] );
- System.out.println( d);
- }
- catch ( ParseException _x) {
- System.out.println( _x + " near: " + _x.getErrorOffset() );
- }
-}
-
-public static Date parse( String dateStr) throws ParseException {
- return parse( dateStr, new DateFormatSymbols() );
-}
-
-public static Date parse( String dateStr, DateFormatSymbols syms) throws ParseException {
- Calendar cal = Calendar.getInstance();
- DateScanner ds = new DateScanner( dateStr, syms);
- int tok;
-
- while ( (tok = ds.nextToken()) != DateScanner.EOF ) {
- switch ( tok) {
- case DateScanner.UNKNOWN:
- throw new ParseException( dateStr, ds.si1);
- case DateScanner.DAY:
- case DateScanner.WDDAY:
- int wdday = Integer.parseInt( ds.stringToken());
- cal.set( Calendar.DAY_OF_MONTH, wdday );
- break;
- case DateScanner.MONTH:
- int month = Integer.parseInt( ds.stringToken() ) -1;
- cal.set( Calendar.MONTH, month );
- break;
- case DateScanner.YEAR:
- int year = Integer.parseInt( ds.stringToken());
- if ( year < 100 )
- year += 1900;
- cal.set( Calendar.YEAR, year );
- break;
- case DateScanner.HOUR:
- int hour = Integer.parseInt( ds.stringToken());
- cal.set( Calendar.HOUR_OF_DAY, hour );
- break;
- case DateScanner.MINUTE:
- int minute = Integer.parseInt( ds.stringToken());
- cal.set( Calendar.MINUTE, minute );
- break;
- case DateScanner.SECOND:
- int second = Integer.parseInt( ds.stringToken());
- cal.set( Calendar.SECOND, second );
- break;
- case DateScanner.WEEKDAY:
- int day = getDayIdx( ds.stringToken(), syms );
- cal.set( Calendar.DAY_OF_WEEK, day );
- break;
- case DateScanner.ZONE:
- String zone = ds.stringToken();
- cal.setTimeZone( TimeZone.getTimeZone( zone ));
- break;
- case DateScanner.OFFSET:
- int offs = Integer.parseInt( ds.stringToken());
- int val = (offs % 100) * 60000 + (offs / 100) * 3600000;
- if ( ds.src[ds.si0-1] == '-' )
- val *= -1;
- cal.set( Calendar.ZONE_OFFSET, val );
- break;
- case DateScanner.WDMONTH:
- int wdmonth = getMonthIdx( ds.stringToken(), syms );
- cal.set( Calendar.MONTH, wdmonth );
- break;
- case DateScanner.AMPM:
- String s = ds.stringToken();
- if ( s.equals( "PM") ) {
- int h = cal.get( Calendar.HOUR_OF_DAY);
- if ( h < 12 )
- h += 12;
- cal.set( Calendar.HOUR_OF_DAY, h);
- }
- break;
- }
- }
-
- return cal.getTime();
-}
-}
===================================================================
Checking out kaffe/libraries/javalib/vmspecific/org/kaffe/util/DateScanner.java
RCS: /home/cvs/kaffe/kaffe/libraries/javalib/vmspecific/org/kaffe/util/Attic/DateScanner.java,v
VERS: 1.1
***************
--- kaffe/libraries/javalib/vmspecific/org/kaffe/util/DateScanner.java Sun Jul 16 17:39:17 2006
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,142 +0,0 @@
-package org.kaffe.util;
-
-import java.text.DateFormatSymbols;
-import java.util.TimeZone;
-
-/*
- * DateScanner -
- *
- * Copyright (c) 1998
- * Transvirtual Technologies, Inc. All rights reserved.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file.
- *
- */
-public class DateScanner
-{
- int si0;
- int si1;
- private int sLen;
- char[] src;
- private int tok;
- final static int DAY = 0;
- final static int MONTH = 1;
- final static int YEAR = 2;
- final static int HOUR = 3;
- final static int MINUTE = 4;
- final static int SECOND = 5;
- final static int WEEKDAY = 6;
- final static int ZONE = 7;
- final static int OFFSET = 8;
- final static int EOF = -1;
- final static int WDDAY = 9;
- final static int WDMONTH = 10;
- final static int AMPM = 11;
- final static int UNKNOWN = -2;
- private DateFormatSymbols syms;
-
-public DateScanner( String date) {
- this( date, new DateFormatSymbols() );
-}
-
-public DateScanner( String date, DateFormatSymbols syms) {
- this.syms = syms;
- src = date.toCharArray();
- sLen = src.length;
- si0 = 0;
- si1 = -1;
- tok = EOF;
-}
-
-int closeToken() {
- if ( (src[si0] >= 'A') && (src[si0] <= 'Z') ) {
- String s = stringToken();
- if ( DateParser.getDayIdx( s, syms) > -1 )
- return ( tok = WEEKDAY );
- if ( DateParser.getMonthIdx( s, syms) > -1 )
- return ( tok = WDMONTH );
- if ( TimeZone.getTimeZone( s) != null )
- return ( tok = ZONE);
- if ( s.equals( "AM") || s.equals( "PM") )
- return ( tok = AMPM);
- return UNKNOWN;
- }
-
- switch ( tok) {
- case HOUR:
- return ( tok = MINUTE);
- case MINUTE:
- return ( tok = SECOND);
- case MONTH:
- return ( tok = YEAR);
- case DAY:
- return ( tok = YEAR);
- case WEEKDAY:
- return ( tok = WDDAY);
- case WDDAY:
- return ( tok = WDMONTH);
- case WDMONTH:
- return ( tok = YEAR);
- case ZONE:
- return ( tok = OFFSET);
- }
-
- return (tok = EOF);
-}
-
-public static void main( String[] args) {
- DateScanner ds = new DateScanner( args[0]);
- int tok;
- while ( (tok = ds.nextToken() ) != EOF ) {
- System.out.println( tok + " " + ds.stringToken());
- }
-}
-
-public int nextToken() {
- char c;
-
- si1++;
-
- if ( si1 >= sLen )
- return ( tok = EOF);
-
- for ( ; si1<sLen; si1++) {
- if ( src[si1] != ' ' )
- break;
- }
-
- for ( si0 = si1; si1 < sLen; si1++) {
- c = src[si1];
- switch( c) {
- case '/':
- if ( tok == MONTH )
- return (tok = DAY);
- return (tok = MONTH);
- case ' ':
- return closeToken();
- case '.':
- if ( tok == DAY )
- return (tok = MONTH);
- return (tok = DAY);
- case ':':
- if ( tok == HOUR )
- return (tok = MINUTE);
- return (tok = HOUR);
- case ',':
- if ( tok == WDMONTH )
- return (tok = DAY);
- return (tok = WEEKDAY);
- case '+':
- case '-':
- return (tok = ZONE);
- }
- }
-
- return closeToken();
-}
-
-public String stringToken() {
- return new String( src, si0, si1-si0);
-}
-}
===================================================================
Checking out kaffe/libraries/javalib/vmspecific/org/kaffe/util/Deprecated.java
RCS: /home/cvs/kaffe/kaffe/libraries/javalib/vmspecific/org/kaffe/util/Attic/Deprecated.java,v
VERS: 1.1
***************
--- kaffe/libraries/javalib/vmspecific/org/kaffe/util/Deprecated.java Sun Jul 16 17:39:17 2006
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,24 +0,0 @@
-/*
- * Java core library component.
- *
- * Copyright (c) 1997, 1998
- * Transvirtual Technologies, Inc. All rights reserved.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file.
- */
-
-package org.kaffe.util;
-
-
-public class Deprecated extends Error {
-
-public Deprecated () {
- super();
-}
-
-public Deprecated (String s) {
- super(s);
-}
-
-}
===================================================================
Checking out kaffe/libraries/javalib/vmspecific/org/kaffe/util/IdentityHashtable.java
RCS: /home/cvs/kaffe/kaffe/libraries/javalib/vmspecific/org/kaffe/util/Attic/IdentityHashtable.java,v
VERS: 1.1
***************
--- kaffe/libraries/javalib/vmspecific/org/kaffe/util/IdentityHashtable.java Sun Jul 16 17:39:17 2006
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,224 +0,0 @@
-/*
- * Java core library component.
- *
- * Copyright (c) 1997, 1998, 1999
- * Transvirtual Technologies, Inc. All rights reserved.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file.
- */
-
-package org.kaffe.util;
-
-
-/* IdentityHashtable is a simplified java.util.Hashtable for use by
- java.io.ObjectOutputStream. It uses System.identityHashCode and
- == instead of hashCode() and equals(). */
-
-public class IdentityHashtable {
- transient private Object keys[];
- transient private Object elements[];
- transient private float loadFactor;
- private int numberOfKeys;
- transient private int rehashLimit;
-
- private static final int DEFAULTCAPACITY = 101;
- private static final float DEFAULTLOADFACTOR = (float)0.75;
- private static final Object removed = new Object();
- private static final Object free = null;
-
- public IdentityHashtable() {
- this(DEFAULTCAPACITY, DEFAULTLOADFACTOR);
- }
-
- public IdentityHashtable(int initialCapacity) {
- this(initialCapacity, DEFAULTLOADFACTOR);
- }
-
- public IdentityHashtable(int initialCapacity, float loadFactor)
- {
- if (initialCapacity <= 0) {
- throw new Error("Initial capacity is <= 0");
- }
- if (loadFactor <= 0.0) {
- throw new Error("Load Factor is <= 0");
- }
- this.loadFactor = loadFactor;
- this.keys = new Object[initialCapacity];
- this.elements = new Object[initialCapacity];
- this.numberOfKeys = 0;
- this.rehashLimit = (int)(loadFactor * (float)initialCapacity);
- }
-
- public int size() {
- return (numberOfKeys);
- }
-
- public boolean isEmpty() {
- return (numberOfKeys == 0);
- }
-
- public synchronized boolean contains(Object value) {
- for (int pos = elements.length-1; pos >= 0; pos--) {
- if (value.equals(elements[pos])) {
- return (true);
- }
- }
- return false;
- }
-
- public synchronized boolean containsKey(Object key) {
- return (get(key) != null);
- }
-
- private int calculateBucket(Object key) {
- return ((System.identityHashCode(key) & Integer.MAX_VALUE) % keys.length);
- }
-
- public synchronized Object get(Object key)
- {
- int posn = calculateBucket(key);
- int limit = keys.length;
- for (int i = posn; i < limit; i++) {
- Object mkey = keys[i];
- if (key==mkey) {
- return (elements[i]);
- }
- if (mkey == free) {
- return (null);
- }
- }
- for (int i = 0; i < posn; i++) {
- Object mkey = keys[i];
- if (key==mkey) {
- return (elements[i]);
- }
- if (mkey == free) {
- return (null);
- }
- }
- return (null);
- }
-
- protected synchronized void rehash()
- {
- int newCapacity = keys.length * 2;
- Object oldKeys[] = keys;
- Object oldElements[] = elements;
-
- keys = new Object[newCapacity];
- elements = new Object[newCapacity];
- rehashLimit = (int)(loadFactor * (float)newCapacity);
- numberOfKeys = 0;
-
- /* Go through adding all the data to the new data */
- for (int pos = oldKeys.length-1; pos >= 0; pos--) {
- if (oldKeys[pos] != free && oldKeys[pos] != removed) {
- put(oldKeys[pos], oldElements[pos]);
- }
- }
- }
-
- public synchronized Object put(Object key, Object value) {
- if (numberOfKeys >= rehashLimit) {
- rehash();
- }
-
- int posn = calculateBucket(key);
- int limit = keys.length;
- int space = -1;
- for (int i = posn; i < limit; i++) {
- Object mkey = keys[i];
- if (key==mkey) {
- Object oldElement = elements[i];
- elements[i] = value;
- return (oldElement);
- }
- if (mkey == removed) {
- if (space == -1) {
- space = i;
- }
- }
- else if (mkey == free) {
- if (space == -1) {
- space = i;
- }
- keys[space] = key;
- elements[space] = value;
- numberOfKeys++;
- return (null);
- }
- }
- for (int i = 0; i < posn; i++) {
- Object mkey = keys[i];
- if (key==mkey) {
- Object oldElement = elements[i];
- elements[i] = value;
- return (oldElement);
- }
- if (mkey == removed) {
- if (space == -1) {
- space = i;
- }
- }
- else if (mkey == free) {
- if (space == -1) {
- space = i;
- }
- keys[space] = key;
- elements[space] = value;
- numberOfKeys++;
- return (null);
- }
- }
- if (space != -1) {
- keys[space] = key;
- elements[space] = value;
- numberOfKeys++;
- return (null);
- }
- // We shouldn't get here.
- throw new Error("Inconsistent IdentityHashtable");
- }
-
- public synchronized Object remove(Object key) {
-
- int posn = calculateBucket(key);
- int limit = keys.length;
- for (int i = posn; i < limit; i++) {
- Object mkey = keys[i];
- if (key==mkey) {
- Object oldElement = elements[i];
- elements[i] = removed;
- keys[i] = removed;
- numberOfKeys--;
- return (oldElement);
- }
- if (mkey == free) {
- return (null);
- }
- }
- for (int i = 0; i < posn; i++) {
- Object mkey = keys[i];
- if (key==mkey) {
- Object oldElement = elements[i];
- elements[i] = removed;
- keys[i] = removed;
- numberOfKeys--;
- return (oldElement);
- }
- if (mkey == free) {
- return (null);
- }
- }
- return (null);
- }
-
- public synchronized void clear() {
- for (int pos = keys.length - 1; pos >= 0; pos--) {
- keys[pos] = free;
- elements[pos] = free;
- }
- numberOfKeys = 0;
- }
-}
===================================================================
Checking out kaffe/libraries/javalib/vmspecific/org/kaffe/util/IntegerHashtable.java
RCS: /home/cvs/kaffe/kaffe/libraries/javalib/vmspecific/org/kaffe/util/Attic/IntegerHashtable.java,v
VERS: 1.1
***************
--- kaffe/libraries/javalib/vmspecific/org/kaffe/util/IntegerHashtable.java Sun Jul 16 17:39:17 2006
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,257 +0,0 @@
-/*
- * Java core library component.
- *
- * Copyright (c) 1997, 1998, 1999
- * Transvirtual Technologies, Inc. All rights reserved.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file.
- */
-
-package org.kaffe.util;
-
-/**
- * A simple hashtable using +ints as keys.
- */
-public class IntegerHashtable {
- private int keys[];
- private Object elements[];
- private int iloadFactor;
- private int numberOfKeys;
- private int rehashLimit;
-
- private static final int DEFAULTCAPACITY = 101;
- private static final int DEFAULTLOADFACTOR = 75;
- private static final int removed = -2;
- private static final int free = -1;
-
- public IntegerHashtable() {
- this(DEFAULTCAPACITY, DEFAULTLOADFACTOR);
- }
-
- public IntegerHashtable(int initialCapacity) {
- this(initialCapacity, DEFAULTLOADFACTOR);
- }
-
- public IntegerHashtable(int initialCapacity, float loadFactor) {
- this(initialCapacity, (int)(loadFactor * 100.0));
- }
-
- public IntegerHashtable(int initialCapacity, int iloadFactor) {
- if (initialCapacity <= 0) {
- throw new Error("Initial capacity is <= 0");
- }
- if (iloadFactor <= 0) {
- throw new Error("Load Factor is <= 0");
- }
- this.iloadFactor = iloadFactor;
- this.keys = new int[initialCapacity];
- for (int i = 0; i < initialCapacity; i++) {
- keys[i] = free;
- }
- this.elements = new Object[initialCapacity];
- this.numberOfKeys = 0;
- this.rehashLimit = (iloadFactor * initialCapacity) / 100;
- }
-
- public int size() {
- return (numberOfKeys);
- }
-
- public boolean isEmpty() {
- return (numberOfKeys == 0);
- }
-
- public synchronized boolean contains(Object value) {
- for (int pos = elements.length-1; pos >= 0; pos--) {
- if (value.equals(elements[pos])) {
- return (true);
- }
- }
- return false;
- }
-
- public synchronized boolean containsKey(int key) {
- return (get(key) != null);
- }
-
- private int calculateBucket(int key) {
- return (key % keys.length);
- }
-
- public synchronized Object get(int key)
- {
- int posn = calculateBucket(key);
- int limit = keys.length;
- for (int i = posn; i < limit; i++) {
- int mkey = keys[i];
- if (key == mkey) {
- return (elements[i]);
- }
- if (mkey == free) {
- return (null);
- }
- }
- for (int i = 0; i < posn; i++) {
- int mkey = keys[i];
- if (key == mkey) {
- return (elements[i]);
- }
- if (mkey == free) {
- return (null);
- }
- }
- return (null);
- }
-
- protected synchronized void rehash()
- {
- int newCapacity = keys.length * 2;
- int oldKeys[] = keys;
- Object oldElements[] = elements;
-
- keys = new int[newCapacity];
- for (int i = 0; i < newCapacity; i++) {
- keys[i] = free;
- }
- elements = new Object[newCapacity];
- rehashLimit = (iloadFactor * newCapacity) / 100;
- numberOfKeys = 0;
-
- /* Go through adding all the data to the new data */
- for (int pos = oldKeys.length-1; pos >= 0; pos--) {
- if (oldKeys[pos] != free && oldKeys[pos] != removed) {
- put(oldKeys[pos], oldElements[pos]);
- }
- }
- }
-
- public synchronized Object put(int key, Object value) {
- if (numberOfKeys >= rehashLimit) {
- rehash();
- }
-
- int posn = calculateBucket(key);
- int limit = keys.length;
- int space = -1;
- for (int i = posn; i < limit; i++) {
- int mkey = keys[i];
- if (mkey == removed) {
- if (space == -1) {
- space = i;
- }
- }
- else if (mkey == free) {
- if (space == -1) {
- space = i;
- }
- keys[space] = key;
- elements[space] = value;
- numberOfKeys++;
- return (null);
- }
- else if (key == mkey) {
- Object oldElement = elements[i];
- elements[i] = value;
- return (oldElement);
- }
- }
- for (int i = 0; i < posn; i++) {
- int mkey = keys[i];
- if (key == mkey) {
- Object oldElement = elements[i];
- elements[i] = value;
- return (oldElement);
- }
- if (mkey == removed) {
- if (space == -1) {
- space = i;
- }
- }
- else if (mkey == free) {
- if (space == -1) {
- space = i;
- }
- keys[space] = key;
- elements[space] = value;
- numberOfKeys++;
- return (null);
- }
- }
- if (space != -1) {
- keys[space] = key;
- elements[space] = value;
- numberOfKeys++;
- return (null);
- }
- // We shouldn't get here.
- throw new Error("Inconsistent Hashtable");
- }
-
- public synchronized Object remove(int key) {
-
- int posn = calculateBucket(key);
- int limit = keys.length;
- for (int i = posn; i < limit; i++) {
- int mkey = keys[i];
- if (key == mkey) {
*** Patch too long, truncated ***
More information about the kaffe
mailing list