001package org.apache.commons.ssl.org.bouncycastle.asn1; 002 003import java.util.Enumeration; 004import java.util.Vector; 005 006/** 007 * Mutable class for building ASN.1 constructed objects. 008 */ 009public class ASN1EncodableVector 010{ 011 Vector v = new Vector(); 012 013 /** 014 * Base constructor. 015 */ 016 public ASN1EncodableVector() 017 { 018 } 019 020 /** 021 * Add an encodable to the vector. 022 * 023 * @param obj the encodable to add. 024 */ 025 public void add(ASN1Encodable obj) 026 { 027 v.addElement(obj); 028 } 029 030 /** 031 * Add the contents of another vector. 032 * 033 * @param other the vector to add. 034 */ 035 public void addAll(ASN1EncodableVector other) 036 { 037 for (Enumeration en = other.v.elements(); en.hasMoreElements();) 038 { 039 v.addElement(en.nextElement()); 040 } 041 } 042 043 /** 044 * Return the object at position i in this vector. 045 * 046 * @param i the index of the object of interest. 047 * @return the object at position i. 048 */ 049 public ASN1Encodable get(int i) 050 { 051 return (ASN1Encodable)v.elementAt(i); 052 } 053 054 /** 055 * Return the size of the vector. 056 * 057 * @return the object count in the vector. 058 */ 059 public int size() 060 { 061 return v.size(); 062 } 063}