List of usage examples for java.util Vector addElement
public synchronized void addElement(E obj)
From source file:net.sourceforge.floggy.persistence.fr2935390.FR2935390Test.java
/** * DOCUMENT ME!//from w w w .j ava 2 s.c om * * @param quantity DOCUMENT ME! * * @return DOCUMENT ME! */ protected Vector buildOrderedPersons(int quantity) { Vector vector = new Vector(quantity); for (int i = 0; i < quantity; i++) { Bird bird = new Bird(); String color = "color" + i; bird.setColor(color); vector.addElement(bird); } return vector; }
From source file:edu.ku.brc.specify.dbsupport.customqueries.WebStatsTaxonCustomQuery.java
public List<QueryResultsContainerIFace> getQueryDefinition() { Vector<QueryResultsContainerIFace> list = new Vector<QueryResultsContainerIFace>(); for (int i = 1; i < 6; i++) { QueryResultsContainer ndbrc = new QueryResultsContainer( "select Taxon" + i + ", TaxonCnt" + i + " from webstats"); ndbrc.add(new QueryResultsDataObj(1, 1)); ndbrc.add(new QueryResultsDataObj(1, 2)); list.addElement(ndbrc); }//from ww w .j av a 2 s . c o m return list; }
From source file:FileUtil.java
public Vector fileToVector(String fileName) { Vector v = new Vector(); String inputLine;//w w w .j a v a 2 s .c o m try { File inFile = new File(fileName); BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(inFile))); while ((inputLine = br.readLine()) != null) { v.addElement(inputLine.trim()); } br.close(); } // Try catch (FileNotFoundException ex) { // } catch (IOException ex) { // } return (v); }
From source file:de.betterform.xml.xforms.model.constraints.DependencyGraph.java
private void removeNonZeroVertices() { Vector nonzeros = new Vector(); Enumeration enumeration = vertices.elements(); while (enumeration.hasMoreElements()) { Vertex v = (Vertex) enumeration.nextElement(); if (v.inDegree > 0) { nonzeros.addElement(v); }//from w w w . j a v a2s . com } enumeration = nonzeros.elements(); while (enumeration.hasMoreElements()) { Vertex v = (Vertex) enumeration.nextElement(); this.removeVertex(v); } }
From source file:org.apache.roller.weblogger.webservices.xmlrpc.MetaWeblogAPIHandler.java
private Hashtable createPostStruct(WeblogEntry entry, String userid) { String permalink = WebloggerRuntimeConfig.getAbsoluteContextURL() + entry.getPermaLink(); Hashtable struct = new Hashtable(); struct.put("title", entry.getTitle()); if (entry.getLink() != null) { struct.put("link", Utilities.escapeHTML(entry.getLink())); }//ww w .j a v a 2 s . c o m struct.put("description", entry.getText()); if (entry.getPubTime() != null) { struct.put("pubDate", entry.getPubTime()); struct.put("dateCreated", entry.getPubTime()); } struct.put("guid", Utilities.escapeHTML(permalink)); struct.put("permaLink", Utilities.escapeHTML(permalink)); struct.put("postid", entry.getId()); struct.put("userid", entry.getCreator().getUserName()); struct.put("author", entry.getCreator().getEmailAddress()); Vector catArray = new Vector(); catArray.addElement(entry.getCategory().getPath()); struct.put("categories", catArray); return struct; }
From source file:net.hardisonbrewing.signingserver.ui.CodSigningScreen.java
public CodSigningScreen(JAD jad, SigningAuthority[] signingAuthorities) { this.jad = jad; this.signingAuthorities = signingAuthorities; COD[] cods = jad.getCODs();/*w w w .jav a 2 s .co m*/ signingAttempts = new SigningAttempt[cods.length * signingAuthorities.length]; authoritySigningAttempts = new Hashtable(); for (int i = 0, k = 0; i < cods.length; i++) { for (int j = 0; j < signingAuthorities.length; j++) { SigningAttempt signingAttempt = new SigningAttempt(); signingAttempt.cod = cods[i]; signingAttempt.signingAuthority = signingAuthorities[j]; String signingAuthorityKey = signingAttempt.signingAuthority.key; Vector vector = (Vector) authoritySigningAttempts.get(signingAuthorityKey); if (vector == null) { vector = new Vector(); authoritySigningAttempts.put(signingAuthorityKey, vector); } vector.addElement(signingAttempt); signingAttempts[k++] = signingAttempt; } } listField = new ListField(); listField.setCallback(new MyListFieldCallback()); listField.setSize(signingAttempts.length); listField.setRowHeight(30); add(listField); }
From source file:edu.ku.brc.specify.dbsupport.customqueries.WebStatsVisitorsCustomQuery.java
public List<QueryResultsContainerIFace> getQueryDefinition() { Vector<QueryResultsContainerIFace> list = new Vector<QueryResultsContainerIFace>(); for (int i = 1; i < 7; i++) { QueryResultsContainer ndbrc = new QueryResultsContainer( "select UniqueVisitorsMon" + i + ", UniqueVisitors" + i + " from webstats"); ndbrc.add(new QueryResultsDataObj(1, 1)); ndbrc.add(new QueryResultsDataObj(1, 2)); list.addElement(ndbrc); }/*ww w. ja va2 s.c om*/ return list; }
From source file:BRHInit.java
public void showVPSPrompt(JSONArray vps) throws Exception { vps_list = vps;//from w w w.ja v a 2 s . c om if (vps_list_window == null) { vps_list_window = new JFrame("BRH Console"); vps_list_window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel top_panel = new JPanel(); vps_list_window.getContentPane().add(top_panel); top_panel.setLayout(new BoxLayout(top_panel, BoxLayout.Y_AXIS)); top_panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); Vector values = new Vector(); for (int idx = 0; idx < vps_list.length(); ++idx) { JSONArray row = vps_list.getJSONArray(idx); values.addElement(row.getString(1)); } vps_list_box = new JList(values); top_panel.add(new JScrollPane(vps_list_box)); vps_list_box.setVisibleRowCount(10); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); JPanel col_panel = new JPanel(); p.add(col_panel); col_panel.setLayout(new BoxLayout(col_panel, BoxLayout.Y_AXIS)); col_panel.add(new JLabel("email")); col_panel.add(Box.createRigidArea(new Dimension(0, 5))); col_panel.add(new JLabel("password")); p.add(Box.createRigidArea(new Dimension(5, 0))); col_panel = new JPanel(); p.add(col_panel); col_panel.setLayout(new BoxLayout(col_panel, BoxLayout.Y_AXIS)); col_panel.add(email = new JTextField(20)); col_panel.add(Box.createRigidArea(new Dimension(0, 5))); col_panel.add(password = new JPasswordField()); top_panel.add(Box.createRigidArea(new Dimension(0, 10))); p = new JPanel(); top_panel.add(p); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(Box.createHorizontalGlue()); p.add(vps_list_ok = new JButton("OK")); p.add(Box.createRigidArea(new Dimension(5, 0))); p.add(vps_list_cancel = new JButton("Cancel")); p.add(Box.createHorizontalGlue()); vps_list_ok.addActionListener(this); vps_list_cancel.addActionListener(this); vps_list_window.pack(); } vps_list_window.setVisible(true); }
From source file:AppletFinder.java
public String[] findApplets(URL u) { BufferedReader inrdr = null;// w w w . j ava 2s. co m Vector v = new Vector(); char thisChar = 0; try { inrdr = new BufferedReader(new InputStreamReader(u.openStream())); int i; while ((i = inrdr.read()) != -1) { thisChar = (char) i; if (thisChar == '<') { String tag = readTag(inrdr); // System.out.println("TAG: " + tag); if (tag.toUpperCase().startsWith("<APPLET")) v.addElement(tag); } } inrdr.close(); } catch (IOException e) { System.err.println("Error reading from main URL: " + e); } String applets[] = new String[v.size()]; v.copyInto(applets); return applets; }
From source file:org.apache.tomcat.util.IntrospectionUtils.java
/** * Add elements from the classpath <i>cp </i> to a Vector <i>jars </i> as * file URLs (We use Vector for JDK 1.1 compat). * <p>/*w ww .ja v a2s . c om*/ * * @param jars The jar list * @param cp a String classpath of directory or jar file elements * separated by path.separator delimiters. * @throws IOException If an I/O error occurs * @throws MalformedURLException Doh ;) */ public static void addJarsFromClassPath(Vector jars, String cp) throws IOException, MalformedURLException { String sep = System.getProperty("path.separator"); String token; StringTokenizer st; if (cp != null) { st = new StringTokenizer(cp, sep); while (st.hasMoreTokens()) { File f = new File(st.nextToken()); String path = f.getCanonicalPath(); if (f.isDirectory()) { path += "/"; } URL url = new URL("file", "", path); if (!jars.contains(url)) { jars.addElement(url); } } } }