/** * Returns the index of the specified element. * @param element Element to be looked for. * @return -1 if not found. */ public int getIndexOf(DataElement element) { return _container.indexOf(element); }
/** * Searches this vector for the specified object. * * @param object * the object to look for in this vector. * @return {@code true} if object is an element of this vector, * {@code false} otherwise. * @see #indexOf(Object) * @see #indexOf(Object, int) * @see java.lang.Object#equals */ @Override public boolean contains(Object object) { return indexOf(object, 0) != -1; }
/** * Searches in this vector for the index of the specified object. The search * for the object starts at the beginning and moves towards the end of this * vector. * * @param object * the object to find in this vector. * @return the index in this vector of the specified element, -1 if the * element isn't found. * @see #contains * @see #lastIndexOf(Object) * @see #lastIndexOf(Object, int) */ @Override public int indexOf(Object object) { return indexOf(object, 0); }
/** * Add a pattern to the default excludes unless it is already a * default exclude. * * @param s A string to add as an exclude pattern. * @return <code>true</code> if the string was added; * <code>false</code> if it already existed. * * @since Ant 1.6 */ public static boolean addDefaultExclude(String s) { if (defaultExcludes.indexOf(s) == -1) { defaultExcludes.add(s); return true; } return false; }
/** * Get a prefix either from the uri mapping, or just make * one up! * * @param uri The namespace URI, which may be null. * * @return The prefix if there is one, or null. */ public int getIdForNamespace(String uri) { int index = m_values.indexOf(uri); if (index < 0) { m_values.addElement(uri); return m_valueIndex++; } else return index; }
/** * Removes the first occurrence, starting at the beginning and moving * towards the end, of the specified object from this vector. All elements * with an index bigger than the element that gets removed have their index * decreased by 1. * * @param object * the object to remove from this vector. * @return {@code true} if the specified object was found, {@code false} * otherwise. * @see #removeAllElements * @see #removeElementAt * @see #size */ public synchronized boolean removeElement(Object object) { int index; if ((index = indexOf(object, 0)) == -1) { return false; } removeElementAt(index); return true; }
/** * Get a prefix either from the uri mapping, or just make * one up! * * @param uri The namespace URI, which may be null. * * @return The prefix if there is one, or null. */ public int getIdForNamespace(String uri) { int index = m_values.indexOf(uri); if (index < 0) { m_values.addElement(uri); return m_valueIndex++; } else return index; }
/** * Get a prefix either from the qname or from the uri mapping, or just make * one up! * * @return The prefix if there is one, or null. */ public String getNamespaceURI(String prefix) { String uri = ""; int prefixIndex = m_contextIndexes.peek() - 1 ; if(null == prefix) prefix = ""; do { prefixIndex = m_prefixMappings.indexOf(prefix, ++prefixIndex); } while ( (prefixIndex >= 0) && (prefixIndex & 0x01) == 0x01); if (prefixIndex > -1) { uri = (String) m_prefixMappings.elementAt(prefixIndex + 1); } return uri; }
/** * Get a prefix either from the qname or from the uri mapping, or just make * one up! * * @return The prefix if there is one, or null. */ public String getNamespaceURI(String prefix) { String uri = ""; int prefixIndex = m_contextIndexes.peek() - 1 ; if(null == prefix) prefix = ""; do { prefixIndex = m_prefixMappings.indexOf(prefix, ++prefixIndex); } while ( (prefixIndex >= 0) && (prefixIndex & 0x01) == 0x01); if (prefixIndex > -1) { uri = (String) m_prefixMappings.elementAt(prefixIndex + 1); } return uri; }
public void setView(List columns) { TableColumnModel model = getColumnModel(); // Remove all the columns: for (int f = 0; f < _numCols; f++) { model.removeColumn(_tableColumns[f]); } Iterator selectedColumns = columns.iterator(); Vector columnNameAndNumber = getColumnNameAndNumber(); while (selectedColumns.hasNext()) { // add the column to the view model.addColumn(_tableColumns[columnNameAndNumber.indexOf(selectedColumns.next())]); } //SWING BUG: sizeColumnsToFit(-1); }
/** * Receive notification of the end of a Namespace mapping. * * <p>By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the end of * each prefix mapping.</p> * * @param prefix The Namespace prefix being declared. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endPrefixMapping */ public void endPrefixMapping(String prefix) throws SAXException { if (DEBUG) System.out.println("endPrefixMapping: prefix: " + prefix); if(null == prefix) prefix = ""; int index = m_contextIndexes.peek() - 1; do { index = m_prefixMappings.indexOf(prefix, ++index); } while ( (index >= 0) && ((index & 0x01) == 0x01) ); if (index > -1) { m_prefixMappings.setElementAt("%@$#^@#", index); m_prefixMappings.setElementAt("%@$#^@#", index + 1); } // no op }
@ExpectWarning("GC") public void test() { LinkedList<Integer> lst = new LinkedList<Integer>(); lst.add(1); lst.add(2); lst.add(3); lst.removeFirstOccurrence("a"); lst.removeLastOccurrence("a"); Vector<Integer> v = new Vector<Integer>(); v.addAll(lst); v.indexOf((long) 1, 1); v.lastIndexOf((long) 1, 1); }
/** * Receive notification of the end of a Namespace mapping. * * <p>By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the end of * each prefix mapping.</p> * * @param prefix The Namespace prefix being declared. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endPrefixMapping */ public void endPrefixMapping(String prefix) throws SAXException { if (DEBUG) System.out.println("endPrefixMapping: prefix: " + prefix); if(null == prefix) prefix = ""; int index = m_contextIndexes.peek() - 1; do { index = m_prefixMappings.indexOf(prefix, ++index); } while ( (index >= 0) && ((index & 0x01) == 0x01) ); if (index > -1) { m_prefixMappings.setElementAt("%@$#^@#", index); m_prefixMappings.setElementAt("%@$#^@#", index + 1); } // no op }
uriIndex = m_prefixMappings.indexOf(uri, ++uriIndex); } while ( (uriIndex & 0x01) == 0);
uriIndex = m_prefixMappings.indexOf(uri, ++uriIndex); } while ( (uriIndex & 0x01) == 0);
int pos = nodes.indexOf(s); copy(valueAfter.elementAt(pos), previousAfterFlow); copy(valueAfter.elementAt(nodes.indexOf(preds.get(0))), beforeFlow); copy(valueAfter.elementAt(nodes.indexOf(obj)), beforeFlow); if (nodes.indexOf(stmt) >= 0) // RLH Object otherBranchFlow = valueAfter.elementAt(nodes.indexOf(stmt)); afterFlow = valueAfter.elementAt(nodes.indexOf(s)); flowThrough(beforeFlow, s, afterFlow); valueAfter.set(nodes.indexOf(s), afterFlow);