List of usage examples for java.util Vector Vector
public Vector()
From source file:Main.java
public static Vector<Element> toVectorElements(Element element) { Vector<Element> elements = new Vector<Element>(); elements.add(element);//from w w w .j a v a 2 s . c om return elements; }
From source file:Main.java
public static Vector<Element> getChildElemsByName(String name, Node parent) { Vector<Element> v = new Vector<Element>(); Element E = null;/*ww w .ja v a 2 s . co m*/ for (Node childNode = parent.getFirstChild(); childNode != null; childNode = childNode.getNextSibling()) { if (childNode.getNodeType() == Node.ELEMENT_NODE) { if (childNode.getNodeName() == name) { E = (Element) childNode; v.add(E); } } } return v; }
From source file:Main.java
public static String[] getPuzzleFiles(Context context) { String[] files = context.fileList(); Vector<String> puzzleFiles = new Vector<String>(); for (String file : files) if (file.endsWith(".pfy")) puzzleFiles.add(file);/*from ww w . jav a 2s.co m*/ String[] ret = new String[0]; return puzzleFiles.toArray(ret); }
From source file:Main.java
public static Vector<String> getPropertiesFromXML(Node propNode) { Vector<String> properties; properties = new Vector<String>(); NodeList childList = propNode.getChildNodes(); for (int i = 0; i < childList.getLength(); i++) { Node currentNode = childList.item(i); if (currentNode.getNodeType() == Node.ELEMENT_NODE) { String nodeName = currentNode.getLocalName(); String namespace = currentNode.getNamespaceURI(); // href is a live property which is handled differently properties.addElement(namespace + ":" + nodeName); }/* ww w . java2s . c o m*/ } return properties; }
From source file:Main.java
public static <T> List<T> uniqueList(List<T> list) { Vector<T> v = new Vector<T>(); for (T obj : list) { if (!v.contains(obj)) { v.add((T) obj);/*from w w w .ja v a 2 s. c o m*/ } } return v; }
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 .ja v a 2 s . co m 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 ww . j a v a2 s . co m*/ return vec; }
From source file:Main.java
public static synchronized Node[] getChildNodes(Node node) { if (node == null) { return null; }//ww w .j a va 2 s . co m Vector childs = new Vector(); for (Node n = node.getFirstChild(); n != null; n = n.getNextSibling()) { childs.add((Element) n); } Node[] childNodes = new Element[childs.size()]; childs.toArray(childNodes); return childNodes; }
From source file:Main.java
public static NodeList getChildsByTagName(Element root, String name) { final Vector<Node> v = new Vector<Node>(); NodeList nl = root.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i);/* w w w . j a v a 2 s . c om*/ if (n.getNodeType() == Element.ELEMENT_NODE) { Element e = (Element) n; if (name.equals("*") || e.getNodeName().equalsIgnoreCase(name)) v.add(n); } } return new NodeList() { public Node item(int index) { if (index >= v.size() || index < 0) return null; else return v.get(index); } public int getLength() { return v.size(); } }; }
From source file:Main.java
public static Vector<String> getPositiveAssociation(String word) { Vector<String> result = new Vector<String>(); result.add(word);//from w w w . java 2s . c o m try { result.addAll(posMap.get(word)); } catch (Exception e) { } return result; }