Changeset 8355


Ignore:
Timestamp:
01/13/05 12:33:19 (17 years ago)
Author:
piso
Message:

SimpleVector?(LispObject obj): obj can be any sequence.

File:
1 edited

Legend:

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

    r8273 r8355  
    22 * SimpleVector.java
    33 *
    4  * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: SimpleVector.java,v 1.18 2004-12-20 01:52:07 piso Exp $
     4 * Copyright (C) 2002-2005 Peter Graves
     5 * $Id: SimpleVector.java,v 1.19 2005-01-13 12:33:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3838    }
    3939
    40     public SimpleVector(LispObject list) throws ConditionThrowable
    41     {
    42         elements = list.copyToArray();
    43         capacity = elements.length;
     40    public SimpleVector(LispObject obj) throws ConditionThrowable
     41    {
     42        if (obj.listp()) {
     43            elements = obj.copyToArray();
     44            capacity = elements.length;
     45        } else if (obj instanceof AbstractVector) {
     46            capacity = obj.length();
     47            elements = new LispObject[capacity];
     48            for (int i = 0; i < capacity; i++)
     49                elements[i] = obj.elt(i);
     50        } else
     51            Debug.assertTrue(false);
    4452    }
    4553
Note: See TracChangeset for help on using the changeset viewer.