List of usage examples for java.util Vector elements
public Enumeration<E> elements()
From source file:org.apache.jmeter.util.JMeterUtils.java
/** * Instantiate a vector of classes/*from w ww . j a v a2 s . c o m*/ * * @param v * Description of Parameter * @param className * Description of Parameter * @return Description of the Returned Value * @deprecated (3.0) not used out of this class */ @Deprecated public static Vector<Object> instantiate(Vector<String> v, String className) { Vector<Object> i = new Vector<>(); try { Class<?> c = Class.forName(className); Enumeration<String> elements = v.elements(); while (elements.hasMoreElements()) { String name = elements.nextElement(); try { Object o = Class.forName(name).newInstance(); if (c.isInstance(o)) { i.addElement(o); } } catch (ClassNotFoundException e) { log.error("Error loading class " + name + ": class is not found"); } catch (IllegalAccessException e) { log.error("Error loading class " + name + ": does not have access"); } catch (InstantiationException e) { log.error("Error loading class " + name + ": could not instantiate"); } catch (NoClassDefFoundError e) { log.error("Error loading class " + name + ": couldn't find class " + e.getMessage()); } } } catch (ClassNotFoundException e) { log.error("Error loading class " + className + ": class is not found"); } return i; }
From source file:gov.nih.nci.caarray.domain.MultiPartBlob.java
/** * Returns an input stream to access the contents of this MultiPartBlob. * /*from w w w . j av a2 s. c o m*/ * @param uncompress true if the data should be uncompressed when read, false otherwise * @return the input stream to read. * @throws IOException if the contents couldn't be accessed. */ private InputStream readContents(boolean uncompress) throws IOException { try { final Vector<InputStream> isVector = new Vector<InputStream>(); // NOPMD for (final BlobHolder currentBlobHolder : getBlobParts()) { isVector.add(currentBlobHolder.getContents().getBinaryStream()); } final SequenceInputStream sequenceInputStream = new SequenceInputStream(isVector.elements()); if (uncompress) { return new GZIPInputStream(sequenceInputStream); } else { return sequenceInputStream; } } catch (final SQLException e) { throw new IllegalStateException("Couldn't access file contents", e); } }
From source file:org.apache.geode.internal.util.CollectionUtilsJUnitTest.java
@Test public void testAddAllCollectionEnumerationWithList() { final ArrayList<String> list = new ArrayList<>(4); list.add("one"); list.add("two"); final Vector<String> v = new Vector<>(); v.add("three"); v.add("four"); boolean modified = CollectionUtils.addAll(list, v.elements()); assertTrue(modified);/* w ww . ja va 2 s .c o m*/ assertEquals(4, list.size()); assertSame(v.get(0), list.get(2)); assertSame(v.get(1), list.get(3)); }
From source file:de.betterform.xml.xforms.model.constraints.DependencyGraph.java
private void removeNonZeroVertices() { Vector nonzeros = new Vector(); Enumeration enumeration = vertices.elements(); while (enumeration.hasMoreElements()) { Vertex v = (Vertex) enumeration.nextElement(); if (v.inDegree > 0) { nonzeros.addElement(v);//from www .j a v a2s . c o m } } enumeration = nonzeros.elements(); while (enumeration.hasMoreElements()) { Vertex v = (Vertex) enumeration.nextElement(); this.removeVertex(v); } }
From source file:org.alfresco.web.app.ResourceBundleWrapper.java
/** * @see java.util.ResourceBundle#getKeys() *///from w ww . j a v a 2s .c o m public Enumeration<String> getKeys() { if (getDelegates().size() == 1) { return getDelegates().get(0).getKeys(); } else { Vector<String> allKeys = new Vector<String>(100, 2); for (ResourceBundle delegate : getDelegates()) { Enumeration<String> keys = delegate.getKeys(); while (keys.hasMoreElements() == true) { allKeys.add(keys.nextElement()); } } return allKeys.elements(); } }
From source file:org.soaplab.services.AnalysisInventoryProvider.java
/************************************************************************** * *************************************************************************/ public String[] getAvailableAnalysesInCategory(String categoryName) { Set<String> result = new TreeSet<String>(); for (int i = 0; i < listProviders.length; i++) { Hashtable<String, Vector<AnalysisInstallation>> list = listProviders[i].getList(); Vector<AnalysisInstallation> apps = list.get(categoryName); if (apps == null) continue; String authority = getAuthorityAsPrefix(listProviders[i]); String prefix = authority + categoryName.trim(); if (!"".equals(prefix)) prefix += SoaplabConstants.SOAPLAB_SERVICE_NAME_DELIMITER; for (Enumeration<AnalysisInstallation> en2 = apps.elements(); en2.hasMoreElements();) { AnalysisInstallation app = en2.nextElement(); result.add(prefix + app.getAppName()); }//from w w w.j ava2 s . c o m } return result.toArray(new String[] {}); }
From source file:org.glite.slcs.shibclient.metadata.ShibbolethClientMetadata.java
/** * @return An enumeration of all <code>IdentityProvider</code> */// w w w .j av a2s . c o m public Enumeration<IdentityProvider> getIdentityProviders() { Vector<IdentityProvider> idps = new Vector<IdentityProvider>(); Iterator<Provider> providers = getProviders(); while (providers.hasNext()) { Provider provider = (Provider) providers.next(); if (provider instanceof IdentityProvider) { idps.add((IdentityProvider) provider); } } return idps.elements(); }
From source file:org.mnode.coucou.AbstractRepositoryTreeTableNode.java
/** * {@inheritDoc}/*from w w w . ja va 2 s . co m*/ */ @Override public final Enumeration<T> children() { Vector<T> children = new Vector<T>(); final Node node = (Node) getUserObject(); try { final NodeIterator nodes = node.getNodes(); while (nodes.hasNext()) { Node nextNode = nodes.nextNode(); children.add(createChildNode(nextNode)); } } catch (RepositoryException e) { LOG.log(LogEntries.NODE_ERROR, e, node); } return children.elements(); }
From source file:org.chiba.xml.xforms.constraints.MainDependencyGraph.java
/** * Adds a single bind's ref node to the Main Graph * called by MainDependencyGraph.buildBindGraph() *///from w ww .j a v a 2s . c o m private void addReferredNodesToGraph(JXPathContext relativeContext, NodeImpl instanceNode, String expression, short property) { //creates a new vertex for this Node or return it, in case it already existed Vertex vertex = this.addVertex(relativeContext, instanceNode, expression, property); boolean hadVertex = vertex.wasAlreadyInGraph; vertex.wasAlreadyInGraph = false; // Analyze the Xpath Expression 'calculate'. Read nodeset RefNS // (the nodes this XPAth references) String xpath = vertex.getXPathExpression(); if ((xpath == null) || (xpath.length() == 0)) { // bind without xpath, remove vertex if (hadVertex == false) { this.removeVertex(vertex); } return; } //Analyse xpath-expression to determine the Referenced dataitems Vector refns = this.getXPathRefNodes(relativeContext, xpath); if (refns == null) { return; } if (refns.size() == 0) { // this is a calculated value, that is not depending on anything, let's calculate it now vertex.compute(); } Enumeration enumeration = refns.elements(); while (enumeration.hasMoreElements()) { NodeImpl referencedNode = (NodeImpl) enumeration.nextElement(); // pre-build vertex Vertex refVertex = this.addVertex(null, referencedNode, null, Vertex.CALCULATE_VERTEX); this.addEdge(refVertex, vertex); } }
From source file:org.infoglue.deliver.portal.information.ServletRequestIG.java
public Enumeration getAttributeNames() { Vector v = new Vector(); for (Iterator iter = attributeMap.keySet().iterator(); iter.hasNext();) { v.add(iter.next());//from w w w .ja v a2s .c o m } for (Enumeration enumeration = super.getAttributeNames(); enumeration.hasMoreElements();) { v.add(enumeration.nextElement()); } for (Enumeration enumeration = super.getRequest().getAttributeNames(); enumeration.hasMoreElements();) { v.add(enumeration.nextElement()); } return v.elements(); }