List of usage examples for java.util Vector Vector
public Vector()
From source file:Main.java
/** Return a list of all the children of a given node with a specific name/* ww w .j av a 2 s. c o m*/ */ static public Vector<Node> findAllChildren(Node node, String child_name) { if (node == null) return null; Vector<Node> found_children = new Vector<Node>(); NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeName().equals(child_name)) found_children.add(child); } return found_children; }
From source file:com.yahoo.messenger.data.json.IgnoredUserList.java
public void unserializeJSON(JSONArray a) throws JSONException { Vector v = new Vector(); // Mandatory fields for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); IgnoredUser c = new IgnoredUser(); c.unserializeJSON(o.getJSONObject("ignoredUser")); v.addElement(c);// w w w. j a v a2 s .com } ignoredUsers = new IgnoredUser[v.size()]; v.copyInto(ignoredUsers); }
From source file:eu.planets_project.tb.utils.XCDLParser.java
/** * //from www . j a va 2 s . c o m * @param xcdlDoc * @return * @throws XPathExpressionException */ public static List<MeasurementImpl> parseXCDL(Document xcdlDoc) throws XPathExpressionException { List<MeasurementImpl> props = new Vector<MeasurementImpl>(); XPath xpath = XPathFactory.newInstance().newXPath(); NodeList nodes = (NodeList) xpath.evaluate("/*//property", xcdlDoc, XPathConstants.NODESET); for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); String name = (String) xpath.evaluate("./name", n, XPathConstants.STRING); String id = (String) xpath.evaluate("./name/@id", n, XPathConstants.STRING); // Loop through the property definitions and patch them into Property objects. MeasurementImpl m = new MeasurementImpl(makePropertyUri(id, name), (String) xpath.evaluate("./valueSet/labValue/val", n, XPathConstants.STRING)); // FIXME Unify this construction: See also XCDLService.createPropertyFromFFProp // m.setType( "xcdl:" + (String) xpath.evaluate( "./valueSet/labValue/type", n, XPathConstants.STRING) ); props.add(m); } return props; }
From source file:StringUtil.java
/** * Split the source into two strings at the first occurrence of the splitter Subsequent occurrences are not treated specially, and may be part of the second string. * //from w w w . j a va2s . co m * @param source * The string to split * @param splitter * The string that forms the boundary between the two strings returned. * @return An array of two strings split from source by splitter. */ public static String[] splitFirst(String source, String splitter) { // hold the results as we find them Vector rv = new Vector(); int last = 0; int next = 0; // find first splitter in source next = source.indexOf(splitter, last); if (next != -1) { // isolate from last thru before next rv.add(source.substring(last, next)); last = next + splitter.length(); } if (last < source.length()) { rv.add(source.substring(last, source.length())); } // convert to array return (String[]) rv.toArray(new String[rv.size()]); }
From source file:com.yahoo.messenger.data.notification.json.BuddyInfoContactList.java
public void unserializeJSON(JSONArray a) throws JSONException { Vector v = new Vector(); // Mandatory fields for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); BuddyInfoContact c = new BuddyInfoContact(); c.unserializeJSON(o);//from w w w . ja v a 2 s.c om v.addElement(c); } buddyInfoContacts = new BuddyInfoContact[v.size()]; v.copyInto(buddyInfoContacts); }
From source file:com.yahoo.messenger.data.json.ClientCapabilityList.java
public void unserializeJSON(JSONArray a) throws JSONException { Vector v = new Vector(); // Mandatory fields for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); ClientCapability c = new ClientCapability(); c.unserializeJSON(o.getJSONObject("clientCapability")); v.addElement(c);/* ww w . j a v a2 s. c o m*/ } clientCapabilities = new ClientCapability[v.size()]; v.copyInto(clientCapabilities); }
From source file:Main.java
/** * getStringListFromXPath//from ww w . jav a 2 s .com * Gets a list of strings from an xml. * @param rootNodeExpression Evaluated on the root of the sqlconfig document to get a single Node. * @param listExpression Evaluated on the Node returned by rootNodeExpression, gets a NodeList. * @return A list of the text contents of the NodeList returned by evaluating the listExpression. */ public static List<String> getStringListFromXPath(Document doc, XPath xpath, String rootNodeExpression, String listExpression) { synchronized (xpath) { try { return getStringListFromXPath((Node) xpath.evaluate(rootNodeExpression, doc, XPathConstants.NODE), xpath, listExpression); } catch (Exception e) { System.err.println("Error evaluating xpath expression: " + rootNodeExpression); e.printStackTrace(); } return new Vector<String>(); } }
From source file:Main.java
public static synchronized Element[] getChildElements(Element element, String childName) { if (element == null || childName == null || childName.length() == 0) { return null; }/*from www .j av a 2s. c o m*/ Vector childs = new Vector(); for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) { if (node instanceof Element) { childs.add((Element) node); } } Element[] elmt = new Element[childs.size()]; childs.toArray(elmt); return elmt; }
From source file:JRadioButtonSelectedElements.java
public static Enumeration<String> getSelectedElements(Container container) { Vector<String> selections = new Vector<String>(); Component components[] = container.getComponents(); for (int i = 0, n = components.length; i < n; i++) { if (components[i] instanceof AbstractButton) { AbstractButton button = (AbstractButton) components[i]; if (button.isSelected()) { selections.addElement(button.getText()); }//from w ww. j ava 2 s . c o m } } return selections.elements(); }
From source file:com.mmone.gpdati.allotment.reader.AvailCrud.java
private static int modifyAllotment(XmlRpcClient client, java.util.Date dateStart, java.util.Date dateEnd, String action, int availability, int reservation, Integer invCode, Integer hotelCode) { Vector parameters = new Vector(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); parameters.add(new Integer(hotelCode)); //1 parameters.add(new Integer(invCode)); //2 //todo gestire con inventario unico -1 int rate = 1; ///fisso nr da verificare per iu parameters.add(new Integer(rate)); //3 offerta parameters.add(new Integer(availability)); //4 disponibilit parameters.add(new Integer(reservation)); //5 prenotazione parameters.add(action); //6 Azione : set,increase,decrease parameters.add(df.format(dateStart).toString()); //7 parameters.add(df.format(dateEnd).toString()); //8 Vector result = new Vector(); int ret = XRPC_SET_ALLOTMENT_RESULT_ERROR; String logData = "hotelCode=" + hotelCode + " - invCode=" + invCode + " - offerta=" + rate + " - availability=" + availability + " - reservation=" + reservation + " - action=" + action + " - dateStart=" + df.format(dateStart).toString() + " - dateEnd=" + df.format(dateEnd).toString() ;/*from ww w . jav a 2 s . c o m*/ Logger.getLogger("AvailCrud").log(Level.INFO, logData); try { result = (Vector) client.execute("backend.modifyAllotment", parameters); } catch (Exception e) { Logger.getLogger("AvailCrud").log(Level.SEVERE, "", e); // addError(ResponseBuilder.EWT_UNKNOWN, ResponseBuilder.ERR_SYSTEM_ERROR, "Error on updating allotment (modifyAllotment)"); return ret; } try { Map hret = (Map) result.get(0); ret = new Integer((String) hret.get("unique_allotment_service_response")); } catch (Exception e) { } Map hret = (Map) result.get(0); ret = new Integer((String) hret.get("unique_allotment_service_response")); Logger.getLogger("AvailCrud").log(Level.INFO, "Xrpc done "); return ret; }