From: adam Date: Sat, 30 Oct 2004 22:51:28 +0000 (+0000) Subject: merge Vec X-Git-Url: http://git.megacz.com/?p=org.ibex.util.git;a=commitdiff_plain;h=0b0c7131533c9ca9cfee7fd19c7dbfa166e5d0eb merge Vec darcs-hash:20041030225128-5007d-8cc86f38e7d37141164e12ccd3e5d90a31d56165.gz --- diff --git a/src/org/ibex/util/Vec.java b/src/org/ibex/util/Vec.java index 6d1fbd5..f6a2453 100644 --- a/src/org/ibex/util/Vec.java +++ b/src/org/ibex/util/Vec.java @@ -17,7 +17,7 @@ import java.io.*; * * @see java.util.Vector */ -public final class Vec implements Serializable { +public final class Vec implements Serializable, Cloneable { private Object[] store; private int size = 0; @@ -25,7 +25,13 @@ public final class Vec implements Serializable { public Vec() { this(10); } public Vec(int i) { store = new Object[i]; } public Vec(int i, Object[] store) { size = i; this.store = store; } - + public Vec(Vec old) { + store = new Object[old.store.length]; + System.arraycopy(old.store, 0, store, 0, old.store.length); + this.size = old.size; + } + + public Object clone() { return new Vec(this); } private void grow() { grow(store.length * 2); } private void grow(int newsize) { Object[] newstore = new Object[newsize];