List of usage examples for java.util Vector add
public synchronized boolean add(E e)
From source file:Main.java
/** Returns an alphabetically sorted list of the keys. */ public static Vector getSortedKeyList(Hashtable hashtable) { Vector result = new Vector(); Enumeration keys = hashtable.keys(); while (keys.hasMoreElements()) { result.add(keys.nextElement()); }/*from w w w.ja va 2 s .c o m*/ Collections.sort(result, new Comparator() { public int compare(Object a, Object b) { String textA = a.toString(); String textB = b.toString(); return textA.compareToIgnoreCase(textB); } }); return result; }
From source file:Main.java
/** * The method return list of child elements. * /*from w ww.ja v a2 s . c o m*/ * @param parent an org.w3c.dom.Element object. * @return list of child elements. */ static public Vector getChildElements(Element parent) { if (parent == null) throw new IllegalArgumentException("Element can not be NULL"); Vector vect = new Vector(); Element elem = getFirstChild(parent); while (elem != null) { vect.add(elem); elem = getNextSibling(elem); } return vect; }
From source file:Main.java
/** * Check if the JTextField input is larger or equal than x * //from w w w .ja va2 s . c om * @param input the JTextField object * @param x parameter x * @return true or false */ public static boolean largeEqualThan(javax.swing.JTextField input, double x, Vector<String> errMsgList, String errMsg) throws Exception { boolean ok = largeEqualThan(input, x); if (!ok) errMsgList.add(errMsg); return ok; }
From source file:Main.java
public static Vector<String> loadScriptsFolder(String path) { File fileScript = new File(path); Vector<String> vec = new Vector(); File files[] = fileScript.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) vec.add(files[i].getName()); }//from w ww . jav a 2 s. c om return vec; }
From source file:Main.java
public static Vector<String> loadScriptsInFolder(String path) { File fileScript = new File(path); Vector<String> vec = new Vector(); File files[] = fileScript.listFiles(); for (int i = 0; i < files.length; i++) { if (!files[i].isDirectory()) vec.add(files[i].getAbsolutePath()); }/*w w w . j a va 2 s .c om*/ return vec; }
From source file:Main.java
public static synchronized String[] getElementValues(Element element) { if (element == null) { return null; }/*from w w w .j av a 2 s . co m*/ Vector childs = new Vector(); for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) { if (node instanceof Text) { childs.add(node.getNodeValue()); } } String[] values = new String[childs.size()]; childs.toArray(values); return values; }
From source file:Main.java
public static Vector<Node> findNodes(String xpath, Node scope) throws XPathExpressionException { XPathFactory xpf = XPathFactory.newInstance(); XPath xp = xpf.newXPath();// w ww. j a v a 2 s .c o m NodeList nl; Vector<Node> elements = new Vector<Node>(); nl = (NodeList) xp.evaluate(xpath, scope, XPathConstants.NODESET); for (int i = 0; i < nl.getLength(); i++) elements.add(nl.item(i)); return elements; }
From source file:Main.java
public static Vector arrayToVector(Object[][] list) { // Convert into a vector of vectors Vector v = new Vector(); Vector subVector = null; for (int i = 0; i < list.length; i++) { subVector = new Vector(); for (int j = 0; j < list[i].length; j++) { subVector.add(list[i][j]); }/*from w w w .ja v a2s . c o m*/ v.add(subVector); } return (v); }
From source file:Main.java
public static Vector findChildren(Node node, String elTag) { NodeList children = node.getChildNodes(); Vector items = new Vector(); for (int i = 0; i < children.getLength(); i++) { Node item = children.item(i); if (item.getNodeName().equals(elTag)) { items.add(item); }/*from w ww. ja v a2 s. c o m*/ } return items; }
From source file:Main.java
public static Vector<Element> findElements(String xpath, Node scope) throws XPathExpressionException { XPathFactory xpf = XPathFactory.newInstance(); XPath xp = xpf.newXPath();//ww w . ja va 2 s .c o m NodeList nl; Vector<Element> elements = new Vector<Element>(); nl = (NodeList) xp.evaluate(xpath, scope, XPathConstants.NODESET); for (int i = 0; i < nl.getLength(); i++) elements.add((Element) nl.item(i)); return elements; }