Changeset 4441


Ignore:
Timestamp:
10/17/03 19:37:13 (18 years ago)
Author:
piso
Message:

adjustArray()

File:
1 edited

Legend:

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

    r3929 r4441  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Vector.java,v 1.26 2003-09-20 17:02:05 piso Exp $
     5 * $Id: Vector.java,v 1.27 2003-10-17 19:37:13 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8080            capacity = minCapacity;
    8181        }
     82    }
     83
     84    public Vector adjustArray(int size)
     85    {
     86        if (elements.length != size) {
     87            LispObject[] newArray = new LispObject[size];
     88            System.arraycopy(elements, 0, newArray, 0,
     89                             Math.min(elements.length, size));
     90            elements = newArray;
     91            capacity = size;
     92        }
     93        return this;
    8294    }
    8395
Note: See TracChangeset for help on using the changeset viewer.