01: /*
02: * @(#)IntList.java 1.2 04/12/06
03: *
04: * Copyright (c) 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package pnuts.regex.jsr51;
10:
11: class IntList {
12: int array[] = new int[2];
13: int count = 0;
14:
15: public void add(int i) {
16: if (count >= array.length - 1) {
17: int[] newarray = new int[array.length * 2];
18: System.arraycopy(array, 0, newarray, 0, array.length);
19: array = newarray;
20: }
21: array[count++] = i;
22: }
23:
24: public int size() {
25: return count;
26: }
27:
28: public void copyInto(int[] dest) {
29: System.arraycopy(array, 0, dest, 0, count);
30: }
31: }
|