/** * Add a new entry with the specified keys, value and hash code to * the specified bucket. It is the responsibility of this * method to resize the table if appropriate. * */ private void addEntry(int hash, String nsUri, String localName, V value, int bucketIndex) { Entry<V> e = table[bucketIndex]; table[bucketIndex] = new Entry<V>(hash, nsUri, localName, value, e); if (size++ >= threshold) resize(2 * table.length); }
@Override public Collection<QName> getExpectedChildElements() { return children.keySet(); } }
/** * Finds the string in the <code>group</code> closest to * <code>key</code> and returns it. * * @return null if group.length==0. */ public static String findNearest( String key, String[] group ) { return findNearest(key, Arrays.asList(group)); }
public Collection<QName> keySet() { Set<QName> r = new HashSet<QName>(); for (Entry<V> e : entrySet()) { r.add(e.createQName()); } return r; }
public boolean findDuplicate(E o) { int hash = hash(o); return findDuplicate(o, hash); }
public boolean hasNext() { getNext(); return next!=null; }
public boolean containsKey(String nsUri,String localName) { return getEntry(nsUri,localName)!=null; }
/** * Pushes a new object to the stack without making it participate * with the collision check. */ public void pushNocheck(E o) { if(data.length==size) expandCapacity(); data[size] = o; next[size] = -1; size++; }
@Override public String toString() { return '"'+nsUri +"\",\"" +localName + "\"=" + getValue(); } }
public Set<Entry<V>> entrySet() { Set<Entry<V>> es = entrySet; return es != null ? es : (entrySet = new EntrySet()); }
public void setObjectIdentityCycleDetection(boolean val) { cycleDetectionStack.setUseIdentity(val); } public boolean getObjectIdentityCycleDetection() {
public boolean getObjectIdentityCycleDetection() { return cycleDetectionStack.getUseIdentity(); }
public void put(Name name, V value ) { put(name.nsUri,name.localName,value); }
private Iterator<Entry<V>> newEntryIterator() { return new EntryIterator(); }
/** * Rehashes the contents of this map into a new array with a * larger capacity. This method is called automatically when the * number of keys in this map reaches its threshold. */ private void resize(int newCapacity) { Entry[] oldTable = table; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { threshold = Integer.MAX_VALUE; return; } Entry[] newTable = new Entry[newCapacity]; transfer(newTable); table = newTable; threshold = newCapacity; }
/** * Returns the set of valid root tag names. * For diagnostic use. */ public Set<QName> getValidRootNames() { Set<QName> r = new TreeSet<QName>(QNAME_COMPARATOR); for (QNameMap.Entry e : rootMap.entrySet()) { r.add(e.createQName()); } return r; }
@Override public Collection<QName> getExpectedAttributes() { return attUnmarshallers.keySet(); }
/** * Returns the value to which the specified keys are mapped in this QNameMap, * or {@code null} if the map contains no mapping for this key. * * @param nsUri the namespaceUri key whose associated value is to be returned. * @param localPart the localPart key whose associated value is to be returned. * @return the value to which this map maps the specified set of keya, or * {@code null} if the map contains no mapping for this set of keys. * @see #put(String,String, Object) */ public V get( String nsUri, String localPart ) { Entry<V> e = getEntry(nsUri,localPart); if(e==null) return null; else return e.value; }
@Override public Collection<QName> getExpectedChildElements() { return childUnmarshallers.keySet(); }