ZipEntryRO[] getEntriesAt(String path) { Vector<ZipEntryRO> zev = new Vector<ZipEntryRO>(); Collection<ZipEntryRO> values = mHashMap.values(); if (null == path) path = ""; int length = path.length(); for (ZipEntryRO ze : values) { if (ze.mFileName.startsWith(path)) { if (-1 == ze.mFileName.indexOf('/', length)) { zev.add(ze); } } } ZipEntryRO[] entries = new ZipEntryRO[zev.size()]; return zev.toArray(entries); }
public static Object[] sortOnValue(Hashtable<String, Double> map, boolean desc) { Enumeration <String> key = map.keys(); String keyE = null; Vector <ValueSorter> vsv = new Vector <ValueSorter> (); while (key.hasMoreElements() == true ){ keyE = key.nextElement(); ValueSorter vs = new ValueSorter(keyE, map.get(keyE)); vsv.add(vs); } Collections.sort(vsv); //ascending order if (desc == true) { Collections.reverse(vsv); } Object[] obj = new Object[vsv.size()]; for ( int i=0; i <vsv.size(); i++ ) { ValueSorter vs = vsv.get(i); String keyv = vs.get_key(); obj[i] = keyv; } return obj; }
/** * Returns a Map of the known resources for the given locale. */ private Map<String, String> getResourceCache(Locale l) { Map<String, String> values = resourceCache.get(l); if (values == null) { values = new HashMap<String, String>(); for (int i=resourceBundles.size()-1; i >= 0; i--) { String bundleName = resourceBundles.get(i); try { ResourceBundle b = ResourceBundle. getBundle(bundleName, l, UIManagerExt.class.getClassLoader()); Enumeration<String> keys = b.getKeys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if (values.get(key) == null) { Object value = b.getObject(key); values.put(key, (String) value); } } } catch( MissingResourceException mre ) { // Keep looking } } resourceCache.put(l, values); } return values; }
/** * Return an array containing the names of all currently defined * configuration attributes. If there are no such attributes, a zero * length array is returned. */ public String[] getAttributeNames() { Vector names = new Vector(); Enumeration keys = attributes.keys(); while (keys.hasMoreElements()) { names.addElement((String) keys.nextElement()); } String results[] = new String[names.size()]; for (int i = 0; i < results.length; i++) { results[i] = (String) names.elementAt(i); } return (results); }
/** * Returns all arguments defined by <code>addLine</code>, <code>addValue</code> or the argument object. */ public String[] getArguments() { Vector<String> result = new Vector<String>( arguments.size() * 2 ); for ( int i = 0; i < arguments.size(); i++ ) { Arg arg = arguments.elementAt( i ); String[] s = arg.getParts(); if ( s != null ) { for ( String value : s ) { result.addElement( value ); } } } String[] res = new String[result.size()]; result.copyInto( res ); return res; }
private static String[] split(String input, char sep, int limit) { Vector v = new Vector(); boolean limited = (limit > 0); int applied = 0; else { ++applied; v.add(part.toString()); part = new StringBuffer(); ++index; v.add(part.toString()); int last = v.size(); if (0 == limit) { for (int j = v.size() - 1; j >= 0; --j) { String s = (String) v.elementAt(j); if ("".equals(s)) --last; ret[i] = (String) v.elementAt(i);
/** * Attempt to register any unregistered extension namespaces. */ public void registerUnregisteredNamespaces() { for (int i = 0; i < m_unregisteredExtensions.size(); i++) { String ns = (String)m_unregisteredExtensions.get(i); ExtensionNamespaceSupport extNsSpt = defineJavaNamespace(ns); if (extNsSpt != null) m_extensions.add(extNsSpt); } }
public FlowList append(FlowList right) { if (_elements == null) { _elements = right._elements; } else { final Vector temp = right._elements; if (temp != null) { final int n = temp.size(); for (int i = 0; i < n; i++) { _elements.addElement(temp.elementAt(i)); } } } return this; }
/** * decode the class name of the given argument, or the class name if the argument is zero */ public String decodeClassName(int argNo) { int idx; if (classes == null) { classes = new Vector(); idx = 0; while (idx >= 0) idx = decodeNextClassName(idx); } if (argNo == 0) return (String) classes.elementAt(classes.size() - 1); else return (String) classes.elementAt(argNo - 1); }
/** * Create a deep clone of this instance, except for the nested selectors * (the list of selectors is a shallow clone of this instance's list). * @return a cloned Object. */ @Override public synchronized Object clone() { if (isReference()) { return getRef().clone(); } Files f = (Files) super.clone(); f.defaultPatterns = (PatternSet) defaultPatterns.clone(); f.additionalPatterns = new Vector<>(additionalPatterns.size()); for (PatternSet ps : additionalPatterns) { f.additionalPatterns.add((PatternSet) ps.clone()); } return f; }
/** * Set the Attribute's value; required * * @param value the attribute's value */ public void setValue(String value) { if (currentIndex >= values.size()) { values.addElement(value); currentIndex = values.size() - 1; } else { values.setElementAt(value, currentIndex); } }
@Override public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { Vector<HashMap<String, ByteIterator>> results = new Vector<>(); final Status status = scan(table, key, 1, fields, results); if (!status.equals(Status.OK)) { return status; } if (results.size() != 1) { return Status.NOT_FOUND; } result.putAll(results.firstElement()); return Status.OK; }
/** * Copies the reader list from the current Catalog to a new Catalog. * * <p>This method is used internally when constructing a new catalog. * It copies the current reader associations over to the new catalog. * </p> * * @param newCatalog The new Catalog. */ protected void copyReaders(Catalog newCatalog) { // Have to copy the readers in the right order...convert hash to arr Vector mapArr = new Vector(readerMap.size()); // Pad the mapArr out to the right length for (int count = 0; count < readerMap.size(); count++) { mapArr.add(null); } Enumeration en = readerMap.keys(); while (en.hasMoreElements()) { String mimeType = (String) en.nextElement(); Integer pos = (Integer) readerMap.get(mimeType); mapArr.set(pos.intValue(), mimeType); } for (int count = 0; count < mapArr.size(); count++) { String mimeType = (String) mapArr.get(count); Integer pos = (Integer) readerMap.get(mimeType); newCatalog.addReader(mimeType, (CatalogReader) readerArr.get(pos.intValue())); } }
/** * Returns a Map of the known resources for the given locale. */ private Map<String, String> getResourceCache(Locale l) { Map<String, String> values = resourceCache.get(l); if (values == null) { values = new HashMap<String, String>(); for (int i=resourceBundles.size()-1; i >= 0; i--) { String bundleName = resourceBundles.get(i); try { ResourceBundle b = ResourceBundle. getBundle(bundleName, l, UIManagerExt.class.getClassLoader()); Enumeration<String> keys = b.getKeys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if (values.get(key) == null) { Object value = b.getObject(key); values.put(key, (String) value); } } } catch( MissingResourceException mre ) { // Keep looking } } resourceCache.put(l, values); } return values; }
ZipEntryRO[] getEntriesAt(String path) { Vector<ZipEntryRO> zev = new Vector<ZipEntryRO>(); Collection<ZipEntryRO> values = mHashMap.values(); if (null == path) path = ""; int length = path.length(); for (ZipEntryRO ze : values) { if (ze.mFileName.startsWith(path)) { if (-1 == ze.mFileName.indexOf('/', length)) { zev.add(ze); } } } ZipEntryRO[] entries = new ZipEntryRO[zev.size()]; return zev.toArray(entries); }
v = new Vector(); Enumeration enumeration = ht.keys(); while(enumeration.hasMoreElements() && (misses <= 4)) { Thread t = (Thread) enumeration.nextElement(); if(t.isAlive()) { misses++; } else { misses = 0; v.addElement(t); int size = v.size(); for(int i = 0; i < size; i++) { Thread t = (Thread) v.elementAt(i); LogLog.debug("Lazy NDC removal for thread [" + t.getName() + "] ("+ ht.size() + ").");
public static String[] byteArrToUStringArr(byte[] b) { int off = 0; Vector<String> v = new Vector<>(); while (off < b.length) { int length = byteArrToInt(b, off); if (length != 0) { v.addElement(byteArrToUString(b, off + 4, length)); } else { v.addElement(""); } off = off + 2 * length + 4; } String[] s = new String[v.size()]; for (int i = 0; i < s.length; i++) { s[i] = v.elementAt(i); } return s; }