Changeset 4177


Ignore:
Timestamp:
10/02/03 17:14:30 (19 years ago)
Author:
piso
Message:

HASH-TABLE-COUNT

Location:
trunk/j/src/org/armedbear/lisp
Files:
2 edited

Legend:

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

    r4173 r4177  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Autoload.java,v 1.81 2003-10-02 13:41:09 piso Exp $
     5 * $Id: Autoload.java,v 1.82 2003-10-02 17:14:30 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    196196        autoload("get-universal-time", "Time");
    197197        autoload("gethash", "HashTable");
     198        autoload("hash-table-count", "HashTable");
    198199        autoload("hash-table-p", "HashTable");
    199200        autoload("import", "PackageFunctions");
  • trunk/j/src/org/armedbear/lisp/HashTable.java

    r4173 r4177  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: HashTable.java,v 1.22 2003-10-02 13:40:44 piso Exp $
     5 * $Id: HashTable.java,v 1.23 2003-10-02 17:14:06 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    6060        buckets = new HashEntry[size];
    6161        threshold = (int) (size * loadFactor);
     62    }
     63
     64    private int getCount()
     65    {
     66        return count;
    6267    }
    6368
     
    367372    };
    368373
     374    // ### hash-table-count
     375    private static final Primitive1 HASH_TABLE_COUNT =
     376        new Primitive1("hash-table-count") {
     377        public LispObject execute(LispObject arg) throws ConditionThrowable
     378        {
     379            if (arg instanceof HashTable)
     380                return new Fixnum(((HashTable)arg).getCount());
     381            throw new ConditionThrowable(new TypeError(arg, "hash-table"));
     382        }
     383    };
     384
    369385    // ### sxhash
    370386    // sxhash object => hash-code
Note: See TracChangeset for help on using the changeset viewer.