public synchronized final Iterator getReadListeners(QName property) { Collection readers = (Collection)_readersByQName.get(property); return readers.iterator(); }
/** * * Removes the given value from the collection of values associated with * the given key. If removing the value results in the key having no * more entries associated with it, the key itself is removed. * * @param map * @param key * @param value * */ private void removeItem(MultiMap map, Object key, Object value) { Collection all = (Collection)map.get(key); all.remove(value); if (all.isEmpty()) map.remove(key); }
/** * * @param value * * @return True if one or more of the keys in this map points to the * given value. * */ public final boolean containsValue(Object value) { Iterator i = values().iterator(); // // look through each map entry's set of values to see if // the given value is present // while (i.hasNext()) { Collection values = (Collection)i.next(); if (values.contains(value)) return true; } return false; }
public synchronized final void addChangeListener(PropertyChangeListener listener) { if (listener == null) throw new NullPointerException(_MESSAGES.get("NullPCL")); QName qname = listener.getPropertyName(); if (!hasPropertyDefinition(qname)) { Object[] filler = { qname }; throw new IllegalArgumentException(_MESSAGES.get("PropertyNotInSchema", filler)); } _listenersByQName.put(qname, listener); }
public synchronized final Iterator getChangeListeners(QName property) { Collection listeners = (Collection)_listenersByQName.get(property); return listeners.iterator(); }
public synchronized final void addChangeApprover(PropertyChangeApprover approver) { if (approver == null) throw new NullPointerException(_MESSAGES.get("NullPCA")); QName qname = approver.getPropertyName(); if (!hasPropertyDefinition(qname)) { Object[] filler = { qname }; throw new IllegalArgumentException(_MESSAGES.get("PropertyNotInSchema", filler)); } _approversByQName.put(qname, approver); }
/** * * NOTE: This method takes O(n) time, where n is the number of keys in * the map. It would be more efficient to keep a counter for the size, * but this would require overriding more methods and dealing with the * complicated issue of map integrity and entrySet(). This implementation * is the most robust when you consider that all Maps allow users to * modify their contents without using the interface directly. * * @return The sum of the sizes of all the map entries (value collections). * */ public final int size() { Iterator i = values().iterator(); int count = 0; // // for each key, add the number of values to the count // while (i.hasNext()) { Collection values = (Collection)i.next(); count += values.size(); } return count; } }
public synchronized final Iterator getChangeApprovers(QName property) { Collection approvers = (Collection)_approversByQName.get(property); return approvers.iterator(); }
public synchronized final void addReadListener(PropertyReadListener listener) { if (listener == null) throw new NullPointerException(_MESSAGES.get("NullPRL")); QName qname = listener.getPropertyName(); if (!hasPropertyDefinition(qname)) { Object[] filler = { qname }; throw new IllegalArgumentException(_MESSAGES.get("PropertyNotInSchema", filler)); } _readersByQName.put(qname, listener); }
Collection values = (Collection)get(key);
throw new NullPointerException(_MESSAGES.get("NullQName")); Collection listeners = (Collection)_listenersByQName.get(qname);
throw new NullPointerException(_MESSAGES.get("NullQName")); Collection readers = (Collection)_readersByQName.get(qname);
throw new NullPointerException(_MESSAGES.get("NullQName")); Collection approvers = (Collection)_approversByQName.get(qname);