< prev index next >

jaxp/src/com/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM.java

Print this page


   1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *     http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xalan.internal.xsltc.dom;
  22 


 652      */
 653     public SerializationHandler getOutputDomBuilder()
 654     {
 655         return _main.getOutputDomBuilder();
 656     }
 657 
 658     public String lookupNamespace(int node, String prefix)
 659         throws TransletException
 660     {
 661         return _main.lookupNamespace(node, prefix);
 662     }
 663 
 664     // %HZ% Does this method make any sense here???
 665     public String getUnparsedEntityURI(String entity) {
 666         return _main.getUnparsedEntityURI(entity);
 667     }
 668 
 669     // %HZ% Does this method make any sense here???
 670     public Map<String, Integer> getElementsWithIDs() {
 671         return _main.getElementsWithIDs();















































 672     }
 673 }
   1 /*
   2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *     http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xalan.internal.xsltc.dom;
  22 


 652      */
 653     public SerializationHandler getOutputDomBuilder()
 654     {
 655         return _main.getOutputDomBuilder();
 656     }
 657 
 658     public String lookupNamespace(int node, String prefix)
 659         throws TransletException
 660     {
 661         return _main.lookupNamespace(node, prefix);
 662     }
 663 
 664     // %HZ% Does this method make any sense here???
 665     public String getUnparsedEntityURI(String entity) {
 666         return _main.getUnparsedEntityURI(entity);
 667     }
 668 
 669     // %HZ% Does this method make any sense here???
 670     public Map<String, Integer> getElementsWithIDs() {
 671         return _main.getElementsWithIDs();
 672     }
 673 
 674     public void release() {
 675         _main.release();
 676     }
 677 
 678     private boolean isMatchingAdapterEntry(DOM entry, DOMAdapter adapter) {
 679         DOM dom = adapter.getDOMImpl();
 680 
 681         return (entry == adapter) || (
 682             /*
 683              * Method addDOMAdapter overwrites for AdaptiveResultTreeImpl
 684              * objects the usual entry with an adapter to the nested
 685              * DOM, so we must check this here. See last 'if' statement
 686              * of addDOMAdapter.
 687              */
 688             (dom instanceof AdaptiveResultTreeImpl) &&
 689             (entry instanceof DOMAdapter) &&
 690             (((AdaptiveResultTreeImpl)dom).getNestedDOM() == ((DOMAdapter)entry).getDOMImpl())
 691         );
 692     }
 693 
 694     public void removeDOMAdapter(DOMAdapter adapter) {
 695         _documents.remove(adapter.getDocumentURI(0));
 696         DOM dom = adapter.getDOMImpl();
 697 
 698         if (dom instanceof DTMDefaultBase) {
 699             SuballocatedIntVector ids = ((DTMDefaultBase) dom).getDTMIDs();
 700             int idsSize = ids.size();
 701             for (int i = 0; i < idsSize; i++) {
 702                 _adapters[ids.elementAt(i) >>> DTMManager.IDENT_DTM_NODE_BITS] = null;
 703             }
 704         } else {
 705             int id = dom.getDocument() >>> DTMManager.IDENT_DTM_NODE_BITS;
 706             if ((id > 0) && (id < _adapters.length) && isMatchingAdapterEntry(_adapters[id], adapter)) {
 707                 _adapters[id] = null;
 708             } else {
 709                 boolean found = false;
 710                 for (int i = 0; i < _adapters.length; i++) {
 711                     if (isMatchingAdapterEntry(_adapters[id], adapter)) {
 712                         _adapters[i] = null;
 713                         found = true;
 714                         break;
 715                     }
 716                 }
 717             }
 718         }
 719     }
 720 }
< prev index next >