List of usage examples for java.util Vector Vector
public Vector()
From source file:Main.java
private static Vector<String> getSubTag(String source, String tag) { Vector<String> sSubTag = new Vector<String>(); if (source == null || source.isEmpty() || tag == null || tag.isEmpty()) return sSubTag; String subString, sTemp;/*from w w w . ja va 2s. c o m*/ int start, end; subString = source; sTemp = "<" + tag; start = subString.indexOf(sTemp); while (start >= 0) { subString = subString.substring(start); sTemp = "/>"; end = subString.indexOf(sTemp); if (end < 0) break; end += sTemp.length(); sSubTag.add(subString.substring(0, end)); subString = subString.substring(end); sTemp = "<" + tag; start = subString.indexOf(sTemp); } return sSubTag; }
From source file:Main.java
private static Vector<int[]> setpartition(int n) { Vector<int[]> subsetv = new Vector<int[]>(); //set partition by setpart2 algorithm int[] c = new int[n + 1]; int[] b = new int[n + 1]; int r = 1;// w w w. j ava 2s.c o m c[1] = 1; int j = 0; b[0] = 1; int n1 = n - 1; do { while (r < n1) { r = r + 1; c[r] = 1; j++; b[j] = r; } for (int i = 1; i <= n - j; ++i) { c[n] = i; int[] set = new int[n]; for (int k = 0; k < n; ++k) { set[k] = c[k + 1]; } subsetv.add(set); } r = b[j]; c[r]++; if (c[r] > r - j) { j--; } } while (r != 1); return subsetv; }
From source file:Main.java
public static String[] getElementPath(Node node) { Vector vector = new Vector(); for (; node != null; node = node.getParentNode()) if (node.getNodeType() == 1) if (!hasSameNamedSibling(node)) vector.addElement(node.getNodeName()); else/*from www . j a v a 2s . co m*/ vector.addElement(node.getNodeName() + "[" + (getElementIndex(node) + 1) + "]"); int i = vector.size(); String as[] = new String[i]; int j = i - 1; for (int k = 0; k < i;) { as[k] = (String) vector.elementAt(j); k++; j--; } return as; }
From source file:Main.java
public static Vector createFieldList(String strFieldList, String strSeparator) { // Build field list Vector vtFieldList = new Vector(); String strFieldName;/*from w w w . j a v a 2s . 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:Main.java
public static List<String> getAllCombinations(String s) { List<String> combinations = new Vector<String>(); int n = s.length(); int[] scaleOfTwo = new int[n]; int numberOfCombination = 1; for (int i = 0; i < n; i++) { scaleOfTwo[i] = numberOfCombination; numberOfCombination = numberOfCombination * 2; }//from www. j a v a2 s . c om for (int i = 0; i < numberOfCombination; i++) { System.out.println("considering " + i + " combination."); StringBuffer buffer = new StringBuffer(); for (int j = 0; j < n; j++) { int considerInCombination = scaleOfTwo[j] & i; if (considerInCombination == scaleOfTwo[j]) { buffer.append(s.charAt(j)); } } System.out.println("added " + buffer + " as " + i + " combination."); combinations.add(new String(buffer)); } return combinations; }
From source file:Main.java
public static Vector getDirectories(Node node) { NodeList nList = node.getChildNodes(); Vector directoryNodes = new Vector(); for (int i = 0; i < nList.getLength(); i++) { Node kidNode = nList.item(i); if (kidNode.getNodeName().equals("directory")) { directoryNodes.addElement(kidNode); }/* w w w .ja va 2s. c om*/ } return directoryNodes; }
From source file:Main.java
public static Vector getSubSection(Vector a_vecInput, int a_iFromIndex, int a_iToIndex) /* */ {//ww w. ja v a 2 s .c o m /* 169 */Vector vecReturn = new Vector(); /* 170 */for (int i = 0; i < a_iToIndex; i++) /* */ { /* 172 */if (i >= a_vecInput.size()) /* */ { /* */break; /* */} /* */ /* 177 */if (i < a_iFromIndex) /* */continue; /* 179 */vecReturn.add(a_vecInput.elementAt(i)); /* */} /* */ /* 182 */return vecReturn; /* */}
From source file:Main.java
public static Vector getSetColorNodes(Node node) { NodeList nList = node.getChildNodes(); Vector propertySetNodes = new Vector(); for (int i = 0; i < nList.getLength(); i++) { Node kidNode = nList.item(i); if (kidNode.getNodeName().equals("setColor")) { propertySetNodes.addElement(kidNode); }/*from w w w .j a v a 2 s .c o m*/ } return propertySetNodes; }
From source file:Main.java
public static String getMonthNameShort(Integer pos) { Vector<String> monthsShort = new Vector<String>(); monthsShort.add("Jan"); monthsShort.add("Feb"); monthsShort.add("Mar"); monthsShort.add("Apr"); monthsShort.add("May"); monthsShort.add("Jun"); monthsShort.add("Jul"); monthsShort.add("Aug"); monthsShort.add("Sep"); monthsShort.add("Oct"); monthsShort.add("Nov"); monthsShort.add("Dec"); return monthsShort.get(pos); }
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);/* w w w .j a v a 2s . c om*/ } } return items; }