Example usage for java.util Vector add

List of usage examples for java.util Vector add

Introduction

In this page you can find the example usage for java.util Vector add.

Prototype

public synchronized boolean add(E e) 

Source Link

Document

Appends the specified element to the end of this Vector.

Usage

From source file:marytts.datatypes.MaryDataType.java

/**
 * Provide the list of all registered data types that can be used as input.
 * // w  w w  .j av  a2 s  .co m
 * @return a list containing data types.
 * @throws IllegalStateException
 *             if this method is called while registration is ongoing.
 */
public static List<MaryDataType> getInputTypes() {
    if (!registrationComplete)
        throw new IllegalStateException("Cannot inquire about data types while registration is ongoing");
    Vector<MaryDataType> result = new Vector<MaryDataType>(10);
    for (MaryDataType t : knownDataTypes) {
        if (t.isInputType())
            result.add(t);
    }
    return result;
}

From source file:marytts.datatypes.MaryDataType.java

/**
 * Provide the list of all registered data types that can be used as output.
 * /*  ww  w.j a v a 2 s  . c o m*/
 * @return a list containing data types.
 * @throws IllegalStateException
 *             if this method is called while registration is ongoing.
 */
public static List<MaryDataType> getOutputTypes() {
    if (!registrationComplete)
        throw new IllegalStateException("Cannot inquire about data types while registration is ongoing");
    Vector<MaryDataType> result = new Vector<MaryDataType>(10);
    for (MaryDataType t : knownDataTypes) {
        if (t.isOutputType())
            result.add(t);
    }
    return result;
}

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 .  j  a  v  a 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

public static Vector<HashMap> xmlToVector222(InputStream is, String xpath) {
    try {/*from   w ww  .  j  ava  2 s .c o m*/
        XPathFactory factory = XPathFactory.newInstance();
        XPath xPath = factory.newXPath();
        InputSource inputSource = new InputSource(is);

        NodeList nodes = (NodeList) xPath.evaluate(xpath, inputSource, XPathConstants.NODESET);
        Vector<HashMap> vector = new Vector<HashMap>();

        for (int x = 0; x < nodes.getLength(); x++) {
            NodeList nodeList = nodes.item(x).getChildNodes();
            HashMap hashmap = new HashMap();
            for (int y = 0; y < nodeList.getLength(); y++) {
                Node node = nodeList.item(y);
                if (!node.getNodeName().equals("#text")) {
                    hashmap.put(node.getNodeName(), node.getTextContent());
                }
            }
            vector.add(hashmap);
        }
        return vector;
    } catch (Exception ex) {
        ex.printStackTrace();
        return new Vector();
    }
}

From source file:Main.java

private static Vector<String> getTag(String source, String tag) {
    Vector<String> sTag = new Vector<String>();
    if (source == null || source.isEmpty() || tag == null || tag.isEmpty())
        return sTag;

    String subString, sTemp;/*from  ww w.j a  v  a 2 s . com*/
    int start, end;

    subString = source;
    sTemp = "<" + tag;
    start = subString.indexOf(sTemp);
    while (start >= 0) {
        subString = subString.substring(start);
        sTemp = "</" + tag + ">";
        end = subString.indexOf(sTemp);
        if (end < 0)
            break;

        end += sTemp.length();
        sTag.add(subString.substring(0, end));

        subString = subString.substring(end);
        sTemp = "<" + tag;
        start = subString.indexOf(sTemp);
    }
    return sTag;
}

From source file:com.fiorano.openesb.application.common.Param.java

/**
 * Sets param value for class/*from  w  w w . j a  v  a2s. c  om*/
 *
 * @param params
 * @param name
 * @param value
 */
public static void setParamValue(Vector params, String name, String value) {
    Param param = getParamWithName(params, name);

    if (param == null) {
        param = new Param();
        param.setParamName(name);
        param.setParamValue(value);
        params.add(param);
    } else
        param.setParamValue(value);
}

From source file:gov.nih.nci.evs.browser.utils.CodeSearchUtils.java

public static CodedNodeSet restrictToSource(CodedNodeSet cns, String source) {
    if (cns == null)
        return cns;
    if (source == null || source.compareTo("*") == 0 || source.compareTo("") == 0
            || source.compareTo("ALL") == 0)
        return cns;

    LocalNameList contextList = null;/*w  ww .  ja  v  a2 s .  c  o  m*/
    LocalNameList sourceLnL = null;
    NameAndValueList qualifierList = null;

    Vector<String> w2 = new Vector<String>();
    w2.add(source);
    sourceLnL = vector2LocalNameList(w2);
    LocalNameList propertyLnL = null;
    CodedNodeSet.PropertyType[] types = new PropertyType[] { PropertyType.PRESENTATION };
    try {
        cns = cns.restrictToProperties(propertyLnL, types, sourceLnL, contextList, qualifierList);
    } catch (Exception ex) {
        _logger.error("restrictToSource throws exceptions.");
        return null;
    }
    return cns;
}

From source file:com.qmetry.qaf.automation.util.FileUtil.java

public static Collection<File> listFiles(File directory, FilenameFilter filter, boolean recurse) {
    // List of files / directories
    Vector<File> files = new Vector<File>();

    // Get files / directories in the directory
    File[] entries = directory.listFiles();

    // Go over entries
    for (File entry : entries) {
        if ((filter == null) || filter.accept(directory, entry.getName())) {
            files.add(entry);
        }//from ww w  .ja  va  2 s . co m

        // If the file is a directory and the recurse flag
        // is set, recurse into the directory
        if (recurse && entry.isDirectory() && !entry.isHidden()) {
            files.addAll(listFiles(entry, filter, recurse));
        }
    }

    // Return collection of files
    return files;
}

From source file:eu.planets_project.tb.gui.backing.exp.view.MeasuredComparisonBean.java

private static PropertyEvaluation findPropertyEvaluation(Vector<PropertyEvaluation> pevals, MeasurementImpl m) {
    for (PropertyEvaluation peval : pevals) {
        if (peval.getPropertyUri().equals(m.getIdentifierUri()))
            return peval;
    }//w  w w. j  ava 2 s  . c om
    // Or make a new one:
    PropertyEvaluation peval = new PropertyEvaluation(m.getIdentifierUri());
    pevals.add(peval);
    return peval;
}

From source file:Main.java

/**
 * used to parse out elements of a list such as this:
 * <node>//from   w  ww. j  a v  a2s.  c  o  m
 *    <element>value1</element>
 *    <element>value2</element>
 *    <element>value3</element>
 * </node>
 *
 * for this example, called with Node pointing to <node> element and "element" 
 * in listElementName.
 * @param listNode pointer to list's "root" node
 * @param listElementName name of list element
 * @return Vector of list elements 
 */
public static Vector getListElements(Node listNode, String listElementName) {
    String tmp = "";
    Vector ret = null;

    NodeList children = listNode.getChildNodes();
    if (children != null) {
        ret = new Vector();

        for (int i = 0; i < children.getLength(); i++) {
            Node child = children.item(i);

            if (child.getNodeName().equalsIgnoreCase(listElementName)) {
                /* value is in element node's only (text) child */
                String value = child.getChildNodes().item(0).getNodeValue();
                if ((value != null) && !value.equals("")) {
                    ret.add(value);
                }
            }
        }
    }
    return ret;
}