Code example for Vector

Methods: clear

0
     */ 
    public void setAndParseRequestFile(final File requestFile) throws RequestElementFactoryException {
        setAndCheckRequestFile(requestFile);
 
        // clear vector of requests 
        _requests.clear();
 
        try { 
            parse(); 
        } catch (ParserConfigurationException e) {
            throw createREFException("unable to create appropriate XML parser - ", e);
        } catch (SAXException e) {
            throw createREFException("unable to parse XML file - ", e);
        } catch (IOException e) {
            throw createREFException("unable to read XML file ", e);
        } catch (IllegalArgumentException e) {
            throw createREFException("", e);
        } 
    } 
 
    private static RequestElementFactoryException createREFException(final String msgPrefix, final Exception e) {
        final RequestElementFactoryException exc = new RequestElementFactoryException(msgPrefix + e.getMessage());
        exc.initCause(e);
        return exc;
    } 
 
    /** 
     * Sets the element factory to be used. 
     * 
     * @param factory the request element factory to be used 
     */ 
    public void setElementFactory(final RequestElementFactory factory) {
        _elemFactory = factory;
    } 
 
    /** 
     * Returns the number of requests parsed. 
     */ 
    public int getNumRequests() { 
        return _requests.size();
    } 
 
    /** 
     * Returns the request at the given index. 
     * 
     * @param index the index of the request to be returned 
     * 
     * @throws ArrayIndexOutOfBoundsException 
     */ 
    public Request getRequestAt(final int index) {
        return _requests.elementAt(index);
    } 
 
    /** 
     * Returns all requests contained in the request file parsed 
     */ 
    public Vector<Request> getAllRequests() {
        return _requests;
    } 
 
    /////////////////////////////////////////////////////////////////////////// 
    /////// END OF PUBLIC 
    /////////////////////////////////////////////////////////////////////////// 
 
    /** 
     * Initializes the object; 
     */ 
    private void init() { 
        _requests = new Vector<Request>();
        _currentRequest = null;
        _elemFactory = null;
    } 
    /** 
     * Checks whether the <code>URL</code> passed in contains a valid file and can be opened for reading. If so, the