java.util.Vector

Here are the examples of the java api class java.util.Vector taken from open source projects.

1. ISOMultiFieldPackagerTest#testUnpackList()

Project: jPOS
Source File: ISOMultiFieldPackagerTest.java
View license
public void testUnpackList() throws Exception {
    byte[] raw = new byte[] { (byte) 0xF0, (byte) 0xF4, (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4 };
    Vector list = new Vector();
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFE_LLNUM(10, "Should be 041234"));
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    ISOMultiFieldPackager packager = new ISOMultiFieldPackager("A List choice", list);
    ISOField field = new ISOField();
    packager.unpack(field, raw, 0);
    assertEquals("1234", (String) field.getValue());
}

2. BuildConfig#initDefaultDefines()

Project: openjdk
Source File: BuildConfig.java
View license
void initDefaultDefines(Vector defines) {
    Vector sysDefines = new Vector();
    sysDefines.add("WIN32");
    sysDefines.add("_WINDOWS");
    sysDefines.add("HOTSPOT_BUILD_USER=\\\"" + System.getProperty("user.name") + "\\\"");
    sysDefines.add("HOTSPOT_BUILD_TARGET=\\\"" + get("Build") + "\\\"");
    sysDefines.add("INCLUDE_TRACE=1");
    sysDefines.add("_JNI_IMPLEMENTATION_");
    if (vars.get("PlatformName").equals("Win32")) {
        sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
    } else {
        sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\"");
    }
    sysDefines.add("DEBUG_LEVEL=\\\"" + get("Build") + "\\\"");
    sysDefines.addAll(defines);
    put("Define", sysDefines);
}

3. VectorTest#test_override_size()

Project: j2objc
Source File: VectorTest.java
View license
public void test_override_size() throws Exception {
    Vector v = new Vector();
    Vector testv = new MockVector();
    // though size is overriden, it should passed without exception
    testv.add(1);
    testv.add(2);
    testv.clear();
    testv.add(1);
    testv.add(2);
    v.add(1);
    v.add(2);
    // RI's bug here
    assertTrue(testv.equals(v));
}

4. WebApplicationDefinitionImpl#preBuild()

View license
/* (non-Javadoc)
     * @see org.apache.cocoon.portal.pluto.om.common.Support#preBuild(java.lang.Object)
     */
public void preBuild(Object parameter) throws Exception {
    Vector structure = (Vector) parameter;
    PortletApplicationDefinition portletApplication = (PortletApplicationDefinition) structure.get(0);
    String contextString = (String) structure.get(1);
    setContextRoot(contextString);
    HashMap servletMap = new HashMap(1);
    Vector structure2 = new Vector();
    structure2.add(this);
    structure2.add(servletMappings);
    structure2.add(servletMap);
    ((Support) servlets).preBuild(structure2);
    Vector structure3 = new Vector();
    structure3.add(contextString);
    structure3.add(this);
    structure3.add(servletMap);
    ((Support) portletApplication).preBuild(structure3);
}

5. DirectoryScanner#clearResults()

Project: gocd
Source File: DirectoryScanner.java
View license
/**
     * Clear the result caches for a scan.
     */
protected synchronized void clearResults() {
    filesIncluded = new Vector();
    filesNotIncluded = new Vector();
    filesExcluded = new Vector();
    filesDeselected = new Vector();
    dirsIncluded = new Vector();
    dirsNotIncluded = new Vector();
    dirsExcluded = new Vector();
    dirsDeselected = new Vector();
    everythingIncluded = (basedir != null);
    scannedDirs.clear();
}

6. WinGammaPlatform#createAllConfigs()

Project: openjdk
Source File: WinGammaPlatform.java
View license
Vector createAllConfigs(String platform) {
    Vector allConfigs = new Vector();
    allConfigs.add(new C1DebugConfig());
    allConfigs.add(new C1FastDebugConfig());
    allConfigs.add(new C1ProductConfig());
    allConfigs.add(new TieredDebugConfig());
    allConfigs.add(new TieredFastDebugConfig());
    allConfigs.add(new TieredProductConfig());
    return allConfigs;
}

7. GitSSHXmlRpcClient#askPassword()

View license
/**
   * {@inheritDoc}
   */
@Nullable
@SuppressWarnings("unchecked")
public String askPassword(String token, final String username, final boolean resetPassword, final String lastError) {
    if (myClient == null) {
        return null;
    }
    Vector parameters = new Vector();
    parameters.add(token);
    parameters.add(username);
    parameters.add(resetPassword);
    parameters.add(lastError);
    try {
        return adjustNull(((String) myClient.execute(methodName("askPassword"), parameters)));
    } catch (XmlRpcException e) {
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    } catch (IOException e) {
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    }
}

8. GitSSHXmlRpcClient#setLastSuccessful()

View license
@Override
@SuppressWarnings("unchecked")
public String setLastSuccessful(String token, String userName, String method, String error) {
    if (myClient == null) {
        return "";
    }
    Vector parameters = new Vector();
    parameters.add(token);
    parameters.add(userName);
    parameters.add(method);
    parameters.add(error);
    try {
        return (String) myClient.execute(methodName("setLastSuccessful"), parameters);
    } catch (XmlRpcException e) {
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    } catch (IOException e) {
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    }
}

9. VectorTest#test_toString()

Project: j2objc
Source File: VectorTest.java
View license
/**
     * @tests java.util.Vector#toString()
     */
public void test_toString() {
    // Ensure toString works with self-referencing elements.
    Vector<Object> vec = new Vector<Object>(3);
    vec.add(null);
    vec.add(new Object());
    vec.add(vec);
    assertNotNull(vec.toString());
    // Test for method java.lang.String java.util.Vector.toString()
    assertTrue("Incorrect String returned", tVector.toString().equals(vString));
    Vector v = new Vector();
    v.addElement("one");
    v.addElement(v);
    v.addElement("3");
    // test last element
    v.addElement(v);
    String result = v.toString();
    assertTrue("should contain self ref", result.indexOf("(this") > -1);
}

10. RuleColorizer#getDefaultColors()

Project: chainsaw
Source File: RuleColorizer.java
View license
public Vector getDefaultColors() {
    Vector vec = new Vector();
    vec.add(Color.white);
    vec.add(Color.black);
    //add default alternating color & search backgrounds (both foreground are black)
    vec.add(ChainsawConstants.COLOR_ODD_ROW_BACKGROUND);
    vec.add(ChainsawConstants.FIND_LOGGER_BACKGROUND);
    vec.add(new Color(255, 255, 225));
    vec.add(new Color(255, 225, 255));
    vec.add(new Color(225, 255, 255));
    vec.add(new Color(255, 225, 225));
    vec.add(new Color(225, 255, 225));
    vec.add(new Color(225, 225, 255));
    vec.add(new Color(225, 225, 183));
    vec.add(new Color(225, 183, 225));
    vec.add(new Color(183, 225, 225));
    vec.add(new Color(183, 225, 183));
    vec.add(new Color(183, 183, 225));
    vec.add(new Color(232, 201, 169));
    vec.add(new Color(255, 255, 153));
    vec.add(new Color(255, 153, 153));
    vec.add(new Color(189, 156, 89));
    vec.add(new Color(255, 102, 102));
    vec.add(new Color(255, 177, 61));
    vec.add(new Color(61, 255, 61));
    vec.add(new Color(153, 153, 255));
    vec.add(new Color(255, 153, 255));
    return vec;
}

11. CacheMap#placeInStorageCache()

Project: CodenameOne
Source File: CacheMap.java
View license
private void placeInStorageCache(int offset, Object key, long lastAccessed, Object value) {
    Vector v = new Vector();
    v.addElement(value);
    Long l = new Long(lastAccessed);
    v.addElement(l);
    v.addElement(key);
    Storage.getInstance().writeObject("$CACHE$" + cachePrefix + key.toString(), v);
    Vector storageCacheContent = getStorageCacheContent();
    if (storageCacheContent.size() > offset) {
        storageCacheContent.setElementAt(new Object[] { l, key }, offset);
    } else {
        storageCacheContent.insertElementAt(new Object[] { l, key }, offset);
    }
    Storage.getInstance().writeObject("$CACHE$Idx" + cachePrefix, storageCacheContent);
}

12. PortletApplicationDefinitionImpl#preBuild()

View license
/* (non-Javadoc)
     * @see org.apache.cocoon.portal.pluto.om.common.Support#preBuild(java.lang.Object)
     */
public void preBuild(Object parameter) throws Exception {
    Vector structure = (Vector) parameter;
    String contextRoot = (String) structure.get(0);
    WebApplicationDefinition webApplication = (WebApplicationDefinition) structure.get(1);
    Map servletMap = (Map) structure.get(2);
    this.setContextRoot(contextRoot);
    setWebApplicationDefinition(webApplication);
    Vector structure2 = new Vector();
    structure2.add(this);
    structure2.add(servletMap);
    ((Support) portlets).preBuild(structure2);
}

13. XmlRpcResourceManagerClient#submitJob()

View license
public boolean submitJob(Job exec, JobInput in, URL hostUrl) throws JobExecutionException {
    Vector argList = new Vector();
    argList.add(XmlRpcStructFactory.getXmlRpcJob(exec));
    argList.add(in.write());
    argList.add(hostUrl.toString());
    boolean success;
    try {
        success = (Boolean) client.execute("resourcemgr.handleJob", argList);
    } catch (XmlRpcException e) {
        throw new JobExecutionException(e.getMessage(), e);
    } catch (IOException e) {
        throw new JobExecutionException(e.getMessage(), e);
    }
    return success;
}

14. XmlRpcWorkflowManagerClient#getWorkflowInstancesByStatus()

View license
public List getWorkflowInstancesByStatus(String status) throws XmlRpcException, IOException {
    Vector argList = new Vector();
    argList.add(status);
    Vector insts;
    Vector instsUnpacked;
    insts = (Vector) client.execute("workflowmgr.getWorkflowInstancesByStatus", argList);
    if (insts != null) {
        instsUnpacked = new Vector(insts.size());
        for (Object inst1 : insts) {
            Map hWinst = (Map) inst1;
            WorkflowInstance inst = XmlRpcStructFactory.getWorkflowInstanceFromXmlRpc(hWinst);
            instsUnpacked.add(inst);
        }
        return instsUnpacked;
    } else {
        return null;
    }
}

15. ISOMultiFieldPackagerTest#testPackList()

Project: jPOS
Source File: ISOMultiFieldPackagerTest.java
View license
public void testPackList() throws Exception {
    Vector list = new Vector();
    list.add(new IFB_LLNUM(10, "Should not be this", true));
    list.add(new IFE_LLNUM(10, "Should be 041234"));
    list.add(new IFB_LLNUM(10, "The one to pack", true));
    ISOMultiFieldPackager packager = new ISOMultiFieldPackager("Should be 041234", list);
    packager.hint("The one to pack");
    ISOField field = new ISOField(12, "1234");
    TestUtils.assertEquals(new byte[] { (byte) 0x04, (byte) 0x12, (byte) 0x34 }, packager.pack(field));
}

16. NaccacheSternKeyPairGenerator#permuteList()

View license
/**
     * Generates a permuted ArrayList from the original one. The original List
     * is not modified
     * 
     * @param arr
     *            the ArrayList to be permuted
     * @param rand
     *            the source of Randomness for permutation
     * @return a new ArrayList with the permuted elements.
     */
private static Vector permuteList(Vector arr, SecureRandom rand) {
    Vector retval = new Vector();
    Vector tmp = new Vector();
    for (int i = 0; i < arr.size(); i++) {
        tmp.addElement(arr.elementAt(i));
    }
    retval.addElement(tmp.elementAt(0));
    tmp.removeElementAt(0);
    while (tmp.size() != 0) {
        retval.insertElementAt(tmp.elementAt(0), getInt(rand, retval.size() + 1));
        tmp.removeElementAt(0);
    }
    return retval;
}

17. NaccacheSternKeyPairGenerator#permuteList()

View license
/**
     * Generates a permuted ArrayList from the original one. The original List
     * is not modified
     * 
     * @param arr
     *            the ArrayList to be permuted
     * @param rand
     *            the source of Randomness for permutation
     * @return a new ArrayList with the permuted elements.
     */
private static Vector permuteList(Vector arr, SecureRandom rand) {
    Vector retval = new Vector();
    Vector tmp = new Vector();
    for (int i = 0; i < arr.size(); i++) {
        tmp.addElement(arr.elementAt(i));
    }
    retval.addElement(tmp.elementAt(0));
    tmp.removeElementAt(0);
    while (tmp.size() != 0) {
        retval.insertElementAt(tmp.elementAt(0), getInt(rand, retval.size() + 1));
        tmp.removeElementAt(0);
    }
    return retval;
}

18. TestVectorNull#test()

Project: pluotsorbet
Source File: TestVectorNull.java
View license
public void test(TestHarness th) {
    Vector a = new Vector();
    // Add a null element
    a.addElement(null);
    th.check(a.size(), 1);
    // Add a null value returned by a native
    a.addElement(nativeThatReturnsNull());
    th.check(a.size(), 2);
    // Add a null value from an array
    Object[] array = new Object[7];
    th.check(array[0], null);
    a.addElement(array[0]);
    th.check(a.size(), 3);
}

19. StyleMapEditor#parseStyleList()

Project: uima-uimaj
Source File: StyleMapEditor.java
View license
public ArrayList parseStyleList(String aStyleMapXml) {
    StyleMapXmlParser smxp = new StyleMapXmlParser(aStyleMapXml);
    // System.out.println(aStyleMapXml );
    Vector annotType_SME = smxp.annotType;
    Vector styleLabel_SME = smxp.styleLabel;
    Vector featureValue_SME = smxp.featureValue;
    Vector styleColor_SME = smxp.styleColor;
    ColorParser cp = new ColorParser();
    colorNameMap = cp.getColorNameMap();
    for (int i = 0; i < annotType_SME.size(); i++) {
        String typeName = ((String) annotType_SME.elementAt(i));
        String labelString = ((String) styleLabel_SME.elementAt(i));
        String featureValue = ((String) featureValue_SME.elementAt(i));
        String styleColor = styleColor_SME.elementAt(i).toString();
        StyleMapEntry e = cp.parseAndAssignColors(typeName, featureValue, labelString, styleColor);
        styleList.add(e);
    }
    return styleList;
}

20. TestDeser#testArray()

Project: axis1-java
Source File: TestDeser.java
View license
public void testArray() throws Exception {
    Vector v = new Vector();
    v.addElement("abc");
    v.addElement("def");
    deserialize(HEAD + "<result xsi:type=\"soapenc:Array\" " + "soapenc:itemType=\"xsd:string\" soapenc:arraySize=\"2\"> " + "<item xsi:type=\"xsd:string\">abc</item>" + "<item xsi:type=\"xsd:string\">def</item>" + "</result>" + TAIL, v, true);
}

21. TestArrayListConversions#testArrayConversion()

View license
public void testArrayConversion() throws Exception {
    Call call = new Call(new Service());
    call.setTransport(transport);
    Vector v = new Vector();
    v.addElement("Hi there!");
    v.addElement("This'll be a SOAP Array");
    call.setOperationName(new QName(SERVICE_NAME, "echoArray"));
    Object ret = call.invoke(new Object[] { v });
    if (!equals(v, ret))
        assertEquals("Echo Array mangled the result.  Result is underneath\n" + ret, v, ret);
}

22. ZaurusEditor#resetTableForms()

Project: voltdb
Source File: ZaurusEditor.java
View license
// reset  everything after changes in the database
private void resetTableForms() {
    lForm.show(pForm, "search");
    lButton.show(pButton, "search");
    Vector vAllTables = getAllTables();
    // fill the drop down list again
    // get all table names and show a drop down list of them in cTables
    cTables.removeAll();
    for (Enumeration e = vAllTables.elements(); e.hasMoreElements(); ) {
        cTables.addItem((String) e.nextElement());
    }
    // remove all form panels from pForm
    for (Enumeration e = vHoldForms.elements(); e.hasMoreElements(); ) {
        pForm.remove((ZaurusTableForm) e.nextElement());
    }
    // end of while (Enumeration e = vHoldForms.elements(); e.hasMoreElements();)
    // initialize a new list for the table names which have a form in pForm
    vHoldTableNames = new Vector(20);
    vHoldForms = new Vector(20);
}

23. TlsTestServerImpl#getCertificateRequest()

Project: bc-java
Source File: TlsTestServerImpl.java
View license
public CertificateRequest getCertificateRequest() throws IOException {
    if (config.serverCertReq == TlsTestConfig.SERVER_CERT_REQ_NONE) {
        return null;
    }
    short[] certificateTypes = new short[] { ClientCertificateType.rsa_sign, ClientCertificateType.dss_sign, ClientCertificateType.ecdsa_sign };
    Vector serverSigAlgs = null;
    if (TlsUtils.isSignatureAlgorithmsExtensionAllowed(serverVersion)) {
        serverSigAlgs = config.serverCertReqSigAlgs;
        if (serverSigAlgs == null) {
            serverSigAlgs = TlsUtils.getDefaultSupportedSignatureAlgorithms();
        }
    }
    Vector certificateAuthorities = new Vector();
    certificateAuthorities.addElement(TlsTestUtils.loadCertificateResource("x509-ca.pem").getSubject());
    return new CertificateRequest(certificateTypes, serverSigAlgs, certificateAuthorities);
}

24. MockTlsServer#getCertificateRequest()

Project: bc-java
Source File: MockTlsServer.java
View license
public CertificateRequest getCertificateRequest() throws IOException {
    short[] certificateTypes = new short[] { ClientCertificateType.rsa_sign, ClientCertificateType.dss_sign, ClientCertificateType.ecdsa_sign };
    Vector serverSigAlgs = null;
    if (TlsUtils.isSignatureAlgorithmsExtensionAllowed(serverVersion)) {
        serverSigAlgs = TlsUtils.getDefaultSupportedSignatureAlgorithms();
    }
    Vector certificateAuthorities = new Vector();
    certificateAuthorities.addElement(TlsTestUtils.loadCertificateResource("x509-ca.pem").getSubject());
    return new CertificateRequest(certificateTypes, serverSigAlgs, certificateAuthorities);
}

25. MockDTLSServer#getCertificateRequest()

Project: bc-java
Source File: MockDTLSServer.java
View license
public CertificateRequest getCertificateRequest() throws IOException {
    short[] certificateTypes = new short[] { ClientCertificateType.rsa_sign, ClientCertificateType.dss_sign, ClientCertificateType.ecdsa_sign };
    Vector serverSigAlgs = null;
    if (TlsUtils.isSignatureAlgorithmsExtensionAllowed(serverVersion)) {
        serverSigAlgs = TlsUtils.getDefaultSupportedSignatureAlgorithms();
    }
    Vector certificateAuthorities = new Vector();
    certificateAuthorities.addElement(TlsTestUtils.loadCertificateResource("x509-ca.pem").getSubject());
    return new CertificateRequest(certificateTypes, serverSigAlgs, certificateAuthorities);
}

26. TestAbstractLdLinker#testLibReturnValue()

View license
public void testLibReturnValue() {
    final AbstractLdLinker linker = getLinker();
    final CCTask task = new CCTask();
    final LibrarySet[] sets = new LibrarySet[] { new LibrarySet() };
    /* throws an Exception in setLibs otherwise */
    sets[0].setProject(new org.apache.tools.ant.Project());
    sets[0].setDir(new File("/foo"));
    sets[0].setLibs(new CUtil.StringArrayBuilder("bart,cart,dart"));
    final Vector preargs = new Vector();
    final Vector midargs = new Vector();
    final Vector endargs = new Vector();
    final String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, endargs);
    assertEquals(3, rc.length);
    assertEquals("bart", rc[0]);
    assertEquals("cart", rc[1]);
    assertEquals("dart", rc[2]);
}

27. TestAbstractLdLinker#testAddLibrarySetLibSwitch()

View license
public void testAddLibrarySetLibSwitch() {
    final AbstractLdLinker linker = getLinker();
    final CCTask task = new CCTask();
    final LibrarySet[] sets = new LibrarySet[] { new LibrarySet() };
    /* throws an Exception in setLibs otherwise */
    sets[0].setProject(new org.apache.tools.ant.Project());
    sets[0].setDir(new File("/foo"));
    sets[0].setLibs(new CUtil.StringArrayBuilder("bart,cart,dart"));
    final Vector preargs = new Vector();
    final Vector midargs = new Vector();
    final Vector endargs = new Vector();
    final String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, endargs);
    assertEquals("-lbart", (String) endargs.elementAt(1));
    assertEquals("-lcart", (String) endargs.elementAt(2));
    assertEquals("-ldart", (String) endargs.elementAt(3));
    assertEquals(endargs.size(), 4);
}

28. TestAbstractLdLinker#testAddLibrarySetDirSwitch()

View license
public void testAddLibrarySetDirSwitch() {
    final AbstractLdLinker linker = getLinker();
    final CCTask task = new CCTask();
    final LibrarySet[] sets = new LibrarySet[] { new LibrarySet() };
    /* throws an Exception in setLibs otherwise */
    sets[0].setProject(new org.apache.tools.ant.Project());
    sets[0].setDir(new File("/foo"));
    sets[0].setLibs(new CUtil.StringArrayBuilder("bart,cart,dart"));
    final Vector preargs = new Vector();
    final Vector midargs = new Vector();
    final Vector endargs = new Vector();
    final String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, endargs);
    final String libdirSwitch = (String) endargs.elementAt(0);
    assertEquals(libdirSwitch.substring(0, 2), "-L");
    //
    // can't have space after -L or will break Mac OS X
    //
    assertTrue(!libdirSwitch.substring(2, 3).equals(" "));
    assertEquals(libdirSwitch.substring(libdirSwitch.length() - 3), "foo");
}

29. CoreConfidenceTests#testNestedMethod1()

Project: mvel
Source File: CoreConfidenceTests.java
View license
public void testNestedMethod1() {
    Vector vectorA = new Vector();
    Vector vectorB = new Vector();
    vectorA.add("Foo244");
    Map map = new HashMap();
    map.put("vecA", vectorA);
    map.put("vecB", vectorB);
    testCompiledSimple("vecB.add(vecA.remove(0)); vecA.add('Foo244');", null, map);
    assertEquals("Foo244", vectorB.get(0));
}

30. XPointerFactory#select()

Project: lenya
Source File: XPointerFactory.java
View license
/**
     * Select nodes by xpointer
     *
     * @param node Document Node
     * @param reference xmls(...)xpointer(...)
     *
     * @return nodes
     *
     * @exception Exception ...
     */
public Vector select(Node node, String reference) throws Exception {
    Vector xpaths = new Vector();
    Vector namespaces = new Vector();
    parse(reference, xpaths, namespaces);
    Vector nodes = new Vector();
    for (int i = 0; i < xpaths.size(); i++) {
        Vector n = xpointer.select(node, (String) xpaths.elementAt(i), namespaces);
        for (int j = 0; j < n.size(); j++) {
            nodes.addElement(n.elementAt(j));
        }
    }
    return nodes;
}

31. ToDoListImpl#items()

Project: pluotsorbet
Source File: ToDoListImpl.java
View license
/**
     * Gets an Enumeration of the items in the list.
     * @param field identifier of field
     * @param startDate beginning of range
     * @param endDate end of range
     * @return Enumeration of matching events
     */
public Enumeration items(int field, long startDate, long endDate) throws PIMException {
    if (getFieldDataType(field) != PIMItem.DATE) {
        throw new IllegalArgumentException("Not a DATE field");
    }
    if (endDate < startDate) {
        throw new IllegalArgumentException("Start date" + " must precede end date");
    }
    Vector results = new Vector();
    Vector keys = new Vector();
    for (Enumeration e = items(); e.hasMoreElements(); ) {
        ToDo item = (ToDo) e.nextElement();
        int indices = item.countValues(field);
        for (int i = 0; i < indices; i++) {
            long date = item.getDate(field, i);
            if (date >= startDate && date <= endDate) {
                // include result
                KeySortUtility.store(keys, results, date, item);
                break;
            }
        }
    }
    return results.elements();
}

32. Parser_Topas#splitLine()

Project: pGraph
Source File: Parser_Topas.java
View license
/*
	 * Input line is a set of tokens delimited by '/' character and finally '=' character.
	 * Create a Vector containing the ordered set of String tokens.
	 */
@SuppressWarnings("unchecked")
private Vector splitLine(String s) {
    Vector result = new Vector();
    // first token's char 
    int begin = 0;
    // last token's char
    int end;
    // Get all tokens that end with '/'
    while ((end = s.indexOf('/', begin)) >= 0) {
        result.add(s.substring(begin, end));
        begin = end + 1;
    }
    // Manage variable name and value
    end = s.indexOf('=', begin);
    if (end < 0 || end == begin)
        // invalid line: it has no value or no label
        return null;
    result.add(s.substring(begin, end));
    result.add(new Float(s.substring(end + 1)));
    return result;
}

33. MixedModelTest#testIterateVector()

Project: commons-jxpath
Source File: MixedModelTest.java
View license
public void testIterateVector() {
    Map map = new HashMap();
    Vector vec = new Vector();
    vec.add(new HashMap());
    vec.add(new HashMap());
    map.put("vec", vec);
    JXPathContext context = JXPathContext.newContext(map);
    assertXPathPointerIterator(context, "/vec", list("/.[@name='vec'][1]", "/.[@name='vec'][2]"));
}

34. StringUtilsTest#testGetCommaListFromVector()

Project: commons-bsf
Source File: StringUtilsTest.java
View license
public void testGetCommaListFromVector() {
    String result;
    Vector vector = new Vector();
    vector.add(new Character('a'));
    vector.add(new Character('b'));
    result = StringUtils.getCommaListFromVector(vector);
    assertTrue(result.equals(new String("a, b")));
    result = StringUtils.getCommaListFromVector(new Vector());
    assertTrue(result.equals(new String("")));
}

35. VectorTest#test_removeElementLjava_lang_Object()

Project: j2objc
Source File: VectorTest.java
View license
/**
	 * @tests java.util.Vector#removeElement(java.lang.Object)
	 */
public void test_removeElementLjava_lang_Object() {
    // Test for method boolean
    // java.util.Vector.removeElement(java.lang.Object)
    Vector v = vectorClone(tVector);
    v.removeElement("Test 98");
    assertEquals("Element not removed", "Test 99", ((String) v.elementAt(98)));
    assertTrue("Vector is wrong size after removal: " + v.size(), v.size() == 99);
    tVector.addElement(null);
    v.removeElement(null);
    assertTrue("Vector is wrong size after removing null: " + v.size(), v.size() == 99);
}

36. ArrayListTest#test_trimToSize()

Project: j2objc
Source File: ArrayListTest.java
View license
/**
     * @tests java.util.ArrayList#trimToSize()
     */
public void test_trimToSize() {
    // Test for method void java.util.ArrayList.trimToSize()
    for (int i = 99; i > 24; i--) alist.remove(i);
    ((ArrayList) alist).trimToSize();
    assertEquals("Returned incorrect size after trim", 25, alist.size());
    for (int i = 0; i < alist.size(); i++) assertTrue("Trimmed list contained incorrect elements", alist.get(i) == objArray[i]);
    Vector v = new Vector();
    v.add("a");
    v.add("b");
    ArrayList al = new ArrayList(v);
    al.remove("a");
    Iterator it = al.iterator();
    al.trimToSize();
    try {
        it.next();
        fail("should throw a ConcurrentModificationException");
    } catch (ConcurrentModificationException ioobe) {
    }
}

37. GitSSHXmlRpcClient#getLastSuccessful()

View license
/**
   * {@inheritDoc}
   */
@Override
@SuppressWarnings("unchecked")
public String getLastSuccessful(String token, String userName) {
    if (myClient == null) {
        return "";
    }
    Vector parameters = new Vector();
    parameters.add(token);
    parameters.add(userName);
    try {
        return (String) myClient.execute(methodName("getLastSuccessful"), parameters);
    } catch (XmlRpcException e) {
        log("getLastSuccessful failed. token: " + token + ", userName: " + userName + ", client: " + myClient.getURL());
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    } catch (IOException e) {
        log("getLastSuccessful failed. token: " + token + ", userName: " + userName + ", client: " + myClient.getURL());
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    }
}

38. GitAskPassXmlRpcClient#askPassword()

View license
// Obsolete collection usage because of the XmlRpcClientLite API
@SuppressWarnings({ "UseOfObsoleteCollectionType", "unchecked" })
String askPassword(String token, @NotNull String url) {
    Vector parameters = new Vector();
    parameters.add(token);
    parameters.add(url);
    try {
        return (String) myClient.execute(methodName("askPassword"), parameters);
    } catch (XmlRpcException e) {
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    } catch (IOException e) {
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    }
}

39. GitAskPassXmlRpcClient#askUsername()

View license
// Obsolete collection usage because of the XmlRpcClientLite API
@SuppressWarnings({ "UseOfObsoleteCollectionType", "unchecked" })
String askUsername(String token, @NotNull String url) {
    Vector parameters = new Vector();
    parameters.add(token);
    parameters.add(url);
    try {
        return (String) myClient.execute(methodName("askUsername"), parameters);
    } catch (XmlRpcException e) {
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    } catch (IOException e) {
        throw new RuntimeException("Invocation failed " + e.getMessage(), e);
    }
}

40. ZaurusEditor#resetTableForms()

Project: h-store
Source File: ZaurusEditor.java
View license
// reset  everything after changes in the database
private void resetTableForms() {
    lForm.show(pForm, "search");
    lButton.show(pButton, "search");
    Vector vAllTables = getAllTables();
    // fill the drop down list again
    // get all table names and show a drop down list of them in cTables
    cTables.removeAll();
    for (Enumeration e = vAllTables.elements(); e.hasMoreElements(); ) {
        cTables.addItem((String) e.nextElement());
    }
    // remove all form panels from pForm
    for (Enumeration e = vHoldForms.elements(); e.hasMoreElements(); ) {
        pForm.remove((ZaurusTableForm) e.nextElement());
    }
    // end of while (Enumeration e = vHoldForms.elements(); e.hasMoreElements();)
    // initialize a new list for the table names which have a form in pForm
    vHoldTableNames = new Vector(20);
    vHoldForms = new Vector(20);
}

41. RemoteType#initialize()

Project: openjdk
Source File: RemoteType.java
View license
/**
     * Initialize this instance.
     */
private boolean initialize(boolean quiet, ContextStack stack) {
    boolean result = false;
    // Go check it out and gather up the info we need...
    Vector directInterfaces = new Vector();
    Vector directMethods = new Vector();
    Vector directConstants = new Vector();
    if (isConformingRemoteInterface(directInterfaces, directMethods, directConstants, quiet, stack)) {
        // We're ok, so pass 'em up...
        result = initialize(directInterfaces, directMethods, directConstants, stack, quiet);
    }
    return result;
}

42. XmlRpcWorkflowManagerClient#getWorkflowInstances()

View license
public List getWorkflowInstances() throws XmlRpcException, IOException {
    Vector argList = new Vector();
    Vector insts;
    Vector instsUnpacked;
    insts = (Vector) client.execute("workflowmgr.getWorkflowInstances", argList);
    if (insts != null) {
        instsUnpacked = new Vector(insts.size());
        for (Object inst1 : insts) {
            Map hWinst = (Map) inst1;
            WorkflowInstance inst = XmlRpcStructFactory.getWorkflowInstanceFromXmlRpc(hWinst);
            instsUnpacked.add(inst);
        }
        return instsUnpacked;
    } else {
        return null;
    }
}

43. XmlRpcWorkflowManagerClient#getWorkflows()

View license
public List getWorkflows() throws XmlRpcException, IOException, RepositoryException {
    Vector argList = new Vector();
    Vector works;
    Vector workflows;
    works = (Vector) client.execute("workflowmgr.getWorkflows", argList);
    if (works != null) {
        workflows = new Vector(works.size());
        for (Object work : works) {
            Map workflw = (Map) work;
            Workflow w = XmlRpcStructFactory.getWorkflowFromXmlRpc(workflw);
            workflows.add(w);
        }
        return workflows;
    } else {
        return null;
    }
}

44. XmlRpcWorkflowManagerClient#setWorkflowInstanceCurrentTaskEndDateTime()

View license
public synchronized boolean setWorkflowInstanceCurrentTaskEndDateTime(String wInstId, String endDateTimeIsoStr) throws XmlRpcException, IOException {
    Vector argList = new Vector();
    argList.add(wInstId);
    argList.add(endDateTimeIsoStr);
    return (Boolean) client.execute("workflowmgr.setWorkflowInstanceCurrentTaskEndDateTime", argList);
}

45. XmlRpcWorkflowManagerClient#setWorkflowInstanceCurrentTaskStartDateTime()

View license
public synchronized boolean setWorkflowInstanceCurrentTaskStartDateTime(String wInstId, String startDateTimeIsoStr) throws XmlRpcException, IOException {
    Vector argList = new Vector();
    argList.add(wInstId);
    argList.add(startDateTimeIsoStr);
    return (Boolean) client.execute("workflowmgr.setWorkflowInstanceCurrentTaskStartDateTime", argList);
}

46. XmlRpcWorkflowManagerClient#getWorkflowsByEvent()

View license
public List getWorkflowsByEvent(String eventName) throws XmlRpcException, IOException, RepositoryException {
    List workflows = new Vector();
    Vector workflowVector;
    Vector argList = new Vector();
    argList.add(eventName);
    workflowVector = (Vector) client.execute("workflowmgr.getWorkflowsByEvent", argList);
    if (workflowVector != null) {
        for (Object aWorkflowVector : workflowVector) {
            Map workflowHash = (Map) aWorkflowVector;
            Workflow w = XmlRpcStructFactory.getWorkflowFromXmlRpc(workflowHash);
            workflows.add(w);
        }
    }
    return workflows;
}

47. XmlRpcWorkflowManagerClient#paginateWorkflowInstances()

View license
public WorkflowInstancePage paginateWorkflowInstances(int pageNum, String status) throws XmlRpcException, IOException {
    Vector argList = new Vector();
    argList.add(pageNum);
    argList.add(status);
    Map pageHash;
    pageHash = (Map) client.execute("workflowmgr.paginateWorkflowInstances", argList);
    return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
}

48. XmlRpcWorkflowManagerClient#executeDynamicWorkflow()

View license
public String executeDynamicWorkflow(List<String> taskIds, Metadata metadata) throws XmlRpcException, IOException {
    Vector argList = new Vector();
    Vector<String> taskIdVector = new Vector<String>();
    taskIdVector.addAll(taskIds);
    String instId;
    argList.add(taskIdVector);
    argList.add(metadata.getHashTable());
    instId = (String) client.execute("workflowmgr.executeDynamicWorkflow", argList);
    return instId;
}

49. XmlRpcResourceManagerClient#submitJob()

View license
public String submitJob(Job exec, JobInput in) throws JobExecutionException {
    Vector argList = new Vector();
    argList.add(XmlRpcStructFactory.getXmlRpcJob(exec));
    argList.add(in.write());
    LOG.log(Level.FINEST, argList.toString());
    String jobId;
    try {
        jobId = (String) client.execute("resourcemgr.handleJob", argList);
    } catch (XmlRpcException e) {
        throw new JobExecutionException(e.getMessage(), e);
    } catch (IOException e) {
        throw new JobExecutionException(e.getMessage(), e);
    }
    return jobId;
}

50. VectorTest#test_Constructor()

Project: j2objc
Source File: VectorTest.java
View license
/**
	 * @tests java.util.Vector#Vector()
	 */
public void test_Constructor() {
    // Test for method java.util.Vector()
    Vector tv = new Vector(100);
    for (int i = 0; i < 100; i++) tv.addElement(new Integer(i));
    new Support_ListTest("", tv).runTest();
    tv = new Vector(200);
    for (int i = -50; i < 150; i++) tv.addElement(new Integer(i));
    new Support_ListTest("", tv.subList(50, 150)).runTest();
    Vector v = new Vector();
    assertEquals("Vector creation failed", 0, v.size());
    assertEquals("Wrong capacity", 10, v.capacity());
}

51. XmlRpcBatchMgrProxy#run()

Project: oodt
Source File: XmlRpcBatchMgrProxy.java
View license
public void run() {
    client = new XmlRpcClient(remoteHost.getIpAddr());
    Vector argList = new Vector();
    argList.add(XmlRpcStructFactory.getXmlRpcJob(jobSpec.getJob()));
    argList.add(jobSpec.getIn().write());
    boolean result;
    try {
        parent.jobExecuting(jobSpec);
        result = (Boolean) client.execute("batchstub.executeJob", argList);
        if (result) {
            parent.jobSuccess(jobSpec);
        } else {
            throw new Exception("batchstub.executeJob returned false");
        }
    } catch (Exception e) {
        LOG.log(Level.SEVERE, "Job execution failed for jobId '" + jobSpec.getJob().getId() + "' : " + e.getMessage(), e);
        parent.jobFailure(jobSpec);
    } finally {
        parent.notifyMonitor(remoteHost, jobSpec);
    }
}

52. FullCycleDBTest#getRelevantEventsFromVA()

Project: log4j-extras
Source File: FullCycleDBTest.java
View license
Vector getRelevantEventsFromVA(VectorAppender va, long startTime) {
    assertNotNull(va);
    Vector v = va.getVector();
    Vector r = new Vector();
    // remove all elements older than startTime
    for (Iterator i = v.iterator(); i.hasNext(); ) {
        LoggingEvent event = (LoggingEvent) i.next();
        if (startTime > event.getTimeStamp()) {
            System.out.println("***Removing event with timestamp " + event.getTimeStamp() + ": " + event.getMessage());
        } else {
            System.out.println("***Keeping event with timestamp " + event.getTimeStamp() + ": " + event.getMessage());
            r.add(event);
        }
    }
    return r;
}

53. CompilerDef#getActiveDefines()

Project: nar-maven-plugin
Source File: CompilerDef.java
View license
public UndefineArgument[] getActiveDefines() {
    final Project p = getProject();
    if (p == null) {
        throw new java.lang.IllegalStateException("project must be set before this call");
    }
    if (isReference()) {
        return ((CompilerDef) getCheckedRef(CompilerDef.class, "CompilerDef")).getActiveDefines();
    }
    final Vector actives = new Vector();
    for (int i = 0; i < this.defineSets.size(); i++) {
        final DefineSet currentSet = (DefineSet) this.defineSets.elementAt(i);
        final UndefineArgument[] defines = currentSet.getDefines();
        for (final UndefineArgument define : defines) {
            if (define.isActive(p)) {
                actives.addElement(define);
            }
        }
    }
    final UndefineArgument[] retval = new UndefineArgument[actives.size()];
    actives.copyInto(retval);
    return retval;
}

54. CompilerDef#getActivePaths()

Project: nar-maven-plugin
Source File: CompilerDef.java
View license
private String[] getActivePaths(final Vector paths) {
    final Project p = getProject();
    if (p == null) {
        throw new java.lang.IllegalStateException("project not set");
    }
    final Vector activePaths = new Vector(paths.size());
    for (int i = 0; i < paths.size(); i++) {
        final ConditionalPath path = (ConditionalPath) paths.elementAt(i);
        if (path.isActive(p)) {
            final String[] pathEntries = path.list();
            for (final String pathEntrie : pathEntries) {
                activePaths.addElement(pathEntrie);
            }
        }
    }
    final String[] pathNames = new String[activePaths.size()];
    activePaths.copyInto(pathNames);
    return pathNames;
}

55. LinkerDef#getActiveLibrarySets()

Project: nar-maven-plugin
Source File: LinkerDef.java
View license
/**
   * Returns an array of active library sets for this linker definition.
   */
public LibrarySet[] getActiveLibrarySets(final LinkerDef[] defaultProviders, final int index) {
    if (isReference()) {
        return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef")).getActiveUserLibrarySets(defaultProviders, index);
    }
    final Project p = getProject();
    final Vector libsets = new Vector();
    for (int i = index; i < defaultProviders.length; i++) {
        defaultProviders[i].addActiveUserLibrarySets(p, libsets);
    }
    addActiveUserLibrarySets(p, libsets);
    for (int i = index; i < defaultProviders.length; i++) {
        defaultProviders[i].addActiveSystemLibrarySets(p, libsets);
    }
    addActiveSystemLibrarySets(p, libsets);
    final LibrarySet[] sets = new LibrarySet[libsets.size()];
    libsets.copyInto(sets);
    return sets;
}

56. LinkerDef#getActiveSystemLibrarySets()

Project: nar-maven-plugin
Source File: LinkerDef.java
View license
/**
   * Returns an array of active library sets for this linker definition.
   */
public LibrarySet[] getActiveSystemLibrarySets(final LinkerDef[] defaultProviders, final int index) {
    if (isReference()) {
        return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef")).getActiveUserLibrarySets(defaultProviders, index);
    }
    final Project p = getProject();
    final Vector libsets = new Vector();
    for (int i = index; i < defaultProviders.length; i++) {
        defaultProviders[i].addActiveSystemLibrarySets(p, libsets);
    }
    addActiveSystemLibrarySets(p, libsets);
    final LibrarySet[] sets = new LibrarySet[libsets.size()];
    libsets.copyInto(sets);
    return sets;
}

57. LinkerDef#getActiveUserLibrarySets()

Project: nar-maven-plugin
Source File: LinkerDef.java
View license
/**
   * Returns an array of active library sets for this linker definition.
   */
public LibrarySet[] getActiveUserLibrarySets(final LinkerDef[] defaultProviders, final int index) {
    if (isReference()) {
        return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef")).getActiveUserLibrarySets(defaultProviders, index);
    }
    final Project p = getProject();
    final Vector libsets = new Vector();
    for (int i = index; i < defaultProviders.length; i++) {
        defaultProviders[i].addActiveUserLibrarySets(p, libsets);
    }
    addActiveUserLibrarySets(p, libsets);
    final LibrarySet[] sets = new LibrarySet[libsets.size()];
    libsets.copyInto(sets);
    return sets;
}

58. ProcessorDef#getActiveProcessorArgs()

Project: nar-maven-plugin
Source File: ProcessorDef.java
View license
/**
   * Prepares list of processor arguments ( compilerarg, linkerarg ) that
   * are active for the current project settings.
   * 
   * @return active compiler arguments
   */
public CommandLineArgument[] getActiveProcessorArgs() {
    final Project p = getProject();
    if (p == null) {
        throw new java.lang.IllegalStateException("project must be set");
    }
    if (isReference()) {
        return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getActiveProcessorArgs();
    }
    final Vector activeArgs = new Vector(this.processorArgs.size());
    for (int i = 0; i < this.processorArgs.size(); i++) {
        final CommandLineArgument arg = (CommandLineArgument) this.processorArgs.elementAt(i);
        if (arg.isActive(p)) {
            activeArgs.addElement(arg);
        }
    }
    final CommandLineArgument[] array = new CommandLineArgument[activeArgs.size()];
    activeArgs.copyInto(array);
    return array;
}

59. ProcessorDef#getActiveProcessorParams()

Project: nar-maven-plugin
Source File: ProcessorDef.java
View license
/**
   * Prepares list of processor arguments ( compilerarg, linkerarg) that
   * are active for the current project settings.
   * 
   * @return active compiler arguments
   */
public ProcessorParam[] getActiveProcessorParams() {
    final Project p = getProject();
    if (p == null) {
        throw new java.lang.IllegalStateException("project must be set");
    }
    if (isReference()) {
        return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getActiveProcessorParams();
    }
    final Vector activeParams = new Vector(this.processorParams.size());
    for (int i = 0; i < this.processorParams.size(); i++) {
        final ProcessorParam param = (ProcessorParam) this.processorParams.elementAt(i);
        if (param.isActive(p)) {
            activeParams.addElement(param);
        }
    }
    final ProcessorParam[] array = new ProcessorParam[activeParams.size()];
    activeParams.copyInto(array);
    return array;
}

60. ProcessorDef#getDefaultProviders()

Project: nar-maven-plugin
Source File: ProcessorDef.java
View license
/**
   * Creates an chain of objects which provide default values in descending
   * order of significance.
   * 
   * @param baseDef
   *          corresponding ProcessorDef from CCTask, will be last element
   *          in array unless inherit = false
   * @return default provider array
   * 
   */
protected final ProcessorDef[] getDefaultProviders(final ProcessorDef baseDef) {
    ProcessorDef extendsDef = getExtends();
    final Vector chain = new Vector();
    while (extendsDef != null && !chain.contains(extendsDef)) {
        chain.addElement(extendsDef);
        extendsDef = extendsDef.getExtends();
    }
    if (baseDef != null && getInherit()) {
        chain.addElement(baseDef);
    }
    final ProcessorDef[] defaultProviders = new ProcessorDef[chain.size()];
    chain.copyInto(defaultProviders);
    return defaultProviders;
}

61. WebDAVSource#getSourceProperty()

Project: cocoon
Source File: WebDAVSource.java
View license
/**
     * Returns a property from a source.
     *
     * @param namespace Namespace of the property
     * @param name Name of the property
     *
     * @return Property of the source.
     *
     * @throws SourceException If an exception occurs.
     */
public SourceProperty getSourceProperty(String namespace, String name) throws SourceException {
    initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0);
    Vector propNames = new Vector(1);
    propNames.add(new PropertyName(namespace, name));
    Enumeration props = null;
    org.apache.webdav.lib.Property prop = null;
    try {
        Enumeration responses = this.resource.propfindMethod(0, propNames);
        while (responses.hasMoreElements()) {
            ResponseEntity response = (ResponseEntity) responses.nextElement();
            props = response.getProperties();
            if (props.hasMoreElements()) {
                prop = (Property) props.nextElement();
                return new SourceProperty(prop.getElement());
            }
        }
    } catch (Exception e) {
        throw new SourceException("Error getting property: " + name, e);
    }
    return null;
}

62. WebDAVUtil#getProperty()

Project: cocoon
Source File: WebDAVUtil.java
View license
/**
     * get a property 
     * 
     * @param uri  the URI to get the property from
     * @param name  the name of the property
     * @param namespace  the namespace of the property
     * @throws HttpException
     * @throws IOException
     */
public static SourceProperty getProperty(String uri, String name, String namespace) throws HttpException, IOException {
    Vector propNames = new Vector(1);
    propNames.add(new PropertyName(namespace, name));
    Enumeration props = null;
    Property prop = null;
    WebdavResource resource = WebDAVUtil.getWebdavResource(uri);
    Enumeration responses = resource.propfindMethod(0, propNames);
    while (responses.hasMoreElements()) {
        ResponseEntity response = (ResponseEntity) responses.nextElement();
        props = response.getProperties();
        if (props.hasMoreElements()) {
            prop = (Property) props.nextElement();
            return new SourceProperty(prop.getElement());
        }
    }
    return null;
}

63. MultipartParser#parseInlinePart()

Project: cocoon
Source File: MultipartParser.java
View license
/**
     * Parse an inline part
     *
     * @param in
     * @param headers
     *
     * @throws IOException
     */
private void parseInlinePart(TokenStream in, Hashtable headers) throws IOException {
    // Buffer incoming bytes for proper string decoding (there can be multibyte chars)
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    while (in.getState() == TokenStream.STATE_READING) {
        int c = in.read();
        if (c != -1)
            bos.write(c);
    }
    String field = (String) headers.get("name");
    Vector v = (Vector) this.parts.get(field);
    if (v == null) {
        v = new Vector();
        this.parts.put(field, v);
    }
    v.add(new String(bos.toByteArray(), this.characterEncoding));
}

64. CacheMap#getKeysInCache()

Project: CodenameOne
Source File: CacheMap.java
View license
/**
     * Returns the keys for all the objects currently in cache, this is useful
     * to traverse all the objects and refresh them without actually deleting
     * the cache and fetching them from scratch.<br>
     * <b>Important</b> this vector is a copy of a current state, keys might 
     * not exist anymore or might change, others might be added in the interim.
     * 
     * @return a vector containing a snapshot of the current elements within the 
     * cache.
     */
public Vector getKeysInCache() {
    Vector r = new Vector();
    Enumeration en = memoryCache.keys();
    while (en.hasMoreElements()) {
        r.addElement(en.nextElement());
    }
    Vector storageCacheContent = getStorageCacheContent();
    for (int iter = 0; iter < storageCacheContent.size(); iter++) {
        Object[] o = (Object[]) storageCacheContent.elementAt(iter);
        if (!r.contains(o[1])) {
            r.addElement(o[1]);
        }
    }
    return r;
}

65. Util#split()

Project: CodenameOne
Source File: Util.java
View license
/**
     * Provides a utility method breaks a given String to array of String according 
     * to the given separator
     * @param original the String to break
     * @param separator the pattern to look in the original String
     * @return array of Strings from the original String
     */
public static String[] split(String original, String separator) {
    Vector nodes = new Vector();
    int index = original.indexOf(separator);
    while (index >= 0) {
        nodes.addElement(original.substring(0, index));
        original = original.substring(index + separator.length());
        index = original.indexOf(separator);
    }
    nodes.addElement(original);
    String[] ret = new String[nodes.size()];
    for (int i = 0; i < nodes.size(); i++) {
        ret[i] = (String) nodes.elementAt(i);
    }
    return ret;
}

66. CSSEngine#setWrapText()

Project: CodenameOne
Source File: CSSEngine.java
View license
/**
     * Replaces an unwrapped text with a wrapped version, while copying the style of the original text.
     * 
     * @param label The current label that contains the unwrapped text
     * @param words A vector containing one word of the text (without white spaces) in each element
     * @param element The text element
     */
private void setWrapText(Label label, Vector words, HTMLElement element, HTMLComponent htmlC) {
    Style selectedStyle = label.getSelectedStyle();
    Style unselectedStyle = label.getUnselectedStyle();
    Vector ui = new Vector();
    label.setText((String) words.elementAt(0) + ' ');
    HTMLLink link = null;
    if (label instanceof HTMLLink) {
        link = (HTMLLink) label;
    }
    ui.addElement(label);
    for (int i = 1; i < words.size(); i++) {
        Label word = null;
        if (link != null) {
            word = new HTMLLink((String) words.elementAt(i) + ' ', link.link, htmlC, link, link.linkVisited);
        } else {
            word = new Label((String) words.elementAt(i) + ' ');
        }
        word.setSelectedStyle(selectedStyle);
        word.setUnselectedStyle(unselectedStyle);
        label.getParent().addComponent(word);
        ui.addElement(word);
    }
    element.setAssociatedComponents(ui);
    label.getParent().revalidate();
}

67. UIBuilder#get()

Project: CodenameOne
Source File: UIBuilder.java
View license
public Form get(Object... args) {
    String n = parent.getPreviousFormName(f);
    final Form f = parent.createForm((Form) parent.createContainer(parent.fetchResourceFile(), n));
    ;
    if (h != null) {
        parent.setFormState(f, h);
        parent.setBackCommand(f, backCommand);
    }
    f.addShowListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            parent.postShow(f);
        }
    });
    Vector formNavigationStack = parent.baseFormNavigationStack;
    formNavigationStack.remove(formNavigationStack.size() - 1);
    parent.beforeShow(f);
    return f;
}

68. TorrentLog#execute()

View license
public void execute(String commandName, ConsoleInput ci, List<String> args) {
    mode = MODE_ON;
    Vector newargs = new Vector(args);
    if (newargs.isEmpty()) {
        mode = MODE_FLIP;
    } else if (newargs.contains("off")) {
        newargs.removeElement("off");
        mode = MODE_OFF;
    } else if (!newargs.contains("on")) {
        mode = MODE_FLIP;
    }
    super.execute(commandName, ci, args);
}

69. CmdLineParser#addValue()

View license
private void addValue(Option opt, Object value) {
    String lf = opt.longForm();
    Vector v = (Vector) values.get(lf);
    if (v == null) {
        v = new Vector();
        values.put(lf, v);
    }
    v.addElement(value);
}

70. EnumerationDeserializer#readList()

Project: dubbo
Source File: EnumerationDeserializer.java
View license
public Object readList(AbstractHessianInput in, int length) throws IOException {
    Vector list = new Vector();
    in.addRef(list);
    while (!in.isEnd()) list.add(in.readObject());
    in.readEnd();
    return list.elements();
}

71. Gray8ConnComp#getComponentPixels()

Project: gast-lib
Source File: Gray8ConnComp.java
View license
public Enumeration getComponentPixels(int n) throws Error {
    Rect r = getComponent(n);
    // build a Vector of all points in the component
    Vector vPoints = new Vector();
    short[] sData = this.imLabeled.getData();
    int nLabel = this.rSortedLabels[n].nLabel;
    for (int i = r.getTop(); i <= r.getBottom(); i++) {
        for (int j = r.getLeft(); j <= r.getRight(); j++) {
            if (sData[i * this.imLabeled.getWidth() + j] == nLabel) {
                vPoints.addElement(new Point(j, i));
            }
        }
    }
    return vPoints.elements();
}

72. Resolver#resolveAllSystemReverse()

Project: openjdk
Source File: Resolver.java
View license
/**
     * Find the URNs for a given system identifier in all catalogs.
     *
     * @param systemId The system ID to locate.
     *
     * @return A vector of URNs that map to the systemId.
     */
public Vector resolveAllSystemReverse(String systemId) throws MalformedURLException, IOException {
    Vector resolved = new Vector();
    // If there's a SYSTEM entry in this catalog, use it
    if (systemId != null) {
        Vector localResolved = resolveLocalSystemReverse(systemId);
        resolved = appendVector(resolved, localResolved);
    }
    // Otherwise, look in the subordinate catalogs
    Vector subResolved = resolveAllSubordinateCatalogs(SYSTEMREVERSE, null, null, systemId);
    return appendVector(resolved, subResolved);
}

73. Resolver#resolveAllSystem()

Project: openjdk
Source File: Resolver.java
View license
/**
     * Return the applicable SYSTEM system identifiers.
     *
     * <p>If one or more SYSTEM entries exists in the Catalog
     * for the system ID specified, return the mapped values.</p>
     *
     * <p>The caller is responsible for doing any necessary
     * normalization of the system identifier before calling
     * this method. For example, a relative system identifier in
     * a document might be converted to an absolute system identifier
     * before attempting to resolve it.</p>
     *
     * <p>Note that this function will force all subordinate catalogs
     * to be loaded.</p>
     *
     * <p>On Windows-based operating systems, the comparison between
     * the system identifier provided and the SYSTEM entries in the
     * Catalog is case-insensitive.</p>
     *
     * @param systemId The system ID to locate in the catalog.
     *
     * @return The system identifier to use for the notation.
     *
     * @throws MalformedURLException The formal system identifier of a
     * subordinate catalog cannot be turned into a valid URL.
     * @throws IOException Error reading subordinate catalog file.
     */
public Vector resolveAllSystem(String systemId) throws MalformedURLException, IOException {
    Vector resolutions = new Vector();
    // If there are SYSTEM entries in this catalog, start with them
    if (systemId != null) {
        Vector localResolutions = resolveAllLocalSystem(systemId);
        resolutions = appendVector(resolutions, localResolutions);
    }
    // Then look in the subordinate catalogs
    Vector subResolutions = resolveAllSubordinateCatalogs(SYSTEM, null, null, systemId);
    resolutions = appendVector(resolutions, subResolutions);
    if (resolutions.size() > 0) {
        return resolutions;
    } else {
        return null;
    }
}

74. NamespaceSupport#getPrefixes()

Project: openjdk
Source File: NamespaceSupport.java
View license
/**
     * Return an enumeration of all prefixes for a given URI whose
     * declarations are active in the current context.
     * This includes declarations from parent contexts that have
     * not been overridden.
     *
     * <p>This method returns prefixes mapped to a specific Namespace
     * URI.  The xml: prefix will be included.  If you want only one
     * prefix that's mapped to the Namespace URI, and you don't care
     * which one you get, use the {@link #getPrefix getPrefix}
     *  method instead.</p>
     *
     * <p><strong>Note:</strong> the empty (default) prefix is <em>never</em> included
     * in this enumeration; to check for the presence of a default
     * Namespace, use the {@link #getURI getURI} method with an
     * argument of "".</p>
     *
     * @param uri The Namespace URI.
     * @return An enumeration of prefixes (never empty).
     * @see #getPrefix
     * @see #getDeclaredPrefixes
     * @see #getURI
     */
public Enumeration getPrefixes(String uri) {
    Vector prefixes = new Vector();
    Enumeration allPrefixes = getPrefixes();
    while (allPrefixes.hasMoreElements()) {
        String prefix = (String) allPrefixes.nextElement();
        if (uri.equals(getURI(prefix))) {
            prefixes.addElement(prefix);
        }
    }
    return prefixes.elements();
}

75. MimeHeaders#getHeader()

Project: openjdk
Source File: MimeHeaders.java
View license
/**
     * Returns all of the values for the specified header as an array of
     * {@code String} objects.
     *
     * @param   name the name of the header for which values will be returned
     * @return a {@code String} array with all of the values for the
     *         specified header
     * @see #setHeader
     */
public String[] getHeader(String name) {
    Vector values = new Vector();
    for (int i = 0; i < headers.size(); i++) {
        MimeHeader hdr = (MimeHeader) headers.elementAt(i);
        if (hdr.getName().equalsIgnoreCase(name) && hdr.getValue() != null)
            values.addElement(hdr.getValue());
    }
    if (values.size() == 0)
        return null;
    String r[] = new String[values.size()];
    values.copyInto(r);
    return r;
}

76. File#jsFunction_readLines()

Project: pad
Source File: File.java
View license
/**
     * Read the remaining lines in the file and return them in an array.
     *
     * Implements a JavaScript function.<p>
     *
     * This is a good example of creating a new array and setting
     * elements in that array.
     *
     * @exception IOException if an error occurred while accessing the file
     *            associated with this object
     */
public Object jsFunction_readLines() throws IOException {
    Vector v = new Vector();
    String s;
    while ((s = jsFunction_readLine()) != null) {
        v.addElement(s);
    }
    Object[] lines = new Object[v.size()];
    v.copyInto(lines);
    Scriptable scope = ScriptableObject.getTopLevelScope(this);
    Context cx = Context.getCurrentContext();
    return cx.newObject(scope, "Array", lines);
}

77. ZqlJJParser#SQLExpressionList()

Project: railo
Source File: ZqlJJParser.java
View license
public final Vector SQLExpressionList() throws ParseException {
    Vector vector = new Vector(8);
    ZExp zexp = SQLSimpleExpressionOrPreparedCol();
    vector.addElement(zexp);
    label0: do switch(jj_ntk != -1 ? jj_ntk : jj_ntk()) {
        default:
            jj_la1[73] = jj_gen;
            break label0;
        case // 'Y'
        89:
            jj_consume_token(89);
            ZExp zexp1 = SQLSimpleExpressionOrPreparedCol();
            vector.addElement(zexp1);
            break;
    } while (true);
    return vector;
}

78. CodeGenerationUtility#convertToSchemaArray()

View license
/**
     * Converts a given vector of schemaDocuments to XmlBeans processable schema objects. One
     * drawback we have here is the non-inclusion of untargeted namespaces
     *
     * @param vec
     * @return schema array
     */
private static SchemaDocument.Schema[] convertToSchemaArray(List vec) {
    SchemaDocument[] schemaDocuments = (SchemaDocument[]) vec.toArray(new SchemaDocument[vec.size()]);
    //remove duplicates
    Vector uniqueSchemas = new Vector(schemaDocuments.length);
    Vector uniqueSchemaTns = new Vector(schemaDocuments.length);
    SchemaDocument.Schema s;
    for (int i = 0; i < schemaDocuments.length; i++) {
        s = schemaDocuments[i].getSchema();
        if (!uniqueSchemaTns.contains(s.getTargetNamespace())) {
            uniqueSchemas.add(s);
            uniqueSchemaTns.add(s.getTargetNamespace());
        } else if (s.getTargetNamespace() == null) {
            uniqueSchemas.add(s);
        }
    }
    return (SchemaDocument.Schema[]) uniqueSchemas.toArray(new SchemaDocument.Schema[uniqueSchemas.size()]);
}

79. Which#parse()

Project: which
Source File: Which.java
View license
protected String[] parse(String path) {
    String pathSeparator = System.getProperty("path.separator");
    Vector pathList = new Vector();
    StringTokenizer pathTokenizer = new StringTokenizer(path, pathSeparator);
    while (pathTokenizer.hasMoreTokens()) {
        String pathElement = pathTokenizer.nextToken();
        pathList.addElement(pathElement);
    }
    String[] paths = new String[pathList.size()];
    pathList.copyInto(paths);
    return paths;
}

80. Which#parse()

Project: which
Source File: Which.java
View license
protected String[] parse(String path, String pathSeparator) {
    Vector pathList = new Vector();
    StringTokenizer pathTokenizer = new StringTokenizer(path, pathSeparator);
    while (pathTokenizer.hasMoreTokens()) {
        String pathElement = pathTokenizer.nextToken();
        pathList.addElement(pathElement);
    }
    String[] paths = new String[pathList.size()];
    pathList.copyInto(paths);
    return paths;
}

81. CPWSImplServiceTestCase#testCPWebServicesWSDL()

View license
/** Test case for Bug 25161
	  	Axis 1.2 alpha WSDL xsd types problem prevent .Net integration */
public void testCPWebServicesWSDL() throws Exception {
    URL url = HttpTestUtil.getTestEndpoint(new test.wsdl.xsd.CPWSImplServiceLocator().getCPWebServicesAddress());
    Parser wsdlParser = new Parser();
    System.out.println("Reading WSDL document from '" + url + "?WSDL'");
    wsdlParser.run(url + "?WSDL");
    SymbolTable symbolTable = wsdlParser.getSymbolTable();
    Vector v = symbolTable.getSymbols(new QName("http://datatypes.cs.amdocs.com", "CSText"));
    DefinedType type = (DefinedType) v.get(0);
    assertNotNull(type);
    Vector v2 = SchemaUtils.getContainedElementDeclarations(type.getNode(), symbolTable);
    ElementDecl element = (ElementDecl) v2.get(0);
    assertNotNull(element);
    assertEquals(Constants.XSD_STRING, element.getType().getQName());
}

82. TestRoundTrip#checkRoundTrip()

Project: axis1-java
Source File: TestRoundTrip.java
View license
protected void checkRoundTrip(String xml1) throws Exception {
    Message message = new Message(xml1);
    message.setMessageContext(new MessageContext(server));
    SOAPEnvelope envelope = (SOAPEnvelope) message.getSOAPEnvelope();
    RPCElement body = (RPCElement) envelope.getFirstBody();
    Vector arglist = body.getParams();
    Object ret1 = ((RPCParam) arglist.get(0)).getObjectValue();
    String xml2 = message.getSOAPPartAsString();
    Message message2 = new Message(xml2);
    message2.setMessageContext(new MessageContext(server));
    SOAPEnvelope envelope2 = (SOAPEnvelope) message2.getSOAPEnvelope();
    RPCElement body2 = (RPCElement) envelope2.getFirstBody();
    Vector arglist2 = body2.getParams();
    Object ret2 = ((RPCParam) arglist2.get(0)).getObjectValue();
    if (!equals(ret1, ret2)) {
        assertEquals("The result is not what is expected.", ret1, ret2);
    }
}

83. SOAPHeader#examineMustUnderstandHeaderElements()

Project: axis1-java
Source File: SOAPHeader.java
View license
public Iterator examineMustUnderstandHeaderElements(String actor) {
    if (actor == null)
        return null;
    Vector result = new Vector();
    List headers = getChildren();
    if (headers != null) {
        for (int i = 0; i < headers.size(); i++) {
            SOAPHeaderElement she = (SOAPHeaderElement) headers.get(i);
            if (she.getMustUnderstand()) {
                String candidate = she.getActor();
                if (actor.equals(candidate)) {
                    result.add(headers.get(i));
                }
            }
        }
    }
    return result.iterator();
}

84. MessageElement#getChildElements()

Project: axis1-java
Source File: MessageElement.java
View license
/**
     * get an iterator over child elements
     * @param qname namespace/element name of parts to find.
     * This iterator is not (currently) susceptible to change in the element
     * list during its lifetime, though changes in the contents of the elements
     * are picked up.
     * @return an iterator.
     */
public Iterator getChildElements(QName qname) {
    initializeChildren();
    int num = children.size();
    Vector c = new Vector(num);
    for (int i = 0; i < num; i++) {
        MessageElement child = (MessageElement) children.get(i);
        Name cname = child.getElementName();
        if (cname.getURI().equals(qname.getNamespaceURI()) && cname.getLocalName().equals(qname.getLocalPart())) {
            c.add(child);
        }
    }
    return c.iterator();
}

85. MessageElement#getAllAttributes()

Project: axis1-java
Source File: MessageElement.java
View license
/**
     * Get an interator to all the attributes of the node.
     * The iterator is over a static snapshot of the node names; if attributes
     * are added or deleted during the iteration, this iterator will be not
     * be updated to follow the changes.
     * @return an iterator of the attributes.
     * @see javax.xml.soap.SOAPElement#getAllAttributes()
     */
public Iterator getAllAttributes() {
    int num = attributes.getLength();
    Vector attrs = new Vector(num);
    for (int i = 0; i < num; i++) {
        String q = attributes.getQName(i);
        String prefix = "";
        if (q != null) {
            int idx = q.indexOf(":");
            if (idx > 0) {
                prefix = q.substring(0, idx);
            } else {
                prefix = "";
            }
        }
        attrs.add(new PrefixedQName(attributes.getURI(i), attributes.getLocalName(i), prefix));
    }
    return attrs.iterator();
}

86. MessageElement#getVisibleNamespacePrefixes()

Project: axis1-java
Source File: MessageElement.java
View license
/**
     * get an iterator over visible prefixes. This includes all declared in
     * parent elements
     * @return an iterator.
     */
public Iterator getVisibleNamespacePrefixes() {
    Vector prefixes = new Vector();
    // Add all parents namespace definitions
    if (parent != null) {
        Iterator parentsPrefixes = ((MessageElement) parent).getVisibleNamespacePrefixes();
        if (parentsPrefixes != null) {
            while (parentsPrefixes.hasNext()) {
                prefixes.add(parentsPrefixes.next());
            }
        }
    }
    Iterator mine = getNamespacePrefixes();
    if (mine != null) {
        while (mine.hasNext()) {
            prefixes.add(mine.next());
        }
    }
    return prefixes.iterator();
}

87. VectorDeserializer#setChildValue()

Project: axis1-java
Source File: VectorDeserializer.java
View license
/**
     * The registerValueTarget code above causes this set function to be invoked when
     * each value is known.
     * @param value is the value of an element
     * @param hint is an Integer containing the index
     */
public void setChildValue(Object value, Object hint) throws SAXException {
    if (log.isDebugEnabled()) {
        log.debug(Messages.getMessage("gotValue00", "VectorDeserializer", "" + value));
    }
    int offset = ((Integer) hint).intValue();
    Vector v = (Vector) this.value;
    // If the vector is too small, grow it 
    if (offset >= v.size()) {
        v.setSize(offset + 1);
    }
    v.setElementAt(value, offset);
}

88. WSDDElement#getChildElements()

Project: axis1-java
Source File: WSDDElement.java
View license
public Element[] getChildElements(Element e, String name) {
    NodeList nl = e.getChildNodes();
    Vector els = new Vector();
    for (int i = 0; i < nl.getLength(); i++) {
        Node thisNode = nl.item(i);
        if (!(thisNode instanceof Element))
            continue;
        Element el = (Element) thisNode;
        if (el.getLocalName().equals(name)) {
            els.add(el);
        }
    }
    Element[] elements = new Element[els.size()];
    els.toArray(elements);
    return elements;
}

89. JavaTypeWriter#getBeanWriter()

Project: axis1-java
Source File: JavaTypeWriter.java
View license
/**
     * getBeanWriter
     * 
     * @param emitter    
     * @param type       
     * @param base       
     * @return 
     */
protected JavaWriter getBeanWriter(Emitter emitter, TypeEntry type, TypeEntry base) {
    // CONTAINED_ELEM_AND_ATTR
    Vector elements = type.getContainedElements();
    Vector attributes = type.getContainedAttributes();
    // class
    if (Utils.isFaultComplex(type)) {
        return new JavaBeanFaultWriter(emitter, type, elements, base, attributes, getBeanHelperWriter(emitter, type, elements, base, attributes, true));
    }
    return new JavaBeanWriter(emitter, type, elements, base, attributes, getBeanHelperWriter(emitter, type, elements, base, attributes, false));
}

90. VCalendar10Format#decode()

Project: pluotsorbet
Source File: VCalendar10Format.java
View license
/**
     * Constructs one or more PIMItems from serialized data.
     * @param in Stream containing serialized data
     * @param encoding Character encoding of the stream
     * @param list PIMList to which items should be added, or null if the items
     * should not be part of a list
     * @throws UnsupportedPIMFormatException if the serialized
     * data cannot be interpreted by this encoding.
     * @return a non-empty array of PIMItems containing the objects described
     * in the serialized data, or null if no items are available
     * @throws IOException if a read error occurs
     */
public PIMItem[] decode(InputStream in, String encoding, PIMList list) throws IOException {
    LineReader r = new LineReader(in, encoding, this);
    String line = r.readLine();
    if (line == null) {
        return null;
    }
    if (!line.toUpperCase().equals("BEGIN:VCALENDAR")) {
        throw new UnsupportedPIMFormatException("Not a vCalendar object");
    }
    Vector items = new Vector();
    for (AbstractPIMItem item; (item = decode(r, list)) != null; ) {
        items.addElement(item);
    }
    if (items.size() == 0) {
        return null;
    }
    AbstractPIMItem[] a = new AbstractPIMItem[items.size()];
    items.copyInto(a);
    return a;
}

91. Parser_Nmon_Tokenized#splitLine()

Project: pGraph
Source File: Parser_Nmon_Tokenized.java
View license
/*
	 * Input line is a set of tokens delimited by a comma character.
	 * Create a Vector containing the ordered set of String tokens
	 */
private Vector splitLine(String s) {
    Vector result = new Vector();
    // first token's char 
    int begin = 0;
    // last token's char
    int end;
    // Get each token, except for last one
    while ((end = s.indexOf(',', begin)) >= 0) {
        result.add(s.substring(begin, end));
        begin = end + 1;
    }
    // Manage last token
    result.add(s.substring(begin));
    return result;
}

92. RE#grep()

Project: pluotsorbet
Source File: RE.java
View license
/**
     * Returns an array of Strings, whose toString representation matches a regular
     * expression. This method works like the Perl function of the same name.  Given
     * a regular expression of "a*b" and an array of String objects of [foo, aab, zzz,
     * aaaab], the array of Strings returned by grep would be [aab, aaaab].
     *
     * @param search Array of Objects to search
     * @return Array of Strings whose toString() value matches this regular expression.
     */
public String[] grep(Object[] search) {
    // Create new vector to hold return items
    Vector v = new Vector();
    // Traverse array of objects
    for (int i = 0; i < search.length; i++) {
        // Get next object as a string
        String s = search[i].toString();
        // If it matches this regexp, add it to the list
        if (match(s)) {
            v.addElement(s);
        }
    }
    // Return vector as an array of strings
    String[] ret = new String[v.size()];
    v.copyInto(ret);
    return ret;
}

93. LandmarkStore#getLandmarks()

Project: pluotsorbet
Source File: LandmarkStore.java
View license
// JAVADOC COMMENT ELIDED
public Enumeration getLandmarks(String category, String name) throws IOException {
    Enumeration en = LocationPersistentStorage.getLandmarksEnumeration(storeName, category, name, -90, 90, -180, 180);
    if (en == null) {
        return null;
    }
    Vector vecLandmarks = new Vector();
    while (en.hasMoreElements()) {
        vecLandmarks.addElement(new Landmark((LandmarkImpl) en.nextElement()));
    }
    return vecLandmarks.elements();
}

94. SensorRegistry#findSensors()

Project: pluotsorbet
Source File: SensorRegistry.java
View license
public static SensorInfo[] findSensors(String quantity, String contextType) {
    if (contextType != null && !SensorInfo.CONTEXT_TYPE_AMBIENT.equals(contextType) && !SensorInfo.CONTEXT_TYPE_DEVICE.equals(contextType) && !SensorInfo.CONTEXT_TYPE_USER.equals(contextType)) {
        throw new IllegalArgumentException("Illegal contextType");
    }
    if (quantity == null && contextType == null) {
        return getAllSensors();
    }
    Vector mv = new Vector(sensorsCache.length);
    for (int i = 0; i < sensorsCache.length; i++) {
        Sensor s = sensorsCache[i];
        if (s.matches(quantity, contextType)) {
            mv.addElement(s);
        }
    }
    SensorInfo[] matches = new SensorInfo[mv.size()];
    mv.copyInto(matches);
    return matches;
}

95. SensorRegistry#findSensors()

Project: pluotsorbet
Source File: SensorRegistry.java
View license
public static Sensor[] findSensors(SensorUrl su) {
    Vector mv = new Vector(sensorsCache.length);
    for (int i = 0; i < sensorsCache.length; i++) {
        Sensor s = sensorsCache[i];
        if (s.matches(su)) {
            mv.addElement(s);
        }
    }
    Sensor[] matches = new Sensor[mv.size()];
    mv.copyInto(matches);
    return matches;
}

96. InterfaceTest#test()

Project: pluotsorbet
Source File: InterfaceTest.java
View license
public void test(TestHarness th) {
    InterfaceTest.th = th;
    X x = new X();
    C c = x;
    c.x();
    B b = x;
    b.x();
    A a = x;
    a.x();
    Vector vec = new Vector();
    vec.addElement(x);
    C c2 = (C) vec.elementAt(0);
    c2.x();
    B b2 = (B) vec.elementAt(0);
    b2.x();
    A a2 = (A) vec.elementAt(0);
    a2.x();
}

97. ZqlJJParser#FromClause()

Project: railo
Source File: ZqlJJParser.java
View license
public final Vector FromClause() throws ParseException {
    Vector vector = new Vector(8);
    jj_consume_token(29);
    ZFromItem zfromitem = FromItem();
    vector.addElement(zfromitem);
    label0: do switch(jj_ntk != -1 ? jj_ntk : jj_ntk()) {
        default:
            jj_la1[48] = jj_gen;
            break label0;
        case // 'Y'
        89:
            jj_consume_token(89);
            ZFromItem zfromitem1 = FromItem();
            vector.addElement(zfromitem1);
            break;
    } while (true);
    return vector;
}

98. TestInterfaceAbstractConcrete#test()

View license
public void test(TestHarness th) {
    this.th = th;
    // invokevirtual
    Con con = new Con();
    con.method();
    Vector vec = new Vector();
    vec.addElement(con);
    // checkcast
    Int inter = (Int) vec.elementAt(0);
    // invokeinterface
    inter.a();
    // checkcast
    Abs abs = (Abs) vec.elementAt(0);
    // invokevirtual
    abs.a();
}

99. Parser_Nmon#splitLine()

Project: pGraph
Source File: Parser_Nmon.java
View license
/*
	 * Input line is a set of tokens delimited by a comma character.
	 * Create a Vector containing the ordered set of String tokens
	 */
@SuppressWarnings("unchecked")
private Vector splitLine(String s) {
    Vector result = new Vector();
    // first token's char 
    int begin = 0;
    // last token's char
    int end;
    // Get each token, except for last one
    while ((end = s.indexOf(',', begin)) >= 0) {
        result.add(s.substring(begin, end));
        begin = end + 1;
    }
    // Manage last token
    result.add(s.substring(begin));
    return result;
}

100. BasicPlayer#getControls()

Project: pluotsorbet
Source File: BasicPlayer.java
View license
// "final" to verify that no subclass overrides getControls.
// can be removed if overload necessary
/**
     *  Gets the controls attribute of the BasicPlayer object
     *
     * @return    The controls value
     */
public final Control[] getControls() {
    chkClosed(true);
    Vector v = new Vector(3);
    // average maximum number of controls
    String[] ctrlNames = getPossibleControlNames();
    for (int i = 0; i < ctrlNames.length; i++) {
        Object c = getControl(ctrlNames[i]);
        if ((c != null) && !v.contains(c)) {
            v.addElement(c);
        }
    }
    Control[] ret = new Control[v.size()];
    v.copyInto(ret);
    return ret;
}