List of usage examples for java.util Vector toString
public synchronized String toString()
From source file:Main.java
public static void main(String[] args) { Vector vec = new Vector(4); vec.add(4);//from ww w .j av a2s . com vec.add(3); vec.add(2); vec.add(1); // convert the contents into string System.out.println(vec.toString()); }
From source file:routercc8.DistanceVector.java
public static void main(String args[]) { DistanceVector d = new DistanceVector("B", ".\\src\\routercc8\\conf.ini"); Vector newmin = new Vector(); System.out.println("Start:" + d.mins.toString()); System.out.println(d.dv.toString()); d.recibeMinimo("A", "B", 3); d.recibeMinimo("A", "C", 23); newmin = d.calcular();//w w w . j a va2 s. co m if (!newmin.isEmpty()) { System.out.println("1nuevos Minimos: " + newmin.toString()); } System.out.println(d.mins.toString()); System.out.println(d.dv.toString()); d.recibeMinimo("C", "D", 5); d.recibeMinimo("C", "B", 2); d.recibeMinimo("C", "A", 23); newmin = d.calcular(); if (!newmin.isEmpty()) { System.out.println("2nuevos Minimos: " + newmin.toString()); } System.out.println(d.mins.toString()); System.out.println(d.dv.toString()); d.recibeMinimo("D", "C", 5); newmin = d.calcular(); if (!newmin.isEmpty()) { System.out.println("3nuevos Minimos: " + newmin.toString()); } System.out.println(d.mins.toString()); System.out.println(d.dv.toString()); System.out.println("T1"); System.out.println(); //T = 1; d.recibeMinimo("A", "C", 5); d.recibeMinimo("A", "D", 28); newmin = d.calcular(); if (!newmin.isEmpty()) { System.out.println("4nuevos Minimos: " + newmin.toString()); } System.out.println(d.mins.toString()); System.out.println(d.dv.toString()); d.recibeMinimo("C", "A", 5); newmin = d.calcular(); if (!newmin.isEmpty()) { System.out.println("5nuevos Minimos: " + newmin.toString()); } System.out.println(d.mins.toString()); System.out.println(d.dv.toString()); d.recibeMinimo("D", "A", 28); d.recibeMinimo("D", "B", 7); newmin = d.calcular(); if (!newmin.isEmpty()) { System.out.println("6nuevos Minimos: " + newmin.toString()); } System.out.println(d.mins.toString()); System.out.println(d.dv.toString()); //T=2 System.out.println("T2"); System.out.println(); d.recibeMinimo("D", "A", 10); newmin = d.calcular(); if (!newmin.isEmpty()) { System.out.println("7nuevos Minimos: " + newmin.toString()); } System.out.println(d.mins.toString()); System.out.println(d.dv.toString()); d.recibeMinimo("A", "D", 99); newmin = d.calcular(); if (!newmin.isEmpty()) { System.out.println("8nuevos Minimos: " + newmin.toString()); } System.out.println(d.mins.toString()); System.out.println(d.getMin("D")); System.out.println(d.dv.toString()); }
From source file:org.adl.samplerte.server.LMSPackageHandler.java
/**************************************************************************** **/* w ww . j av a 2 s. c om*/ ** Method: getListOfMetadata() ** Input: String zipFileName -- The name of the zip file to be used ** Output: String -- A comma delimited list of meta-data files. ** ** Description: This method takes in the name of a zip file and locates ** all files with an .xml extension an adds their names to a ** vector. The vector is then changed to a comma delimited ** string and returned to the caller. ** *****************************************************************************/ public static String getListOfMetadata(String zipFile) { if (_Debug) { System.out.println("***********************"); System.out.println("in getListOfMetadata() "); System.out.println("***********************\n"); } Vector mdVector = new Vector(); mdVector = locateMetadata(zipFile); String mdString = new String(); mdString = mdVector.toString(); if (_Debug) { System.out.println("**********************************************"); System.out.println("in getListOfMetadata(): String is " + mdString); System.out.println("**********************************************\n"); } return mdString; }
From source file:nl.nn.adapterframework.util.StringTagger.java
/** * Manually sets a multi-value value.//from w w w .j av a 2 s . c o m */ public void setValues(String token, Vector values) { tokens.put(token, values.toString()); multitokens.put(token, values); }
From source file:partes.service.Partes.java
/** * * * it returns an HashMap with a condition as key, and as value * an list of HashMap with {@link partes.refactorRunner.PartesInfo PartesInfo} as key * and the String (test) as value. /*from w w w . j a v a 2 s .c o m*/ * @throws BPMNmalformedException * @throws TestGenerationException * @throws JAXBException * @throws FileNotFoundException */ @Override public HashMap<String, HashMap<PartesInfo, String>> generateTestSuite() throws BPMNmalformedException, TestGenerationException, FileNotFoundException, JAXBException { log.info("started test suite generation for " + PartesMain.instance.bpmnPath); HashMap<String, HashMap<PartesInfo, String>> xmlTests = new HashMap<String, HashMap<PartesInfo, String>>(); // #### STEP 1 ##### create the InteractionTrees HashMap<String, Tree> step1 = this.getcTreeGenerator().buildInteractionTrees(PartesMain.instance.bpmnPath); log.info("built interaction trees of " + step1.keySet().size() + " conditions"); if (PartesMain.instance.debug) { XStream xstream = new XStream(); String xml = xstream.toXML(step1); WriteToFile.writeToANewFileInOutputDir("TestSuite" + File.separator, PartesConf.getString("cmdline.tree_of_interaction_file"), xml.trim()); } /** * now, for each condition, we create projections and test pool. In the output folder * there will be one sub-folder for each condition. In each of theme there will be the * participants projections and the test sequence generated. * The conditions are the children of the root. * @see partes.refactorRunner.InteractionTreeBuilder.getTreeOfInteraction() */ Set<String> conditions = step1.keySet(); Iterator<String> condIter = conditions.iterator(); //look for participants Vector<PartesInfo> participants = PartesMain.instance.servicesWsdlUrl; //+ PartesConf.getString("treeBuilder.participant_conf_file")); log.info("participants are: " + participants.toString()); Vector<String> services = new Vector<String>(); for (PartesInfo p : participants) { services.add(p.getModelImplClass()); } String[] servicesToSearch = new String[0]; servicesToSearch = services.toArray(servicesToSearch); while (condIter.hasNext()) { String condition = condIter.next(); XStream xstream = new XStream(); String xml = xstream.toXML(step1.get(condition)); Tree treeOfOneCondition = (Tree) xstream.fromXML(xml); //cloned tree // #### STEP 2 #### makes the projections Vector<ProjectionInfo> step2 = this.getpProjectionGenerator().makeProjection(treeOfOneCondition, servicesToSearch); log.info("built " + step2.size() + "[" + condition + "] projection trees for participants"); // #### STEP 3 #### makes SOAPui project for (ProjectionInfo pi : step2) { if (PartesMain.instance.debug) { XStream xstream2 = new XStream(); String xml2 = xstream2.toXML(pi.getProjectionTree()); WriteToFile.writeToANewFileInOutputDir("TestSuite" + File.separator + condition, "projection-" + pi.getService() + ".xml", xml2); } for (PartesInfo p : participants) { if (pi.getService().equals(p.getModelImplClass())) { String wsdlLocation = p.getWsdlLocation(); String portTypeToSearch = p.getPortTypeToSearch(); String xmlTest = ""; try { xmlTest = this.getpTestBuilder() .makeSOAPuiProject(pi.getProjectionTree(), portTypeToSearch, wsdlLocation) .getProjectDocument().toString(); } catch (XmlException e) { //e.printStackTrace(); System.out.println("Partes causes an XmlException!"); } catch (IOException e) { //e.printStackTrace(); System.out.println("Partes causes an IOException!"); } catch (SoapUIException e) { //e.printStackTrace(); System.out.println("Partes causes an SoapUIException!"); } if (xmlTests.get(condition) == null) { xmlTests.put(condition, new HashMap<PartesInfo, String>()); } xmlTests.get(condition).put(p, xmlTest); log.info("built SOAPui project for " + p.getPortTypeToSearch()); } } } } //#### STEP 4 #### make integration test with all the traces of that condition String xmlTest = ""; xmlTest = this.getpTestBuilder().makeSOAPuiProjectTracesTest(step1, participants).getProjectDocument() .toString(); HashMap<PartesInfo, String> hm = new HashMap<PartesInfo, String>(); hm.put(null, xmlTest); xmlTests.put("whole choreography traces", hm); return xmlTests; }
From source file:org.kepler.ssh.LocalDelete.java
/** * Recursively traverse the directories looking for matches on each level to * the relevant part of the mask. Matched files will be deleted. Matched * directories will be deleted only if 'recursive' is true. *///w w w .j a va 2 s .co m private boolean delete(File node, Vector masks, boolean recursive) { if (isDebugging) log.debug(">>> " + node.getPath() + " with masks length = " + masks.size() + ": " + masks.toString()); // the query is for a single file/dir --> it will be deleted now if (masks.isEmpty()) { return deleteNode(node, recursive, "Delete "); } // handle the case where path is not a directory but something else if (!node.isDirectory()) { if (node.isFile()) { // single file // this file cannot match the rest of the query mask return true; // this is not an error, just skip } else { // wildcardless mask referred to a non-existing file/dir log.error("Path " + node.getPath() + " is not a directory!"); return false; } } // path refers to an existing dir. // Let's list its content with the appropriate mask String localMask = null; Vector restMask = (Vector) masks.clone(); if (!masks.isEmpty()) { localMask = (String) masks.firstElement(); // first element as local // mask restMask.remove(0); // the rest } boolean result = true; // will become false if at least one file removal // fails // handle special masks . and .. separately if (localMask.equals(".") || localMask.equals("..")) { // we just need to call this method again with the next mask File newNode = new File(node, localMask); if (isDebugging) log.debug("Special case of " + localMask + " --> Call delete() with " + newNode.getPath()); result = delete(newNode, restMask, recursive); } else { // meaningful mask... so list the directory and recursively traverse // directories MyLocalFilter localFilter = new MyLocalFilter(localMask); // Get files matching the localMask in the dir 'node' File[] files = node.listFiles(localFilter); if (isDebugging) log.debug("Found " + files.length + " matching files in " + node); for (int i = 0; i < files.length; i++) { // recursive call with the rest of the masks boolean succ = delete(files[i], restMask, recursive); if (!succ && isDebugging) log.debug("Failed removal of " + files[i].getPath()); result = result && succ; } } if (isDebugging) log.debug("<<< " + node.getPath()); return result; }
From source file:org.kepler.kar.KARBuilder.java
public void generateKAR(TableauFrame tableauFrame, String overrideModDeps) throws IllegalActionException { if (isDebugging) log.debug("generateKAR()"); if (_karLSID == null) { try {/*ww w . j av a 2s . c o m*/ _karLSID = LSIDGenerator.getInstance().getNewLSID(); } catch (Exception e) { log.error("could not generate new LSID for KAR: " + e.getMessage()); e.printStackTrace(); } } try { // Get KAREntries for the Save Initiator List Hashtable<KAREntry, InputStream> initiatorEntries = handleInitiatorList(); addEntriesToPrivateItems(initiatorEntries); int pass = 1; // Loop through KAR Entry handlers until no more KAREntry objects // are returned Vector<KeplerLSID> previousPassEntryLSIDs = getKAREntryLSIDs(initiatorEntries); if (isDebugging) log.debug("Pass " + pass + " entries: " + previousPassEntryLSIDs.toString()); while (previousPassEntryLSIDs.size() > 0) { pass++; // Get the KAREntries from all of the handlers Hashtable<KAREntry, InputStream> entries = queryKAREntryHandlers(previousPassEntryLSIDs, tableauFrame); if (entries != null) { previousPassEntryLSIDs.removeAllElements(); if (isDebugging) log.debug("Pass " + pass + " entries: "); Vector<KeplerLSID> repeats = new Vector<KeplerLSID>(); for (KAREntry karEntryKey : entries.keySet()) { String entryName = karEntryKey.getName(); String entryType = karEntryKey.getType(); KeplerLSID entryLSID = karEntryKey.getLSID(); if (isDebugging) log.debug(entryName + " " + entryLSID + " " + entryType); if (_karItemLSIDs.contains(entryLSID)) { // TODO make sure existing Entry Handlers do not produce repeated LSIDs. // This should never happen. System.out.println("KARBuilder generateKAR() Trying to add " + entryName + " with " + "type:" + entryType + " but an entry with lsid:" + entryLSID + " has already " + "been added to KAR. Will NOT add this entry."); repeats.add(entryLSID); } else if (_karItemNames.contains(entryName)) { // TODO make sure existing Entry Handlers do not produce repeated LSIDs. // This should never happen. System.out.println("KARBuilder generateKAR() An entry with entryName" + entryName + " has already been added to KAR. Will NOT add this entry with lsid:" + entryLSID); repeats.add(entryLSID); } else { previousPassEntryLSIDs.add(entryLSID); } } // A kludge to protect against entry handlers returning entries that have already been added for (KeplerLSID repeatedLSID : repeats) { for (KAREntry ke : entries.keySet()) { if (ke.getLSID().equals(repeatedLSID)) { entries.remove(ke); if (isDebugging) log.debug("Removed " + repeatedLSID + " from pass " + pass + " entries"); break; } } } addEntriesToPrivateItems(entries); } } prepareManifest(overrideModDeps); writeKARFile(); } catch (Exception e) { throw new IllegalActionException("Error building the KAR file: " + e.getMessage()); } }
From source file:routercc8.DistanceVector.java
public DistanceVector() { this.nombre = "A"; String read;//w w w. j ava2 s .co m hasChanged = true; try { archivo = new BufferedReader(new FileReader("./src/routercc8/conf.ini")); while ((read = archivo.readLine()) != null) { String[] arr = read.split(":"); dv.add(nombre + ":" + arr[0] + ":" + arr[1]); adyacentes++; ady.put(arr[0], 0); //saber cuales son adyacentes mins.put(arr[0], arr[0] + ":" + arr[1]); //A-B:3 //A-C:23 } Vector newmin = new Vector(); System.out.println("Start:" + mins.toString()); System.out.println(dv.toString()); recibeMinimo("A", "B", 3); recibeMinimo("A", "C", 23); newmin = calcular(); if (!newmin.isEmpty()) { System.out.println("1nuevos Minimos: " + newmin.toString()); } System.out.println(mins.toString()); System.out.println(dv.toString()); recibeMinimo("C", "D", 5); recibeMinimo("C", "B", 2); recibeMinimo("C", "A", 23); newmin = calcular(); if (!newmin.isEmpty()) { System.out.println("2nuevos Minimos: " + newmin.toString()); } System.out.println(mins.toString()); System.out.println(dv.toString()); recibeMinimo("D", "C", 5); newmin = calcular(); if (!newmin.isEmpty()) { System.out.println("3nuevos Minimos: " + newmin.toString()); } System.out.println(mins.toString()); System.out.println(dv.toString()); System.out.println("T1"); System.out.println(); //T = 1; recibeMinimo("A", "C", 5); recibeMinimo("A", "D", 28); newmin = calcular(); if (!newmin.isEmpty()) { System.out.println("4nuevos Minimos: " + newmin.toString()); } System.out.println(mins.toString()); System.out.println(dv.toString()); recibeMinimo("C", "A", 5); newmin = calcular(); if (!newmin.isEmpty()) { System.out.println("5nuevos Minimos: " + newmin.toString()); } System.out.println(mins.toString()); System.out.println(dv.toString()); recibeMinimo("D", "A", 28); recibeMinimo("D", "B", 7); newmin = calcular(); if (!newmin.isEmpty()) { System.out.println("6nuevos Minimos: " + newmin.toString()); } System.out.println(mins.toString()); System.out.println(dv.toString()); //T=2 System.out.println("T2"); System.out.println(); recibeMinimo("D", "A", 10); newmin = calcular(); if (!newmin.isEmpty()) { System.out.println("7nuevos Minimos: " + newmin.toString()); } System.out.println(mins.toString()); System.out.println(dv.toString()); recibeMinimo("A", "D", 99); newmin = calcular(); if (!newmin.isEmpty()) { System.out.println("8nuevos Minimos: " + newmin.toString()); } System.out.println(mins.toString()); System.out.println(getMin("D")); System.out.println(dv.toString()); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.interpss.editor.ui.edit.dist.bus.NBLoadScheduleDialog.java
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed IpssLogger.getLogger().info("NBLoadScheduleDialog.okButtonActionPerformed() called"); Vector errMsg = new Vector(); try {//from w w w. j av a 2s . co m if (!saveEditor2Form(errMsg)) { EditorPluginSpringFactory.getEditorDialogUtil().showMsgDialog(this, "Load Schedule Data Error", errMsg); IpssLogger.getLogger().info("Load Schedule Data Error" + errMsg.toString()); return; } } catch (Exception e) { IpssLogger.logErr(e); EditorPluginSpringFactory.getEditorDialogUtil().showMsgDialog(this, "Load Schedule Data Error", e.toString()); return; } setVisible(false); }
From source file:org.openqa.selenium.server.SeleniumDriverResourceHandler.java
public String doCommand(String cmd, Vector<String> values, String sessionId, HttpResponse res) { log.info("Command request: " + cmd + values.toString() + " on session " + sessionId); String results = null;//from w w w . j ava 2 s . c om // handle special commands switch (SpecialCommand.getValue(cmd)) { case getNewBrowserSession: String browserString = values.get(0); String extensionJs = values.size() > 2 ? values.get(2) : ""; String browserConfigurations = values.size() > 3 ? values.get(3) : ""; try { sessionId = getNewBrowserSession(browserString, values.get(1), extensionJs, BrowserOptions.newBrowserOptions(browserConfigurations)); LoggingManager.perSessionLogHandler().attachToCurrentThread(new SessionId(sessionId)); setDomain(sessionId, values.get(1)); results = "OK," + sessionId; } catch (RemoteCommandException rce) { results = "Failed to start new browser session: " + rce; } catch (InvalidBrowserExecutableException ibex) { results = "Failed to start new browser session: " + ibex; } catch (IllegalArgumentException iaex) { results = "Failed to start new browser session: " + iaex; } catch (RuntimeException rte) { results = "Failed to start new browser session: " + rte; } // clear out any network traffic captured but never pulled back by the last client (this // feature only works with one concurrent browser, similar to PI mode) CaptureNetworkTrafficCommand.clear(); break; case testComplete: browserSessionFactory.endBrowserSession(sessionId, remoteControl.getConfiguration()); results = "OK"; break; case getLog: try { results = "OK," + LoggingManager.perSessionLogHandler().getLog(new SessionId(sessionId)); } catch (IOException ioex) { results = "Failed to get RC logs for the session: " + sessionId + " exception message: " + ioex.getMessage(); } break; case shutDownSeleniumServer: results = "OK"; shutDown(res); break; case getLogMessages: results = "OK," + logMessagesBuffer.toString(); logMessagesBuffer.setLength(0); break; case retrieveLastRemoteControlLogs: results = new RetrieveLastRemoteControlLogsCommand().execute(); break; case captureEntirePageScreenshotToString: results = new CaptureEntirePageScreenshotToStringCommand(values.get(0), sessionId).execute(); break; case captureScreenshot: results = new CaptureScreenshotCommand(values.get(0)).execute(); break; case captureScreenshotToString: results = new CaptureScreenshotToStringCommand().execute(); break; case captureNetworkTraffic: results = new CaptureNetworkTrafficCommand(values.get(0)).execute(); break; case addCustomRequestHeader: results = new AddCustomRequestHeaderCommand(values.get(0), values.get(1)).execute(); break; case keyDownNative: try { RobotRetriever.getRobot().keyPress(Integer.parseInt(values.get(0))); results = "OK"; } catch (Exception e) { log.log(Level.SEVERE, "Problem during keyDown: ", e); results = "ERROR: Problem during keyDown: " + e.getMessage(); } break; case keyUpNative: try { RobotRetriever.getRobot().keyRelease(Integer.parseInt(values.get(0))); results = "OK"; } catch (Exception e) { log.log(Level.SEVERE, "Problem during keyUp: ", e); results = "ERROR: Problem during keyUp: " + e.getMessage(); } break; case keyPressNative: try { Robot r = RobotRetriever.getRobot(); int keycode = Integer.parseInt(values.get(0)); r.keyPress(keycode); r.waitForIdle(); r.keyRelease(keycode); results = "OK"; } catch (Exception e) { log.log(Level.SEVERE, "Problem during keyDown: ", e); results = "ERROR: Problem during keyDown: " + e.getMessage(); } // TODO typeKeysNative. Requires converting String to array of keycodes. break; case isPostSupported: results = "OK,true"; break; case setSpeed: try { int speed = Integer.parseInt(values.get(0)); setSpeedForSession(sessionId, speed); } catch (NumberFormatException e) { return "ERROR: setSlowMode expects a string containing an integer, but saw '" + values.get(0) + "'"; } results = "OK"; break; case getSpeed: results = getSpeedForSession(sessionId); break; case addStaticContent: File dir = new File(values.get(0)); if (dir.exists()) { remoteControl.addNewStaticContent(dir); results = "OK"; } else { results = "ERROR: dir does not exist - " + dir.getAbsolutePath(); } break; case runHTMLSuite: HTMLLauncher launcher = new HTMLLauncher(remoteControl); File output = null; if (values.size() < 4) { results = "ERROR: Not enough arguments (browser, browserURL, suiteURL, multiWindow, [outputFile])"; } else { if (values.size() > 4) { output = new File(values.get(4)); } try { results = launcher.runHTMLSuite(values.get(0), values.get(1), values.get(2), output, remoteControl.getConfiguration().getTimeoutInSeconds(), "true".equals(values.get(3))); } catch (IOException e) { e.printStackTrace(); results = e.toString(); } } break; case launchOnly: if (values.size() < 1) { results = "ERROR: You must specify a browser"; } else { String browser = values.get(0); String newSessionId = generateNewSessionId(); BrowserLauncher simpleLauncher = browserLauncherFactory.getBrowserLauncher(browser, newSessionId, remoteControl.getConfiguration(), BrowserOptions.newBrowserOptions()); String baseUrl = "http://localhost:" + remoteControl.getPort(); remoteControl.registerBrowserSession( new BrowserSessionInfo(newSessionId, browser, baseUrl, simpleLauncher, null)); simpleLauncher.launchHTMLSuite("TestPrompt.html?thisIsSeleniumServer=true", baseUrl); results = "OK"; } break; case slowResources: String arg = values.get(0); boolean setting = true; if ("off".equals(arg) || "false".equals(arg)) { setting = false; } StaticContentHandler.setSlowResources(setting); results = "OK"; break; case attachFile: FrameGroupCommandQueueSet queue = getQueueSet(sessionId); try { File downloadedFile = downloadFile(values.get(1)); queue.addTemporaryFile(downloadedFile); results = queue.doCommand("type", values.get(0), downloadedFile.getAbsolutePath()); } catch (Exception e) { results = e.toString(); } break; case open: warnIfApparentDomainChange(sessionId, values.get(0)); case nonSpecial: results = new SeleniumCoreCommand(cmd, values, sessionId).execute(); } log.info(commandResultsLogMessage(cmd, sessionId, results)); return results; }