List of usage examples for java.util Vector addElement
public synchronized void addElement(E obj)
From source file:maui.main.MauiModelBuilder.java
/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options */// w ww .j a v a2 s .co m public Enumeration<Option> listOptions() { Vector<Option> newVector = new Vector<Option>(12); newVector.addElement(new Option("\tSpecifies name of directory.", "l", 1, "-l <directory name>")); newVector.addElement(new Option("\tSpecifies name of model.", "m", 1, "-m <model name>")); newVector.addElement(new Option("\tSpecifies vocabulary name.", "v", 1, "-v <vocabulary name>")); newVector.addElement(new Option("\tSpecifies vocabulary format (text or skos or none).", "f", 1, "-f <vocabulary format>")); newVector.addElement(new Option("\tSpecifies document language (en (default), es, de, fr).", "i", 1, "-i <document language>")); newVector.addElement(new Option("\tSpecifies encoding.", "e", 1, "-e <encoding>")); newVector.addElement(new Option("\tSpecifies wikipedia database and server.", "w", 1, "-w <wikipediaDatabase@wikipediaServer>")); newVector.addElement(new Option("\tTurns debugging mode on.", "d", 0, "-d")); newVector.addElement(new Option("\tSets the maximum phrase length (default: 5).", "x", 1, "-x <length>")); newVector.addElement(new Option("\tSets the minimum phrase length (default: 1).", "y", 1, "-y <length>")); newVector.addElement(new Option("\tSet the minimum number of occurences (default: 2).", "o", 1, "-o")); newVector.addElement(new Option("\tSets the list of stopwords to use (default: StopwordsEnglish).", "s", 1, "-s <name of stopwords class>")); newVector.addElement(new Option("\tSet the stemmer to use (default: SremovalStemmer).", "t", 1, "-t <name of stemmer class>")); return newVector.elements(); }
From source file:eionet.eunis.stripes.actions.CountryFactsheetActionBean.java
/** * * *//*w w w . jav a 2 s . c o m*/ private void loadDesignations() { ArrayList<Long> noSitesA = new ArrayList<Long>(); ArrayList<Long> areaTotalA = new ArrayList<Long>(); ArrayList<Long> areaTotalOverlapA = new ArrayList<Long>(); Connection con = null; SQLUtilities sqlUtilities = getContext().getSqlUtilities(); try { con = sqlUtilities.getConnection(); populateDesignations(con, noSitesA, areaTotalA); populateOverlaps(con, areaTotalOverlapA); for (int j = 0; j < noSitesA.size(); j++) { Vector values = new Vector(); if (noSitesA.get(j).longValue() != 0) { values.addElement(noSitesA.get(j)); } else { values.addElement(new Long(0)); } if (!areaTotalA.isEmpty() && areaTotalA.get(j).longValue() != 0) { if (!areaTotalOverlapA.isEmpty() && areaTotalOverlapA.get(j).longValue() != 0) { values.addElement((areaTotalA.get(j) - areaTotalOverlapA.get(j) < 0 ? new Long(0) : (areaTotalA.get(j) - areaTotalOverlapA.get(j)))); } else { values.addElement(areaTotalA.get(j)); } } else { values.addElement(new Long(0)); } designationsValues.add(values); } } catch (Exception e) { e.printStackTrace(); } finally { SQLUtilities.closeAll(con, null, null); } }
From source file:net.wastl.webmail.xml.XMLSystemData.java
public WebMailVirtualDomain getVirtualDomain(String domname) { // Check if virtual domains are disabled if (getVirtuals() == false) { // No, default to localhost return new WebMailVirtualDomain() { public String getDomainName() { return "localhost"; }/*www. ja v a2 s . co m*/ public void setDomainName(String name) throws Exception { log.error("Ignoring DefaultDomain.setDomainName(). " + "Should not call this method."); } public String getDefaultServer() { return "localhost"; } public void setDefaultServer(String name) { log.error("Ignoring DefaultDomain.setDomainServer(). " + "Should not call this method."); } public String getAuthenticationHost() { return "localhost"; } public void setAuthenticationHost(String name) { log.error("Ignoring DefaultDomain.setAuthenticationHost(). " + "Should not call this method."); } public boolean isAllowedHost(String host) { return true; } public void setAllowedHosts(String hosts) { log.error("Ignoring DefaultDomain.setAllowedHosts(). " + "Should not call this method."); } public Enumeration<String> getAllowedHosts() { return new Enumeration<String>() { int i = 0; public boolean hasMoreElements() { return i < 1; } public String nextElement() { i++; return "localhost"; } }; } public void setHostsRestricted(boolean b) { log.error("Ignoring DefaultDomain.setHostsRestricted(). " + "Should not call this method."); } public boolean getHostsRestricted() { return false; } public String getImapBasedir() { return null; } }; } // Virtual domains are allowed, get that wanted one NodeList nodel = sysdata.getElementsByTagName("DOMAIN"); Element elem = null; int j; for (j = 0; j < nodel.getLength(); j++) { elem = (Element) nodel.item(j); elem.normalize(); NodeList namel = elem.getElementsByTagName("NAME"); if (namel.getLength() > 0) { if (XMLCommon.getElementTextValue((Element) namel.item(0)).equals(domname)) { break; } } } if (j < nodel.getLength() && elem != null) { final Element domain = elem; return new WebMailVirtualDomain() { public String getDomainName() { String value = XMLCommon.getTagValue(domain, "NAME"); return value == null ? "unknown" : value; } public void setDomainName(String name) throws Exception { XMLCommon.setTagValue(domain, "NAME", name, true, "Virtual Domain names must be unique!"); } public String getDefaultServer() { String value = XMLCommon.getTagValue(domain, "DEFAULT_HOST"); return value == null ? "unknown" : value; } /* Override the IMAP base directory for this domain, * for imap and imaps protocols */ public String getImapBaseDir() { String value = XMLCommon.getTagValue(domain, "IMAP_BASEDIR"); return value == null ? "unknown" : value; } public void setDefaultServer(String name) { XMLCommon.setTagValue(domain, "DEFAULT_HOST", name); } public String getAuthenticationHost() { String value = XMLCommon.getTagValue(domain, "AUTHENTICATION_HOST"); return value == null ? "unknown" : value; } public void setAuthenticationHost(String name) { XMLCommon.setTagValue(domain, "AUTHENTICATION_HOST", name); } public boolean isAllowedHost(String host) { if (getHostsRestricted()) { Vector<String> v = new Vector<String>(); v.addElement(getDefaultServer()); Enumeration<String> e = getAllowedHosts(); while (e.hasMoreElements()) { v.addElement(e.nextElement()); } Enumeration<String> enumVar = v.elements(); while (enumVar.hasMoreElements()) { String next = enumVar.nextElement(); if (host.toUpperCase().endsWith(next.toUpperCase())) { return true; } } return false; } else { return true; } } public void setAllowedHosts(String hosts) { NodeList nl = domain.getElementsByTagName("ALLOWED_HOST"); for (int i = 0; i < nl.getLength(); i++) { domain.removeChild(nl.item(i)); } StringTokenizer tok = new StringTokenizer(hosts, ", "); while (tok.hasMoreElements()) { Element ahost = root.createElement("ALLOWED_HOST"); XMLCommon.setElementTextValue(ahost, tok.nextToken()); domain.appendChild(ahost); } } public Enumeration<String> getAllowedHosts() { final NodeList nl = domain.getElementsByTagName("ALLOWED_HOST"); return new Enumeration<String>() { int i = 0; public boolean hasMoreElements() { return i < nl.getLength(); } public String nextElement() { String value = XMLCommon.getElementTextValue((Element) nl.item(i++)); return value == null ? "error" : value; } }; } public void setHostsRestricted(boolean b) { NodeList nl = domain.getElementsByTagName("RESTRICTED"); for (int i = 0; i < nl.getLength(); i++) { domain.removeChild(nl.item(i)); } if (b) { domain.appendChild(root.createElement("RESTRICTED")); } } public boolean getHostsRestricted() { NodeList nl = domain.getElementsByTagName("RESTRICTED"); return nl.getLength() > 0; } public String getImapBasedir() { NodeList nl = domain.getElementsByTagName("IMAP_BASEDIR"); return ((nl.getLength() > 0) ? XMLCommon.getElementTextValue((Element) nl.item(0)) : null); } }; } else { return null; } }
From source file:netscape.security.pkcs.PKCS7.java
/** * Returns all signerInfos which self-verify. * * @param bytes the DER encoded content information. * * @exception NoSuchAlgorithmException on unrecognized algorithms. * @exception SignatureException on signature handling errors. *///from w ww . ja v a 2s . co m public SignerInfo[] verify(byte[] bytes) throws NoSuchAlgorithmException, SignatureException { Vector<SignerInfo> intResult = new Vector<SignerInfo>(); for (int i = 0; i < signerInfos.length; i++) { SignerInfo signerInfo = verify(signerInfos[i], bytes); if (signerInfo != null) { intResult.addElement(signerInfo); } } if (intResult.size() != 0) { SignerInfo[] result = new SignerInfo[intResult.size()]; intResult.copyInto(result); return result; } return null; }
From source file:org.apache.tomcat.util.IntrospectionUtils.java
public static void addToolsJar(Vector v) { try {/* w ww.ja va 2s . c om*/ // Add tools.jar in any case File f = new File(System.getProperty("java.home") + "/../lib/tools.jar"); if (!f.exists()) { // On some systems java.home gets set to the root of jdk. // That's a bug, but we can work around and be nice. f = new File(System.getProperty("java.home") + "/lib/tools.jar"); if (f.exists()) { if (log.isDebugEnabled()) log.debug("Detected strange java.home value " + System.getProperty("java.home") + ", it should point to jre"); } } URL url = new URL("file", "", f.getAbsolutePath()); v.addElement(url); } catch (MalformedURLException ex) { ex.printStackTrace(); } }
From source file:org.bench4Q.agent.rbe.EB.java
/** * @param html/*from w ww . j ava 2 s.c o m*/ * @param url * @param imgPat * @param srcPat * @param quotePat * @param imageRd */ public void findImg(String html, URL url, StringPattern imgPat, StringPattern srcPat, StringPattern quotePat, Vector<ImageReader> imageRd) { int cur = 0; while ((cur = imgPat.find(html, cur)) > -1) { cur = srcPat.find(html, imgPat.end() + 1); quotePat.find(html, srcPat.end() + 1); String imageURLString = html.substring(srcPat.end() + 1, quotePat.start()); imageRd.addElement(new ImageReader(url, imageURLString, buffer)); cur = quotePat.start() + 1; } }
From source file:com.symbian.driver.remoting.client.TestClient.java
/** * Update a test package to be sent to a remote master. * /*from w w w . jav a2s .c om*/ * @param aWorkingFolder * String a working directory * @param aTestPackage * String a test package name * @param aImage * String a image name * @param aPlatsec * true/false ON/OFF * * @return the name of the updated test package */ public String updatePackage(String aWorkingFolder, String aTestPackage, String aImage, boolean aPlatsec, boolean aSysbin, boolean aTestexec, String aTransport, String aRdebug, boolean aTefLite) { String lTPUpdatedName = "updated_" + aTestPackage; try { Zipper lZip = new Zipper(); File lWorkingFolder = new File(aWorkingFolder); File lTestPackageFile = new File(lWorkingFolder, aTestPackage); LOGGER.fine("Unzipping " + lTestPackageFile.toString() + " To: " + lWorkingFolder.toString()); // enumerate the contained files to be removed after being // repackaged Enumeration<? extends ZipEntry> lEnumer = (new ZipFile(lTestPackageFile)).entries(); Vector<String> lUnzippedFileNames = new Vector<String>(); while (lEnumer.hasMoreElements()) { String entryName = ((ZipEntry) lEnumer.nextElement()).getName(); lUnzippedFileNames.addElement(entryName); } LOGGER.fine("Unzipping " + lTestPackageFile.toString() + " To: " + lWorkingFolder.toString()); // unzip testpackage Zipper.Unzip(lTestPackageFile, lWorkingFolder); // update manifest BufferedWriter lBw = new BufferedWriter( new FileWriter(lWorkingFolder.getCanonicalPath() + File.separator + "Manifest.mf", true)); PrintWriter lPw = new PrintWriter(lBw); if (aImage != null) { lPw.println("romFile=" + aImage); } lPw.println("platsec=" + aPlatsec); if (aTransport != null) { lPw.println("transport=" + aTransport); } lPw.println("sysbin=" + aSysbin); lPw.println("statlite=" + aSysbin); lPw.println("teflite=" + aTefLite); lPw.println("testexec=" + aTestexec); if (aRdebug != null) { lPw.println("rdebug=" + aRdebug); } lPw.flush(); lPw.close(); lBw.close(); // add image (rom by the moment) if (aImage != null) { lZip.addFile(new File(lWorkingFolder.getCanonicalPath() + File.separator + aImage)); } // zip testpackage for (int i = 0; i < lUnzippedFileNames.size(); i++) { LOGGER.fine("Adding file : " + lWorkingFolder.toString() + " + " + lUnzippedFileNames.elementAt(i)); lZip.addFile( new File(lWorkingFolder.toString() + File.separator + lUnzippedFileNames.elementAt(i))); } LOGGER.fine("Zipping the updated package"); lZip.zip(new File(lWorkingFolder, lTPUpdatedName), lWorkingFolder.getCanonicalPath()); // delete all files previously unzipped in the working folder for (int i = 0; i < lUnzippedFileNames.size(); i++) { new File(lWorkingFolder + lUnzippedFileNames.elementAt(i)).delete(); } } catch (IOException lException) { LOGGER.log(Level.SEVERE, "Failed to update package. " + lException.getMessage(), lException); return null; } return lTPUpdatedName; }
From source file:edu.ku.brc.specify.dbsupport.customqueries.CatByPrev10YearsCustomQuery.java
public List<QueryResultsContainerIFace> getQueryDefinition() { int inc = 5;/*from ww w .ja v a 2s . co m*/ int year = Calendar.getInstance().get(Calendar.YEAR) - 1; Vector<QueryResultsContainerIFace> list = new Vector<QueryResultsContainerIFace>(); QueryResultsContainer ndbrc; for (int i = 0; i < 10; i++) { String sql = QueryAdjusterForDomain.getInstance().adjustSQL( "SELECT count(*) FROM collectionobject WHERE CollecionMemberID = COLMEMID AND YEAR(CatalogedDate) = " + year); ndbrc = new QueryResultsContainer(sql); ndbrc.add(new QueryResultsDataObj(createTitle(year, inc))); ndbrc.add(new QueryResultsDataObj(1, 1)); list.addElement(ndbrc); year -= inc; } return list; }
From source file:com.github.maven_nar.cpptasks.compiler.CommandLineCompiler.java
/** * Adds command-line arguments for include directories. * /*ww w .j av a 2 s. com*/ * If relativeArgs is not null will add corresponding relative paths * include switches to that vector (for use in building a configuration * identifier that is consistent between machines). * * @param baseDirPath * Base directory path. * @param includeDirs * Array of include directory paths * @param args * Vector of command line arguments used to execute the task * @param relativeArgs * Vector of command line arguments used to build the * configuration identifier */ protected void addIncludes(final String baseDirPath, final File[] includeDirs, final Vector<String> args, final Vector<String> relativeArgs, final StringBuffer includePathId, final boolean isSystem) { for (final File includeDir : includeDirs) { args.addElement(getIncludeDirSwitch(includeDir.getAbsolutePath(), isSystem)); if (relativeArgs != null) { final String relative = CUtil.getRelativePath(baseDirPath, includeDir); relativeArgs.addElement(getIncludeDirSwitch(relative, isSystem)); if (includePathId != null) { if (includePathId.length() == 0) { includePathId.append("/I"); } else { includePathId.append(" /I"); } includePathId.append(relative); } } } }
From source file:edu.ku.brc.specify.dbsupport.customqueries.PercentageGrowthCustomQuery.java
public List<QueryResultsContainerIFace> getQueryDefinition() { int numYears = 10; int year = Calendar.getInstance().get(Calendar.YEAR) - (numYears + 1); Vector<QueryResultsContainerIFace> list = new Vector<QueryResultsContainerIFace>(); QueryResultsContainer ndbrc;/*from w w w. j a va2 s .c o m*/ for (int i = 0; i < numYears; i++) { String sql = QueryAdjusterForDomain.getInstance().adjustSQL( "SELECT count(*) FROM collectionobject WHERE CollecionMemberID = COLMEMID AND YEAR(CatalogedDate) = " + year); ndbrc = new QueryResultsContainer(sql); ndbrc.add(new QueryResultsDataObj(Integer.toString(year))); ndbrc.add(new QueryResultsDataObj(1, 1)); list.addElement(ndbrc); year++; } return list; }