Changeset 5306


Ignore:
Timestamp:
01/01/04 17:10:38 (17 years ago)
Author:
piso
Message:

HASH-TABLE-REHASH-SIZE
HASH-TABLE-REHASH-THRESHOLD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/HashTable.java

    r5305 r5306  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: HashTable.java,v 1.30 2004-01-01 02:04:12 piso Exp $
     5 * $Id: HashTable.java,v 1.31 2004-01-01 17:10:38 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3131    private int test;
    3232
     33    private final LispObject rehashSize;
     34    private final LispObject rehashThreshold;
     35
    3336    // The rounded product of the capacity and the load factor. When the number
    3437    // of elements exceeds the threshold, the implementation calls rehash().
     
    5760        else
    5861            signal(new LispError("MAKE-HASH-TABLE:  test " + test));
    59         // Ignore rehashSize and rehashThreshold.
     62        this.rehashSize = rehashSize;
     63        this.rehashThreshold = rehashThreshold;
    6064        buckets = new HashEntry[size];
    6165        threshold = (int) (size * loadFactor);
     
    440444        }
    441445    };
     446
     447    private static final Primitive1 HASH_TABLE_REHASH_SIZE =
     448        new Primitive1("hash-table-rehash-size", "hash-table")
     449    {
     450        public LispObject execute(LispObject arg) throws ConditionThrowable
     451        {
     452            if (arg instanceof HashTable)
     453                return ((HashTable)arg).rehashSize;
     454            return signal(new TypeError(arg, Symbol.HASH_TABLE));
     455        }
     456    };
     457
     458    private static final Primitive1 HASH_TABLE_REHASH_THRESHOLD =
     459        new Primitive1("hash-table-rehash-threshold", "hash-table")
     460    {
     461        public LispObject execute(LispObject arg) throws ConditionThrowable
     462        {
     463            if (arg instanceof HashTable)
     464                return ((HashTable)arg).rehashThreshold;
     465            return signal(new TypeError(arg, Symbol.HASH_TABLE));
     466        }
     467    };
    442468}
Note: See TracChangeset for help on using the changeset viewer.