Example usage for java.util Vector addElement

List of usage examples for java.util Vector addElement

Introduction

In this page you can find the example usage for java.util Vector addElement.

Prototype

public synchronized void addElement(E obj) 

Source Link

Document

Adds the specified component to the end of this vector, increasing its size by one.

Usage

From source file:org.apache.jk.config.WebXml2Jk.java

/** Extract the wellcome files from the web.xml
 *//*from  w w  w .  ja  v  a  2 s.c o  m*/
public Vector getWellcomeFiles() {
    Node n0 = getChild(webN, "welcome-file-list");
    Vector wF = new Vector();
    if (n0 != null) {
        for (Node mapN = getChild(webN, "welcome-file"); mapN != null; mapN = getNext(mapN)) {
            wF.addElement(getContent(mapN));
        }
    }
    // XXX Add index.html, index.jsp
    return wF;
}

From source file:OutputApplet.java

/**
 * The "run" method is called from the worker thread. Notice that because
 * this method is doing potentially slow databases accesses we avoid making
 * it a synchronized method.//from w w  w  .j  a v  a2  s .co  m
 */

public void run() {
    String url = "jdbc:mySubprotocol:myDataSource";
    String query = "select COF_NAME, PRICE from COFFEES";

    try {
        Class.forName("myDriver.ClassName");
    } catch (Exception ex) {
        setError("Can't find Database driver class: " + ex);
        return;
    }

    try {
        Vector results = new Vector();
        Connection con = DriverManager.getConnection(url, "myLogin", "myPassword");
        Statement stmt = con.createStatement();
        ResultSet rs = stmt.executeQuery(query);
        while (rs.next()) {
            String s = rs.getString("COF_NAME");
            float f = rs.getFloat("PRICE");
            String text = s + "     " + f;
            results.addElement(text);
        }

        stmt.close();
        con.close();

        setResults(results);

    } catch (SQLException ex) {
        setError("SQLException: " + ex);
    }
}

From source file:com.globalsight.everest.usermgr.UserLdapHelper.java

/**
 * Generates a collection of UserInfo objects from a NamingEnumeration after
 * a search is carried out.//  w ww  .  j a v a 2  s.com
 */
static Vector getUserInfosFromSearchResults(NamingEnumeration p_SearchResults) throws NamingException {

    Vector userInfoList = new Vector();
    while (p_SearchResults.hasMoreElements()) {
        /* Next directory entry */
        Object searchResultObj = p_SearchResults.nextElement();
        if (searchResultObj instanceof SearchResult) {
            SearchResult tempSearchResult = (SearchResult) searchResultObj;
            Attributes entry = tempSearchResult.getAttributes();
            userInfoList.addElement(getUserInfoFromLDAPEntry(entry));
        }
    }
    p_SearchResults.close();

    return userInfoList;
}

From source file:org.apache.jetspeed.services.resources.VariableResourcesService.java

/**
 * The purpose of this method is to get the configuration resource
 * with the given name as a vector, or a default value.
 *
 * @param name The resource name./*from ww w.j  a v a2s.  c  om*/
 * @param def The default value of the resource.
 * @return The value of the resource as a vector.
 */
public Vector getVector(String name, Vector def) {
    Vector std = getVector(name);
    if (std == null) {
        if (def != null) {
            std = new Vector();
            Enumeration en = def.elements();
            while (en.hasMoreElements()) {
                std.addElement(substituteString((String) en.nextElement()));
            }
        }
    }

    return std;
}

From source file:net.nosleep.superanalyzer.analysis.views.PlayCountView.java

private void refreshDataset() {

    Stat itemStats = null;//from  w w  w.j av  a2s . co m

    if (_comboBox == null) {
        itemStats = _analysis.getStats(Analysis.KIND_TRACK, null);
    } else {
        ComboItem item = (ComboItem) _comboBox.getSelectedItem();
        itemStats = _analysis.getStats(item.getKind(), item.getValue());
    }

    Vector playCountList = new Vector();

    Hashtable playCounts = itemStats.getPlayCounts();
    Enumeration e = playCounts.keys();
    while (e.hasMoreElements()) {
        Integer playCount = (Integer) e.nextElement();
        Integer count = (Integer) playCounts.get(playCount);
        if (count.intValue() > 0)
            playCountList.addElement(new PlayCountItem(playCount.intValue(), count.intValue()));
    }
    Collections.sort(playCountList, new PlayCountComparator());

    XYSeries series = new XYSeries(Misc.getString("PLAY_COUNT"));

    for (int i = 0; i < playCountList.size(); i++) {
        PlayCountItem item = (PlayCountItem) playCountList.elementAt(i);
        series.add(item.PlayCount, item.Count);
    }

    collection.removeAllSeries();

    collection.addSeries(series);

}

From source file:com.globalsight.everest.usermgr.UserLdapHelper.java

/**
 * Generates a collection of User objects from a NamingEnumeration after a
 * search is carried out.//from ww  w  .  j  a va2  s  .  com
 */
static Vector<User> getUsersFromSearchResults(NamingEnumeration p_SearchResults) throws NamingException {

    Vector<User> userList = new Vector<User>();
    while (p_SearchResults.hasMoreElements()) {
        /* Next directory entry */
        Object searchResultObj = p_SearchResults.nextElement();
        if (searchResultObj instanceof SearchResult) {
            SearchResult tempSearchResult = (SearchResult) searchResultObj;
            Attributes entry = tempSearchResult.getAttributes();
            userList.addElement(getUserFromLDAPEntry(entry));
        }
    }

    p_SearchResults.close();
    return userList;
}

From source file:OutputApplet.java

/**
  * The "run" method is called from the worker thread.  Notice that
  * because this method is doing potentially slow databases accesses
  * we avoid making it a synchronized method.
  *///from  w w  w  .  j  a va2  s  .c  o  m

 public void run() {
     String url = "jdbc:mySubprotocol:myDataSource";
     String query = "select COF_NAME, PRICE from COFFEES";

     try {
         Class.forName("myDriver.ClassName");
     } catch (Exception ex) {
         setError("Can't find Database driver class: " + ex);
         return;
     }

     try {
         Vector results = new Vector();
         Connection con = DriverManager.getConnection(url, "myLogin", "myPassword");
         Statement stmt = con.createStatement();
         ResultSet rs = stmt.executeQuery(query);
         while (rs.next()) {
             String s = rs.getString("COF_NAME");
             float f = rs.getFloat("PRICE");
             String text = s + "     " + f;
             results.addElement(text);
         }

         stmt.close();
         con.close();

         setResults(results);

     } catch (SQLException ex) {
         setError("SQLException: " + ex);
     }
 }

From source file:com.xpn.xwiki.plugin.svg.SVGPlugin.java

protected String[] expandSources(Vector sources) {
    Vector expandedSources = new Vector();
    Iterator iter = sources.iterator();
    while (iter.hasNext()) {
        String v = (String) iter.next();
        File f = new File(v);
        if (f.exists() && f.isDirectory()) {
            File[] fl = f.listFiles(new SVGConverter.SVGFileFilter());
            for (File element : fl) {
                expandedSources.addElement(element.getPath());
            }/*from   ww  w  .j a  v  a 2 s  .co m*/
        } else {
            expandedSources.addElement(v);
        }
    }

    String[] s = new String[expandedSources.size()];
    expandedSources.copyInto(s);
    return s;
}

From source file:edu.tufts.osidimpl.repository.fedora_2_2.Repository.java

/**     Get the InfoStructures that this AssetType must support.  InfoStructures are used to categorize information about Assets.  Iterators return a set, one at a time.  The Iterator's hasNext method returns true if there are additional objects available; false otherwise.  The Iterator's next method returns the next object.
 *     @return InfoStructureIterator  The order of the objects returned by the Iterator is not guaranteed.
 *     @throws RepositoryException if there is a general failure
 *///from   ww w  .  ja  v  a 2  s.c  o m
public org.osid.repository.RecordStructureIterator getMandatoryRecordStructures(org.osid.shared.Type assetType)
        throws org.osid.repository.RepositoryException {
    java.util.Vector v = new java.util.Vector();
    v.addElement(new ImageRecordStructure(this));
    return new RecordStructureIterator(v);
}

From source file:edu.indiana.lib.osid.base.repository.http.Asset.java

public org.osid.shared.ObjectIterator getPartValuesByPartStructure(org.osid.shared.Id partStructureId)
        throws org.osid.repository.RepositoryException {
    if (partStructureId == null) {
        throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT);
    }//from  w  ww. ja v  a 2  s  . co  m
    try {
        java.util.Vector results = new java.util.Vector();
        org.osid.repository.PartIterator partIterator = getPartsByPartStructure(partStructureId);
        while (partIterator.hasNextPart()) {
            org.osid.repository.Part part = partIterator.nextPart();
            results.addElement(part.getValue());
        }
        return new ObjectIterator(results);
    } catch (Throwable t) {
        _log.error(t.getMessage());
        throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED);
    }
}