List of usage examples for java.util Vector add
public synchronized boolean add(E e)
From source file:maltcms.ui.fileHandles.properties.tools.PropertyLoader.java
/** * * @param filename/* www. j a va2 s .c o m*/ * @param c * @return */ public static TableModel getModel(String filename, Class<?> c) { Logger.getLogger(PropertyLoader.class.getName()).log(Level.INFO, "Getting model for: {0}", filename); Vector<String> header = new Vector<>(); header.add("Key"); header.add("Value"); return new HashTableModel(header, PropertyLoader.asHash(PropertyLoader.getHash(filename)), c); }
From source file:maltcms.ui.fileHandles.properties.tools.PropertyLoader.java
/** * * @param filename//w w w . jav a2s. c o m * @return */ public static TableModel getModel(String filename) { Logger.getLogger(PropertyLoader.class.getName()).log(Level.INFO, "Getting model for: {0}", filename); Vector<String> header = new Vector<>(); header.add("Key"); header.add("Value"); return new HashTableModel(header, PropertyLoader.asHash(PropertyLoader.getHash(filename)), null); }
From source file:Main.java
public static Vector getChildrenElementsByTag(Node node, String name) { Vector result = new Vector(); NodeList nl = node.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) if (nl.item(i) instanceof Element && (((Element) nl.item(i)).getTagName().equals(name) || name == null)) { result.add(nl.item(i)); //System.out.println(nl.item(i).toString()); //System.out.println(((Element)nl.item(i)).getAttribute("className")); //System.out.println(((Element)nl.item(i)).getTagName()); }/*from w w w .ja va2s. co m*/ return result; }
From source file:Main.java
public static Vector createFieldList(String strFieldList, String strSeparator) { // Build field list Vector vtFieldList = new Vector(); String strFieldName;/*from ww w . j av a2 s.c o m*/ int iIndex = 0; int iLastIndex = iIndex; while ((iIndex = strFieldList.indexOf(strSeparator, iLastIndex)) >= 0) { strFieldName = strFieldList.substring(iLastIndex, iIndex); vtFieldList.add(strFieldName); iLastIndex = iIndex + 1; } strFieldName = strFieldList.substring(iLastIndex, strFieldList.length()); vtFieldList.add(strFieldName); return vtFieldList; }
From source file:eionet.gdem.conversion.ConversionService.java
private static final Vector<Object> convertResult(ConversionResultDto dto) { Vector<Object> result = new Vector<Object>(); result.add(dto.getStatusCode()); result.add(dto.getStatusDescription()); if (dto.getConvertedXmls() != null) { for (Map.Entry<String, byte[]> entry : dto.getConvertedXmls().entrySet()) { result.add(entry.getKey());/*from w w w . ja v a2 s . c o m*/ try { result.add(new String(entry.getValue(), "UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } } return result; }
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 ww .j ava 2 s .c om * @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:Main.java
public static void cleanText(Node node) { try {/* w w w . j a v a 2s.co m*/ NodeList childNodes = node.getChildNodes(); int noChildren = childNodes.getLength(); Node n = null; short type = 0; Vector rem = new Vector(); for (int i = 0; i < noChildren; i++) { n = childNodes.item(i); type = n.getNodeType(); if (type == Node.TEXT_NODE) { rem.add(n); } else if (type == Node.ELEMENT_NODE) { cleanText(n); } } for (int i = 0; i < rem.size(); i++) { node.removeChild((Node) rem.get(i)); } } catch (Exception e) { //DebugUtil.debug(e); } }
From source file:net.sf.jabref.exporter.layout.WSITools.java
/** * @param vcr {@link java.util.Vector} of <tt>String</tt> * @param buf Description of the Parameter * @param delimstr Description of the Parameter * @return Description of the Return Value *//* w w w .j ava 2 s. c o m*/ public static boolean tokenize(Vector<String> vcr, String buf, String delimstr) { vcr.clear(); buf = buf + '\n'; StringTokenizer st = new StringTokenizer(buf, delimstr); while (st.hasMoreTokens()) { vcr.add(st.nextToken()); } return true; }
From source file:Main.java
/** Return a list of all the children of a given node with a specific name/*from w ww. jav a 2 s .c om*/ */ 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:Main.java
public static Vector getSignaturesForFile(File originalFile) { File sigDir = getSignatureDirectoryForFile(originalFile); File[] filesAvailable = sigDir.listFiles(); Vector signatureFiles = new Vector(); if (filesAvailable != null) { for (int i = 0; i < filesAvailable.length; i++) { File file = filesAvailable[i]; if (isMatchingSigFile(originalFile, file)) { signatureFiles.add(file); }/* w w w.j a v a 2 s. co m*/ } } return signatureFiles; }