1package org.bouncycastle.asn1; 2 3import java.util.Enumeration; 4import java.util.Vector; 5 6/** 7 * Mutable class for building ASN.1 constructed objects. 8 */ 9public class ASN1EncodableVector 10{ 11 private final Vector v = new Vector(); 12 13 /** 14 * Base constructor. 15 */ 16 public ASN1EncodableVector() 17 { 18 } 19 20 /** 21 * Add an encodable to the vector. 22 * 23 * @param obj the encodable to add. 24 */ 25 public void add(ASN1Encodable obj) 26 { 27 v.addElement(obj); 28 } 29 30 /** 31 * Add the contents of another vector. 32 * 33 * @param other the vector to add. 34 */ 35 public void addAll(ASN1EncodableVector other) 36 { 37 for (Enumeration en = other.v.elements(); en.hasMoreElements();) 38 { 39 v.addElement(en.nextElement()); 40 } 41 } 42 43 /** 44 * Return the object at position i in this vector. 45 * 46 * @param i the index of the object of interest. 47 * @return the object at position i. 48 */ 49 public ASN1Encodable get(int i) 50 { 51 return (ASN1Encodable)v.elementAt(i); 52 } 53 54 /** 55 * Return the size of the vector. 56 * 57 * @return the object count in the vector. 58 */ 59 public int size() 60 { 61 return v.size(); 62 } 63} 64