/** * Returns whether the given keys are in the set. */ public boolean contains(Object o1, Object o2) { return table.get(o1, o2) != null; }
/** * Adds an entry to the set. */ public void add(Object o1, Object o2) { table.put(o1, o2, value); }
/** * Adds a listener for changes to the given attribute value. */ public void addTargetListener(String ns, String an, boolean isCSS, AnimationTargetListener l) { if (!isCSS) { if (targetListeners == null) { targetListeners = new DoublyIndexedTable(); } LinkedList ll = (LinkedList) targetListeners.get(ns, an); if (ll == null) { ll = new LinkedList(); targetListeners.put(ns, an, ll); } ll.add(l); } }
/** * Allows the user to register a new element factory. */ public void registerCustomElementFactory(String namespaceURI, String localName, ElementFactory factory) { if (customFactories == null) { customFactories = new DoublyIndexedTable(); } customFactories.put(namespaceURI, localName, factory); }
Object[] defRecs = definitions.getValuesArray(); definitions.clear(); for (int i = 0; i < defRecs.length; i++) { DefinitionRecord defRec = (DefinitionRecord) defRecs[i]; TreeSet defs = (TreeSet) definitionLists.get(defRec.namespaceURI, defRec.localName); if (defs != null) { removeDefinition(defRec); definitionLists.put(defRec.namespaceURI, defRec.localName, null); definitionLists = new DoublyIndexedTable(); contentManagers.clear();
/** * Removes an xbl:definition element from the list of definitions that * could possibly affect elements with the specified QName. This * will only cause a new binding to come in to effect if it is currently * active. */ protected void removeDefinition(DefinitionRecord defRec) { TreeSet defs = (TreeSet) definitionLists.get(defRec.namespaceURI, defRec.localName); if (defs == null) { return; } Element imp = defRec.importElement; ImportRecord ir = (ImportRecord) imports.get(imp); DefinitionRecord activeDefRec = (DefinitionRecord) defs.first(); defs.remove(defRec); definitions.remove(defRec.definition, imp); removeDefinitionElementListeners(defRec.definition, ir); if (defRec != activeDefRec) { return; } if (defRec.template != null) { removeTemplateElementListeners(defRec.template, ir); } rebind(defRec.namespaceURI, defRec.localName, document.getDocumentElement()); }
/** * Puts a value in the table. * @return the old value or null */ public Object put(Object o1, Object o2, Object value) { int hash = hashCode(o1, o2) & 0x7FFFFFFF; int index = hash % table.length; for (Entry e = table[index]; e != null; e = e.next) { if ((e.hash == hash) && e.match(o1, o2)) { Object old = e.value; e.value = value; return old; } } // The key is not in the hash table int len = table.length; if (count++ >= (len - (len >> 2))) { // more than 75% loaded: grow rehash(); index = hash % table.length; } Entry e = new Entry(hash, o1, o2, value, table[index]); table[index] = e; return null; }
/** * Removes an entry from the set. */ public void remove(Object o1, Object o2) { table.remove(o1, o2); }
/** * Clears the set. */ public void clear() { table.clear(); } }
/** * Gets the value of an entry * @return the value or null */ public Object get(Object o1, Object o2) { int hash = hashCode(o1, o2) & 0x7FFFFFFF; int index = hash % table.length; for (Entry e = table[index]; e != null; e = e.next) { if ((e.hash == hash) && e.match(o1, o2)) { return e.value; } } return null; }
TargetInfo info = (TargetInfo) e.getValue(); Iterator j = info.xmlAnimations.iterator(); while (j.hasNext()) { DoublyIndexedTable.Entry e2 =
/** * Returns the number of entries in the set. */ public int size() { return table.size(); }
/** * Removes an import. */ protected void removeImport(Element imp) { ImportRecord ir = (ImportRecord) imports.get(imp); NodeEventTarget et = (NodeEventTarget) ir.node; et.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted", ir.importInsertedListener, false); et.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved", ir.importRemovedListener, false); et.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified", ir.importSubtreeListener, false); et = (NodeEventTarget) imp; et.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", importAttrListener, false); Object[] defRecs = definitions.getValuesArray(); for (int i = 0; i < defRecs.length; i++) { DefinitionRecord defRec = (DefinitionRecord) defRecs[i]; if (defRec.importElement == imp) { removeDefinition(defRec); } } imports.remove(imp); }
Object[] defRecs = definitions.getValuesArray(); definitions.clear(); for (Object defRec1 : defRecs) { DefinitionRecord defRec = (DefinitionRecord) defRec1; TreeSet defs = (TreeSet) definitionLists.get(defRec.namespaceURI, defRec.localName); if (defs != null) { removeDefinition(defRec); definitionLists.put(defRec.namespaceURI, defRec.localName, null); definitionLists = new DoublyIndexedTable(); contentManagers.clear();
/** * Allows the user to register a new element factory. */ public void registerCustomElementFactory(String namespaceURI, String localName, ElementFactory factory) { if (customFactories == null) { customFactories = new DoublyIndexedTable(); } customFactories.put(namespaceURI, localName, factory); }
/** * Removes an xbl:definition element from the list of definitions that * could possibly affect elements with the specified QName. This * will only cause a new binding to come in to effect if it is currently * active. */ protected void removeDefinition(DefinitionRecord defRec) { TreeSet defs = (TreeSet) definitionLists.get(defRec.namespaceURI, defRec.localName); if (defs == null) { return; } Element imp = defRec.importElement; ImportRecord ir = (ImportRecord) imports.get(imp); DefinitionRecord activeDefRec = (DefinitionRecord) defs.first(); defs.remove(defRec); definitions.remove(defRec.definition, imp); removeDefinitionElementListeners(defRec.definition, ir); if (defRec != activeDefRec) { return; } if (defRec.template != null) { removeTemplateElementListeners(defRec.template, ir); } rebind(defRec.namespaceURI, defRec.localName, document.getDocumentElement()); }
/** * Puts a value in the table. * @return the old value or null */ public Object put(Object o1, Object o2, Object value) { int hash = hashCode(o1, o2) & 0x7FFFFFFF; int index = hash % table.length; for (Entry e = table[index]; e != null; e = e.next) { if ((e.hash == hash) && e.match(o1, o2)) { Object old = e.value; e.value = value; return old; } } // The key is not in the hash table int len = table.length; if (count++ >= (len - (len >> 2))) { // more than 75% loaded: grow rehash(); index = hash % table.length; } Entry e = new Entry(hash, o1, o2, value, table[index]); table[index] = e; return null; }
/** * Removes an entry from the set. */ public void remove(Object o1, Object o2) { table.remove(o1, o2); }
/** * Clears the set. */ public void clear() { table.clear(); } }
/** * Gets the value of an entry * @return the value or null */ public Object get(Object o1, Object o2) { int hash = hashCode(o1, o2) & 0x7FFFFFFF; int index = hash % table.length; for (Entry e = table[index]; e != null; e = e.next) { if ((e.hash == hash) && e.match(o1, o2)) { return e.value; } } return null; }