2003/04/30 04:39:33
[org.ibex.core.git] / src / org / xwt / util / Vec.java
index 7b55023..fd21755 100644 (file)
@@ -55,6 +55,13 @@ public class Vec implements Serializable {
         return store[size - 1];
     }
 
+    public void push(Object o) { addElement(o); }
+    public Object pop() {
+       Object ret = lastElement();
+       store[size--] = null;
+       return ret;
+    }
+
     public int size() { return size; }
 
     public void setSize(int newSize) {
@@ -71,6 +78,12 @@ public class Vec implements Serializable {
             out[i] = store[i];
     }
 
+    public void fromArray(Object[] in) {
+        setSize(in.length);
+        for(int i=0; i<size; i++)
+            store[i] = in[i];
+    }
+
     public void removeElementAt(int i) {
         if (i >= size || i < 0) throw new RuntimeException("tried to remove an element outside the vector's limits");
         for(int j=i; j<size - 1; j++)