Changeset 4617


Ignore:
Timestamp:
11/02/03 20:54:36 (19 years ago)
Author:
piso
Message:

classOf(), typep()

File:
1 edited

Legend:

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

    r3894 r4617  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: BitVector.java,v 1.25 2003-09-19 14:44:10 piso Exp $
     5 * $Id: BitVector.java,v 1.26 2003-11-02 20:54:36 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    6161    }
    6262
    63     public LispObject typep(LispObject typeSpecifier) throws ConditionThrowable
    64     {
    65         if (typeSpecifier == Symbol.BIT_VECTOR)
     63    public LispClass classOf()
     64    {
     65        return BuiltInClass.BIT_VECTOR;
     66    }
     67
     68    public LispObject typep(LispObject type) throws ConditionThrowable
     69    {
     70        if (type == Symbol.BIT_VECTOR)
    6671            return T;
    67         if (typeSpecifier == Symbol.SIMPLE_BIT_VECTOR)
     72        if (type == Symbol.SIMPLE_BIT_VECTOR)
    6873            return isSimpleVector() ? T : NIL;
    69         if (typeSpecifier == Symbol.SIMPLE_VECTOR)
     74        if (type == Symbol.SIMPLE_VECTOR)
    7075            return NIL; // Can't hold elements of any type, only bits.
    71         if (typeSpecifier instanceof LispClass) {
    72             if (typeSpecifier.getName().equals("BIT-VECTOR"))
    73                 return T;
    74         } else if (typeSpecifier instanceof Cons && typeSpecifier.length() == 2) {
    75             LispObject first = typeSpecifier.car();
    76             if (first == Symbol.BIT_VECTOR ||
    77                 (first == Symbol.SIMPLE_BIT_VECTOR && isSimpleVector())) {
    78                 LispObject second = typeSpecifier.cadr();
    79                 if (second instanceof Fixnum)
    80                     return ((Fixnum)second).getValue() == length() ? T : NIL;
    81                 if (second == Symbol.UNSPECIFIED)
    82                     return T;
    83             }
    84         }
    85         return super.typep(typeSpecifier);
     76        if (type == BuiltInClass.BIT_VECTOR)
     77            return T;
     78        return super.typep(type);
    8679    }
    8780
Note: See TracChangeset for help on using the changeset viewer.