List of usage examples for java.util Vector addAll
public boolean addAll(Collection<? extends E> c)
From source file:org.talend.core.model.metadata.MetadataToolHelper.java
/** * /*from ww w . j a v a 2 s .co m*/ * qli Comment method "mapSpecialChar". * * */ private static String mapSpecialChar(String columnName) { if (GlobalServiceRegister.getDefault().isServiceRegistered(IRoutinesService.class)) { IRoutinesService service = (IRoutinesService) GlobalServiceRegister.getDefault() .getService(IRoutinesService.class); if (service != null) { Vector map = service.getAccents(); map.setElementAt("AE", 4);//$NON-NLS-1$ map.setElementAt("OE", 22);//$NON-NLS-1$ map.setElementAt("UE", 28);//$NON-NLS-1$ map.setElementAt("ss", 31);//$NON-NLS-1$ map.setElementAt("ae", 36);//$NON-NLS-1$ map.setElementAt("oe", 54);//$NON-NLS-1$ map.setElementAt("ue", 60);//$NON-NLS-1$ Vector addedMap = new Vector(); for (int i = 257; i < 304; i++) { addedMap.add(String.valueOf((char) i)); } map.addAll(addedMap); map.add("I");//$NON-NLS-1$ return initSpecificMapping(columnName, map); } } return columnName; }
From source file:org.mahasen.util.SearchUtil.java
/** * @param propertyTreeId//from w w w . j av a 2 s . c o m * @param initialValue * @param lastValue * @return * @throws InterruptedException * @throws MahasenException */ private Vector<Id> getResourceIdVector(Id propertyTreeId, String initialValue, String lastValue) throws InterruptedException, MahasenException { Vector<Id> resultantIds = new Vector<Id>(); TreeMap propertyTree = mahasenManager.lookupPropertyTreeDHT(propertyTreeId); if (propertyTree == null) { throw new MahasenException("Property not found"); } else { if (propertyTree.firstKey() instanceof String) { System.out.println("this is the property tree " + propertyTree); NavigableMap<String, Vector<Id>> resultMap = propertyTree.subMap(initialValue.toLowerCase(), true, lastValue.toLowerCase(), true); Iterator keys = resultMap.keySet().iterator(); while (keys.hasNext()) { resultantIds.addAll(resultMap.get(keys.next())); } } else if (propertyTree.firstKey() instanceof Integer) { System.out.println("this is the property tree " + propertyTree); NavigableMap<Integer, Vector<Id>> resultMap = propertyTree.subMap(Integer.valueOf(initialValue), true, Integer.valueOf(lastValue), true); Iterator keys = resultMap.keySet().iterator(); while (keys.hasNext()) { resultantIds.addAll(resultMap.get(keys.next())); } } } return resultantIds; }
From source file:gda.scan.ScanDataPoint.java
@Override public Vector<String> getNames() { Vector<String> allNames = new Vector<String>(); allNames.addAll(getScannableNames()); allNames.addAll(getDetectorNames()); return allNames; }
From source file:gda.scan.ScanDataPoint.java
/** * Returns the values held by this ScanDataPoint of Scannables, Monitors and Detectors. * //from w w w. j a va 2s . co m * @return an array of Double of length getMonitorHeader().size() + getPositionHeader().size() + * getDetectorHeader().size() if the conversion of a field to Double is not possible then the element of the * array will be null * @throws IllegalArgumentException * if the fields convert to too few values * @throws IndexOutOfBoundsException * if the fields convert to too many values */ @Override public Double[] getAllValuesAsDoubles() throws IllegalArgumentException, IndexOutOfBoundsException { if (allValuesAsDoubles == null) { Double[] scannablePosAsDoubles = getPositionsAsDoubles(); Double[] detectorDataAsDoubles = getDetectorDataAsDoubles(); Vector<Double> output = new Vector<Double>(); output.addAll(Arrays.asList(scannablePosAsDoubles)); output.addAll(Arrays.asList(detectorDataAsDoubles)); allValuesAsDoubles = output.toArray(new Double[] {}); } return allValuesAsDoubles; }
From source file:sos.net.SOSFTP.java
/** * return a listing of a directory in long format on * the remote machine// ww w. j a v a2s . c o m * @param pathname on remote machine * @return a listing of the contents of a directory on the remote machine * @exception Exception * @see #nList() * @see #nList( String ) * @see #dir() * @deprecated */ @Deprecated public Vector<String> dir(final String pathname, final int flag) throws Exception { Vector<String> fileList = new Vector<String>(); FTPFile[] listFiles = listFiles(pathname); for (FTPFile listFile : listFiles) { if (flag > 0 && listFile.isDirectory()) { fileList.addAll(this.dir(pathname + "/" + listFile.toString(), flag >= 1024 ? flag : flag + 1024)); } else { if (flag >= 1024) { fileList.add(pathname + "/" + listFile.toString()); } else { fileList.add(listFile.toString()); } } } return fileList; }
From source file:org.mahasen.node.MahasenNodeManager.java
/** * @param propertyName// w ww . jav a2 s.c o m * @param propertyValue * @return * @throws InterruptedException */ public Vector<Id> getSearchResults(String propertyName, String propertyValue) throws InterruptedException { final Vector<Id> resultIds = new Vector<Id>(); // block until we get a result or time out. final BlockFlag blockFlag = new BlockFlag(true, 1500); mahasenPastTreeApp.getSearchResults(propertyName, propertyValue, new Continuation() { public void receiveResult(Object result) { if (result != null) { if (resultIds.isEmpty()) { resultIds.addAll((Vector<Id>) result); } else { Vector<Id> tempIdSet = (Vector<Id>) result; for (Id id : tempIdSet) { if (!resultIds.contains(id)) { resultIds.add(id); } } } } blockFlag.unblock(); } public void receiveException(Exception exception) { System.out.println(" Result not found "); blockFlag.unblock(); } }); while (blockFlag.isBlocked()) { env.getTimeSource().sleep(10); } return resultIds; }
From source file:org.mahasen.node.MahasenNodeManager.java
/** * @param propertyName//from www. j a v a 2s . c o m * @param initialValue * @param lastValue * @return * @throws InterruptedException */ public Vector<Id> getRangeSearchResults(String propertyName, String initialValue, String lastValue) throws InterruptedException { final Vector<Id> resultIds = new Vector<Id>(); // block until we get a result or time out. final BlockFlag blockFlag = new BlockFlag(true, 1500); mahasenPastTreeApp.getRangeSearchResults(propertyName, initialValue, lastValue, new Continuation() { public void receiveResult(Object result) { if (result != null) { if (resultIds.isEmpty()) { resultIds.addAll((Vector<Id>) result); } else { Vector<Id> tempIdSet = (Vector<Id>) result; for (Id id : tempIdSet) { if (!resultIds.contains(id)) { resultIds.add(id); } } } } blockFlag.unblock(); } public void receiveException(Exception exception) { System.out.println(" Result not found "); blockFlag.unblock(); } }); while (blockFlag.isBlocked()) { env.getTimeSource().sleep(10); } return resultIds; }
From source file:org.apache.oodt.cas.workflow.gui.model.repo.XmlWorkflowModelRepository.java
private void ensureUniqueIds(Set<ModelGraph> graphs) { for (ModelGraph graph : graphs) { HashSet<String> names = new HashSet<String>(); Vector<ModelGraph> stack = new Vector<ModelGraph>(); stack.add(graph);//from w ww . ja v a 2 s. c om while (!stack.isEmpty()) { ModelGraph currentGraph = stack.remove(0); String currentId = currentGraph.getId(); for (int i = 1; names.contains(currentId); i++) { currentId = currentGraph.getId() + "-" + i; } names.add(currentId); if (!currentId.equals(currentGraph.getId())) { currentGraph.getModel().setModelId(currentId); } stack.addAll(currentGraph.getChildren()); } } }
From source file:org.apache.cocoon.servletservice.ServletServiceContext.java
public Enumeration getInitParameterNames() { Vector names = new Vector(); // add all names of the parent servlet context Enumeration enumeration = super.getInitParameterNames(); while (enumeration.hasMoreElements()) { names.add(enumeration.nextElement()); }//from www . ja v a2 s . c om // add names of the super servlet ServletContext superContext = this.getNamedContext(SUPER); if (superContext != null) { enumeration = superContext.getInitParameterNames(); while (enumeration.hasMoreElements()) { names.add(enumeration.nextElement()); } } // add property names of this servlet if (this.properties != null) { names.addAll(this.properties.keySet()); } return names.elements(); }
From source file:com.symbian.driver.core.controller.tasks.BuildTask.java
public Map<? extends Exception, ESeverity> execute(Task aTask, PreProcessor aSymbianDevice) { try {/* w ww . j a v a 2 s. c om*/ EList lComponenetNameList = iBuild.getComponentName(); File lGroupBuild = ModelUtils.checkPCPath(iBuild.getURI(), false)[0]; // get the version of SBS int sbsVersion = getSBSVersion(); String testbuild = iConfig.getPreference("testbuild"); // check the value of testbuild option if (testbuild.equals("auto")) { // use the value of the testbuild tag in .driver file isTestBuild = iBuild.isTestBuild(); } else if (testbuild.equals("true")) { // test build , ignoring the value of the testbuild tag isTestBuild = true; } else if (testbuild.equals("false")) { // build, ignoring the value of the testbuild tag isTestBuild = false; } else { isTestBuild = iBuild.isTestBuild(); } if (!iIsRBuild) { doBeforeBuild(lGroupBuild, isTestBuild, sbsVersion); } Pattern lExt = Pattern.compile( "^.*\\.((exe)|(app)|(dll)|(ani)|(ctl)|(fep)|(mdl)|(csy)|(ldd)|(pdd)|(prt)|(ecomiic)|(plugin))$"); // .exe, .app, .dll, .ani, .ctl, .fep, .mdl, .csy, .ldd, .pdd, .prt, // .ECOMIIC, .PLUGIN Vector<File> lTransferFileVector = null; // Run bldmake.bat if (lComponenetNameList.isEmpty()) { lTransferFileVector = doBuild(lGroupBuild, isTestBuild, null); } else { lTransferFileVector = new Vector<File>(); for (Iterator lComponenetIterator = lComponenetNameList.iterator(); lComponenetIterator .hasNext();) { String lComponent = (String) lComponenetIterator.next(); Vector<File> lTempTranfer = doBuild(lGroupBuild, isTestBuild, lComponent); lTransferFileVector.addAll(lTempTranfer); } } // Pickup ExecuteTransfer Set from abld -what for (File lTransferFile : lTransferFileVector) { String lName = lTransferFile.getName().toLowerCase(); if (lExt.matcher(lName).matches()) { String lTransferFileLiteral = lTransferFile.getCanonicalPath(); if (!lTransferFile.isFile()) { throw new IOException("The target file: " + lTransferFileLiteral + " could not be found."); } String lDestination = com.symbian.driver.core.environment.ILiterals.SYS_BIN + lTransferFile.getName(); if (lTransferFileLiteral.indexOf("\\z\\") >= 0) { lDestination = ILiterals.C + "\\" + lTransferFileLiteral.substring(lTransferFileLiteral.indexOf("\\z\\") + 3); } // Check for eclipsing Task lTask = ModelUtils.isFileEclipsing(lDestination, (Task) iBuild.eContainer().eContainer()); if (lTask != null) { String lErrorString = "The file " + lTransferFile + " will cause eclipsing as it has already been built in parent node " + lTask.getName(); LOGGER.log(Level.WARNING, lErrorString); iExceptions.put(new IOException(lErrorString), ESeverity.WARNING); continue; } // Calculate Destination String sisRoot = null; try { sisRoot = TDConfig.getInstance().getPreference("sisroot"); } catch (Exception e) { e.printStackTrace(); } String lSymbianPath = null; if (!sisRoot.equalsIgnoreCase("c:")) { lSymbianPath = sisRoot + "\\sys\\bin\\" + lTransferFile.getName(); } else { lSymbianPath = com.symbian.driver.core.environment.ILiterals.SYS_BIN + lTransferFile.getName(); } if (lTransferFileLiteral.contains("\\z\\")) { lSymbianPath = com.symbian.driver.core.environment.ILiterals.C + "\\" + lTransferFileLiteral.substring(lTransferFileLiteral.indexOf("z\\") + 2); } else if (lTransferFileLiteral.contains("\\data\\z\\")) { lSymbianPath = com.symbian.driver.core.environment.ILiterals.C + "\\" + lTransferFileLiteral.substring(lTransferFileLiteral.indexOf("z\\") + 2); } else if (lTransferFileLiteral.contains("\\data\\c\\")) { lSymbianPath = com.symbian.driver.core.environment.ILiterals.C + "\\" + lTransferFileLiteral.substring(lTransferFileLiteral.indexOf("c\\") + 2); } // Add file to Task boolean lAddToTaskSet = ((ExecuteTransferSet) aTask.getTransferSet()) .add(new ExecuteTransfer(lTransferFile, lSymbianPath)); if (!lAddToTaskSet) { LOGGER.warning("Could not add file to SIS package: " + lTransferFile.getAbsolutePath()); } } } } catch (IOException lIOException) { LOGGER.log(Level.SEVERE, "IO Exception during build: " + iBuild.getURI(), lIOException); iExceptions.put(lIOException, ESeverity.ERROR); } catch (TimeLimitExceededException lTimeLimitExceededException) { LOGGER.log(Level.WARNING, "Timeout exceeded, during build: " + iBuild.getURI(), lTimeLimitExceededException); iExceptions.put(lTimeLimitExceededException, ESeverity.ERROR); } catch (ParseException lParseException) { LOGGER.log(Level.SEVERE, "Could not get configuration settings for build: " + iBuild.getURI(), lParseException); iExceptions.put(lParseException, ESeverity.ERROR); } return iExceptions; }