jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM.java
author joehw
Wed, 09 Mar 2016 16:09:55 -0800
changeset 36486 b84e564d2358
parent 33349 975138b77cff
permissions -rw-r--r--
8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees Reviewed-by: joehw Contributed-by: christoph.langer@sap.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
36486
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
/*
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
     5
 * Licensed to the Apache Software Foundation (ASF) under one or more
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
     6
 * contributor license agreements.  See the NOTICE file distributed with
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
     7
 * this work for additional information regarding copyright ownership.
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
     8
 * The ASF licenses this file to You under the Apache License, Version 2.0
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
     9
 * (the "License"); you may not use this file except in compliance with
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
    10
 * the License.  You may obtain a copy of the License at
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 *
32328
a09e22b759a7 8133924: NPE may be thrown when xsltc select a non-existing node after JDK-8062518
joehw
parents: 30521
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
package com.sun.org.apache.xalan.internal.xsltc.dom;
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
import com.sun.org.apache.xalan.internal.xsltc.DOM;
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
import com.sun.org.apache.xalan.internal.xsltc.StripFilter;
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
import com.sun.org.apache.xalan.internal.xsltc.TransletException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
import com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary;
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
    27
import com.sun.org.apache.xml.internal.dtm.Axis;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
import com.sun.org.apache.xml.internal.dtm.DTM;
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
import com.sun.org.apache.xml.internal.dtm.DTMManager;
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase;
36486
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
    32
import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIterNodeList;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
    34
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
import com.sun.org.apache.xml.internal.utils.SuballocatedIntVector;
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
    36
import java.util.HashMap;
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
    37
import java.util.Map;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
import org.w3c.dom.Node;
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
import org.w3c.dom.NodeList;
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * @author Jacek Ambroziak
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * @author Morten Jorgensen
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * @author Erwin Bolwidt <ejb@klomp.org>
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
public final class MultiDOM implements DOM {
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
    private static final int NO_TYPE = DOM.FIRST_TYPE - 2;
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
    private static final int INITIAL_SIZE = 4;
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
    private DOM[] _adapters;
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
    private DOMAdapter _main;
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
    private DTMManager _dtmManager;
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
    private int _free;
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
    private int _size;
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
    57
    private Map<String, Integer> _documents = new HashMap<>();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
    private final class AxisIterator extends DTMAxisIteratorBase {
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
        // constitutive data
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
        private final int _axis;
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
        private final int _type;
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
        // implementation mechanism
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
        private DTMAxisIterator _source;
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
        private int _dtmId = -1;
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
        public AxisIterator(final int axis, final int type) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
            _axis = axis;
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
            _type = type;
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
        public int next() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
            if (_source == null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
                return(END);
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
            return _source.next();
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
        public void setRestartable(boolean flag) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
            if (_source != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
                _source.setRestartable(flag);
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
        public DTMAxisIterator setStartNode(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
            if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
                return this;
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
            int dom = node >>> DTMManager.IDENT_DTM_NODE_BITS;
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
            // Get a new source first time and when mask changes
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
            if (_source == null || _dtmId != dom) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
                if (_type == NO_TYPE) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
                    _source = _adapters[dom].getAxisIterator(_axis);
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
                } else if (_axis == Axis.CHILD) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
                    _source = _adapters[dom].getTypedChildren(_type);
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
                } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
                    _source = _adapters[dom].getTypedAxisIterator(_axis, _type);
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
            _dtmId = dom;
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
            _source.setStartNode(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
            return this;
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
        public DTMAxisIterator reset() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
            if (_source != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
                _source.reset();
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
            return this;
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
        public int getLast() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
            if (_source != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
                return _source.getLast();
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
            else {
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
                return END;
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
        public int getPosition() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
            if (_source != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
                return _source.getPosition();
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
            else {
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
                return END;
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
        public boolean isReverse() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
            return Axis.isReverse(_axis);
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
        public void setMark() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
            if (_source != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
                _source.setMark();
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
        public void gotoMark() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
            if (_source != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
                _source.gotoMark();
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
        public DTMAxisIterator cloneIterator() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
            final AxisIterator clone = new AxisIterator(_axis, _type);
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
            if (_source != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
                clone._source = _source.cloneIterator();
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
            clone._dtmId = _dtmId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
            return clone;
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
    } // end of AxisIterator
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
    /**************************************************************
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
     * This is a specialised iterator for predicates comparing node or
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
     * attribute values to variable or parameter values.
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
    private final class NodeValueIterator extends DTMAxisIteratorBase {
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
        private DTMAxisIterator _source;
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
        private String _value;
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
        private boolean _op;
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
        private final boolean _isReverse;
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
        private int _returnType = RETURN_PARENT;
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
        public NodeValueIterator(DTMAxisIterator source, int returnType,
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
                                 String value, boolean op) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
            _source = source;
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
            _returnType = returnType;
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
            _value = value;
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
            _op = op;
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
            _isReverse = source.isReverse();
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
        public boolean isReverse() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
            return _isReverse;
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
        public DTMAxisIterator cloneIterator() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
            try {
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
                NodeValueIterator clone = (NodeValueIterator)super.clone();
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
                clone._source = _source.cloneIterator();
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
                clone.setRestartable(false);
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
                return clone.reset();
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
            catch (CloneNotSupportedException e) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
                BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
                                          e.toString());
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
                return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
        public void setRestartable(boolean isRestartable) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
            _isRestartable = isRestartable;
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
            _source.setRestartable(isRestartable);
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
        public DTMAxisIterator reset() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
            _source.reset();
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
            return resetPosition();
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
        public int next() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
            int node;
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
            while ((node = _source.next()) != END) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
                String val = getStringValueX(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
                if (_value.equals(val) == _op) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
                    if (_returnType == RETURN_CURRENT)
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
                        return returnNode(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
                    else
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
                        return returnNode(getParent(node));
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
            return END;
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
        public DTMAxisIterator setStartNode(int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
            if (_isRestartable) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
                _source.setStartNode(_startNode = node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
                return resetPosition();
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
            return this;
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
        public void setMark() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
            _source.setMark();
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
        public void gotoMark() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
            _source.gotoMark();
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
    public MultiDOM(DOM main) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
        _size = INITIAL_SIZE;
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
        _free = 1;
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
        _adapters = new DOM[INITIAL_SIZE];
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
        DOMAdapter adapter = (DOMAdapter)main;
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
        _adapters[0] = adapter;
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
        _main = adapter;
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
        DOM dom = adapter.getDOMImpl();
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
        if (dom instanceof DTMDefaultBase) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
            _dtmManager = ((DTMDefaultBase)dom).getManager();
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
        // %HZ% %REVISIT% Is this the right thing to do here?  In the old
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
        // %HZ% %REVISIT% version, the main document did not get added through
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
        // %HZ% %REVISIT% a call to addDOMAdapter, which meant it couldn't be
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
        // %HZ% %REVISIT% found by a call to getDocumentMask.  The problem is
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
        // %HZ% %REVISIT% TransformerHandler is typically constructed with a
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
        // %HZ% %REVISIT% system ID equal to the stylesheet's URI; with SAX
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
        // %HZ% %REVISIT% input, it ends up giving that URI to the document.
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
        // %HZ% %REVISIT% Then, any references to document('') are resolved
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
        // %HZ% %REVISIT% using the stylesheet's URI.
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
        // %HZ% %REVISIT% MultiDOM.getDocumentMask is called to verify that
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
        // %HZ% %REVISIT% a document associated with that URI has not been
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
        // %HZ% %REVISIT% encountered, and that method ends up returning the
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
        // %HZ% %REVISIT% mask of the main document, when what we really what
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
        // %HZ% %REVISIT% is to read the stylesheet itself!
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
        addDOMAdapter(adapter, false);
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
    public int nextMask() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
        return _free;
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
    public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
        // This method only has a function in DOM adapters
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
    public int addDOMAdapter(DOMAdapter adapter) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
        return addDOMAdapter(adapter, true);
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
    private int addDOMAdapter(DOMAdapter adapter, boolean indexByURI) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
        // Add the DOM adapter to the array of DOMs
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
        DOM dom = adapter.getDOMImpl();
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
7f561c08de6b Initial load
duke
parents:
diff changeset
   288
        int domNo = 1;
7f561c08de6b Initial load
duke
parents:
diff changeset
   289
        int dtmSize = 1;
7f561c08de6b Initial load
duke
parents:
diff changeset
   290
        SuballocatedIntVector dtmIds = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   291
        if (dom instanceof DTMDefaultBase) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   292
            DTMDefaultBase dtmdb = (DTMDefaultBase)dom;
7f561c08de6b Initial load
duke
parents:
diff changeset
   293
            dtmIds = dtmdb.getDTMIDs();
7f561c08de6b Initial load
duke
parents:
diff changeset
   294
            dtmSize = dtmIds.size();
7f561c08de6b Initial load
duke
parents:
diff changeset
   295
            domNo = dtmIds.elementAt(dtmSize-1) >>> DTMManager.IDENT_DTM_NODE_BITS;
7f561c08de6b Initial load
duke
parents:
diff changeset
   296
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   297
        else if (dom instanceof SimpleResultTreeImpl) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   298
            SimpleResultTreeImpl simpleRTF = (SimpleResultTreeImpl)dom;
7f561c08de6b Initial load
duke
parents:
diff changeset
   299
            domNo = simpleRTF.getDocument() >>> DTMManager.IDENT_DTM_NODE_BITS;
7f561c08de6b Initial load
duke
parents:
diff changeset
   300
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   301
7f561c08de6b Initial load
duke
parents:
diff changeset
   302
        if (domNo >= _size) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   303
            int oldSize = _size;
7f561c08de6b Initial load
duke
parents:
diff changeset
   304
            do {
7f561c08de6b Initial load
duke
parents:
diff changeset
   305
                _size *= 2;
7f561c08de6b Initial load
duke
parents:
diff changeset
   306
            } while (_size <= domNo);
7f561c08de6b Initial load
duke
parents:
diff changeset
   307
7f561c08de6b Initial load
duke
parents:
diff changeset
   308
            final DOMAdapter[] newArray = new DOMAdapter[_size];
7f561c08de6b Initial load
duke
parents:
diff changeset
   309
            System.arraycopy(_adapters, 0, newArray, 0, oldSize);
7f561c08de6b Initial load
duke
parents:
diff changeset
   310
            _adapters = newArray;
7f561c08de6b Initial load
duke
parents:
diff changeset
   311
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   312
7f561c08de6b Initial load
duke
parents:
diff changeset
   313
        _free = domNo + 1;
7f561c08de6b Initial load
duke
parents:
diff changeset
   314
7f561c08de6b Initial load
duke
parents:
diff changeset
   315
        if (dtmSize == 1) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   316
            _adapters[domNo] = adapter;
7f561c08de6b Initial load
duke
parents:
diff changeset
   317
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   318
        else if (dtmIds != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   319
            int domPos = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
   320
            for (int i = dtmSize - 1; i >= 0; i--) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   321
                domPos = dtmIds.elementAt(i) >>> DTMManager.IDENT_DTM_NODE_BITS;
7f561c08de6b Initial load
duke
parents:
diff changeset
   322
                _adapters[domPos] = adapter;
7f561c08de6b Initial load
duke
parents:
diff changeset
   323
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   324
            domNo = domPos;
7f561c08de6b Initial load
duke
parents:
diff changeset
   325
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   326
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
   327
        // Store reference to document (URI) in the Map
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   328
        if (indexByURI) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   329
            String uri = adapter.getDocumentURI(0);
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
   330
            _documents.put(uri, domNo);
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   331
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   332
7f561c08de6b Initial load
duke
parents:
diff changeset
   333
        // If the dom is an AdaptiveResultTreeImpl, we need to create a
7f561c08de6b Initial load
duke
parents:
diff changeset
   334
        // DOMAdapter around its nested dom object (if it is non-null) and
7f561c08de6b Initial load
duke
parents:
diff changeset
   335
        // add the DOMAdapter to the list.
7f561c08de6b Initial load
duke
parents:
diff changeset
   336
        if (dom instanceof AdaptiveResultTreeImpl) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   337
            AdaptiveResultTreeImpl adaptiveRTF = (AdaptiveResultTreeImpl)dom;
7f561c08de6b Initial load
duke
parents:
diff changeset
   338
            DOM nestedDom = adaptiveRTF.getNestedDOM();
7f561c08de6b Initial load
duke
parents:
diff changeset
   339
            if (nestedDom != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   340
                DOMAdapter newAdapter = new DOMAdapter(nestedDom,
7f561c08de6b Initial load
duke
parents:
diff changeset
   341
                                                       adapter.getNamesArray(),
7f561c08de6b Initial load
duke
parents:
diff changeset
   342
                                                       adapter.getUrisArray(),
7f561c08de6b Initial load
duke
parents:
diff changeset
   343
                                                       adapter.getTypesArray(),
7f561c08de6b Initial load
duke
parents:
diff changeset
   344
                                                       adapter.getNamespaceArray());
7f561c08de6b Initial load
duke
parents:
diff changeset
   345
                addDOMAdapter(newAdapter);
7f561c08de6b Initial load
duke
parents:
diff changeset
   346
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   347
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   348
7f561c08de6b Initial load
duke
parents:
diff changeset
   349
        return domNo;
7f561c08de6b Initial load
duke
parents:
diff changeset
   350
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   351
7f561c08de6b Initial load
duke
parents:
diff changeset
   352
    public int getDocumentMask(String uri) {
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
   353
        Integer domIdx = _documents.get(uri);
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   354
        if (domIdx == null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   355
            return(-1);
7f561c08de6b Initial load
duke
parents:
diff changeset
   356
        } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
   357
            return domIdx.intValue();
7f561c08de6b Initial load
duke
parents:
diff changeset
   358
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   359
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   360
7f561c08de6b Initial load
duke
parents:
diff changeset
   361
    public DOM getDOMAdapter(String uri) {
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
   362
        Integer domIdx = _documents.get(uri);
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   363
        if (domIdx == null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   364
            return(null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   365
        } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
   366
            return(_adapters[domIdx.intValue()]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   367
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   368
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   369
7f561c08de6b Initial load
duke
parents:
diff changeset
   370
    public int getDocument()
7f561c08de6b Initial load
duke
parents:
diff changeset
   371
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   372
        return _main.getDocument();
7f561c08de6b Initial load
duke
parents:
diff changeset
   373
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   374
7f561c08de6b Initial load
duke
parents:
diff changeset
   375
    public DTMManager getDTMManager() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   376
        return _dtmManager;
7f561c08de6b Initial load
duke
parents:
diff changeset
   377
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   378
7f561c08de6b Initial load
duke
parents:
diff changeset
   379
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   380
      * Returns singleton iterator containing the document root
7f561c08de6b Initial load
duke
parents:
diff changeset
   381
      */
7f561c08de6b Initial load
duke
parents:
diff changeset
   382
    public DTMAxisIterator getIterator() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   383
        // main source document @ 0
7f561c08de6b Initial load
duke
parents:
diff changeset
   384
        return _main.getIterator();
7f561c08de6b Initial load
duke
parents:
diff changeset
   385
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   386
7f561c08de6b Initial load
duke
parents:
diff changeset
   387
    public String getStringValue() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   388
        return _main.getStringValue();
7f561c08de6b Initial load
duke
parents:
diff changeset
   389
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   390
7f561c08de6b Initial load
duke
parents:
diff changeset
   391
    public DTMAxisIterator getChildren(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   392
        return _adapters[getDTMId(node)].getChildren(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   393
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   394
7f561c08de6b Initial load
duke
parents:
diff changeset
   395
    public DTMAxisIterator getTypedChildren(final int type) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   396
        return new AxisIterator(Axis.CHILD, type);
7f561c08de6b Initial load
duke
parents:
diff changeset
   397
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   398
7f561c08de6b Initial load
duke
parents:
diff changeset
   399
    public DTMAxisIterator getAxisIterator(final int axis) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   400
        return new AxisIterator(axis, NO_TYPE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   401
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   402
7f561c08de6b Initial load
duke
parents:
diff changeset
   403
    public DTMAxisIterator getTypedAxisIterator(final int axis, final int type)
7f561c08de6b Initial load
duke
parents:
diff changeset
   404
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   405
        return new AxisIterator(axis, type);
7f561c08de6b Initial load
duke
parents:
diff changeset
   406
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   407
7f561c08de6b Initial load
duke
parents:
diff changeset
   408
    public DTMAxisIterator getNthDescendant(int node, int n,
7f561c08de6b Initial load
duke
parents:
diff changeset
   409
                                            boolean includeself)
7f561c08de6b Initial load
duke
parents:
diff changeset
   410
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   411
        return _adapters[getDTMId(node)].getNthDescendant(node, n, includeself);
7f561c08de6b Initial load
duke
parents:
diff changeset
   412
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   413
7f561c08de6b Initial load
duke
parents:
diff changeset
   414
    public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iterator,
7f561c08de6b Initial load
duke
parents:
diff changeset
   415
                                                int type, String value,
7f561c08de6b Initial load
duke
parents:
diff changeset
   416
                                                boolean op)
7f561c08de6b Initial load
duke
parents:
diff changeset
   417
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   418
        return(new NodeValueIterator(iterator, type, value, op));
7f561c08de6b Initial load
duke
parents:
diff changeset
   419
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   420
7f561c08de6b Initial load
duke
parents:
diff changeset
   421
    public DTMAxisIterator getNamespaceAxisIterator(final int axis,
7f561c08de6b Initial load
duke
parents:
diff changeset
   422
                                                    final int ns)
7f561c08de6b Initial load
duke
parents:
diff changeset
   423
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   424
        DTMAxisIterator iterator = _main.getNamespaceAxisIterator(axis, ns);
7f561c08de6b Initial load
duke
parents:
diff changeset
   425
        return(iterator);
7f561c08de6b Initial load
duke
parents:
diff changeset
   426
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   427
7f561c08de6b Initial load
duke
parents:
diff changeset
   428
    public DTMAxisIterator orderNodes(DTMAxisIterator source, int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   429
        return _adapters[getDTMId(node)].orderNodes(source, node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   430
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   431
7f561c08de6b Initial load
duke
parents:
diff changeset
   432
    public int getExpandedTypeID(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   433
        if (node != DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   434
            return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getExpandedTypeID(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   435
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   436
        else {
7f561c08de6b Initial load
duke
parents:
diff changeset
   437
            return DTM.NULL;
7f561c08de6b Initial load
duke
parents:
diff changeset
   438
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   439
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   440
7f561c08de6b Initial load
duke
parents:
diff changeset
   441
    public int getNamespaceType(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   442
        return _adapters[getDTMId(node)].getNamespaceType(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   443
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   444
7f561c08de6b Initial load
duke
parents:
diff changeset
   445
    public int getNSType(int node)
7f561c08de6b Initial load
duke
parents:
diff changeset
   446
   {
7f561c08de6b Initial load
duke
parents:
diff changeset
   447
        return _adapters[getDTMId(node)].getNSType(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   448
   }
7f561c08de6b Initial load
duke
parents:
diff changeset
   449
7f561c08de6b Initial load
duke
parents:
diff changeset
   450
    public int getParent(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   451
        if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   452
            return DTM.NULL;
7f561c08de6b Initial load
duke
parents:
diff changeset
   453
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   454
        return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getParent(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   455
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   456
7f561c08de6b Initial load
duke
parents:
diff changeset
   457
    public int getAttributeNode(final int type, final int el) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   458
        if (el == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   459
            return DTM.NULL;
7f561c08de6b Initial load
duke
parents:
diff changeset
   460
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   461
        return _adapters[el >>> DTMManager.IDENT_DTM_NODE_BITS].getAttributeNode(type, el);
7f561c08de6b Initial load
duke
parents:
diff changeset
   462
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   463
7f561c08de6b Initial load
duke
parents:
diff changeset
   464
    public String getNodeName(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   465
        if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   466
            return "";
7f561c08de6b Initial load
duke
parents:
diff changeset
   467
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   468
        return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getNodeName(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   469
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   470
7f561c08de6b Initial load
duke
parents:
diff changeset
   471
    public String getNodeNameX(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   472
        if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   473
            return "";
7f561c08de6b Initial load
duke
parents:
diff changeset
   474
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   475
        return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getNodeNameX(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   476
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   477
7f561c08de6b Initial load
duke
parents:
diff changeset
   478
    public String getNamespaceName(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   479
        if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   480
            return "";
7f561c08de6b Initial load
duke
parents:
diff changeset
   481
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   482
        return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getNamespaceName(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   483
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   484
7f561c08de6b Initial load
duke
parents:
diff changeset
   485
    public String getStringValueX(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   486
        if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   487
            return "";
7f561c08de6b Initial load
duke
parents:
diff changeset
   488
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   489
        return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getStringValueX(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   490
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   491
7f561c08de6b Initial load
duke
parents:
diff changeset
   492
    public void copy(final int node, SerializationHandler handler)
7f561c08de6b Initial load
duke
parents:
diff changeset
   493
        throws TransletException
7f561c08de6b Initial load
duke
parents:
diff changeset
   494
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   495
        if (node != DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   496
            _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
7f561c08de6b Initial load
duke
parents:
diff changeset
   497
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   498
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   499
7f561c08de6b Initial load
duke
parents:
diff changeset
   500
    public void copy(DTMAxisIterator nodes, SerializationHandler handler)
7f561c08de6b Initial load
duke
parents:
diff changeset
   501
            throws TransletException
7f561c08de6b Initial load
duke
parents:
diff changeset
   502
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   503
        int node;
7f561c08de6b Initial load
duke
parents:
diff changeset
   504
        while ((node = nodes.next()) != DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   505
            _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
7f561c08de6b Initial load
duke
parents:
diff changeset
   506
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   507
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   508
7f561c08de6b Initial load
duke
parents:
diff changeset
   509
7f561c08de6b Initial load
duke
parents:
diff changeset
   510
    public String shallowCopy(final int node, SerializationHandler handler)
7f561c08de6b Initial load
duke
parents:
diff changeset
   511
            throws TransletException
7f561c08de6b Initial load
duke
parents:
diff changeset
   512
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   513
        if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   514
            return "";
7f561c08de6b Initial load
duke
parents:
diff changeset
   515
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   516
        return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].shallowCopy(node, handler);
7f561c08de6b Initial load
duke
parents:
diff changeset
   517
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   518
7f561c08de6b Initial load
duke
parents:
diff changeset
   519
    public boolean lessThan(final int node1, final int node2) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   520
        if (node1 == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   521
            return true;
7f561c08de6b Initial load
duke
parents:
diff changeset
   522
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   523
        if (node2 == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   524
            return false;
7f561c08de6b Initial load
duke
parents:
diff changeset
   525
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   526
        final int dom1 = getDTMId(node1);
7f561c08de6b Initial load
duke
parents:
diff changeset
   527
        final int dom2 = getDTMId(node2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   528
        return dom1 == dom2 ? _adapters[dom1].lessThan(node1, node2)
7f561c08de6b Initial load
duke
parents:
diff changeset
   529
                            : dom1 < dom2;
7f561c08de6b Initial load
duke
parents:
diff changeset
   530
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   531
7f561c08de6b Initial load
duke
parents:
diff changeset
   532
    public void characters(final int textNode, SerializationHandler handler)
7f561c08de6b Initial load
duke
parents:
diff changeset
   533
                 throws TransletException
7f561c08de6b Initial load
duke
parents:
diff changeset
   534
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   535
        if (textNode != DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   536
            _adapters[textNode >>> DTMManager.IDENT_DTM_NODE_BITS].characters(textNode, handler);
7f561c08de6b Initial load
duke
parents:
diff changeset
   537
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   538
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   539
7f561c08de6b Initial load
duke
parents:
diff changeset
   540
    public void setFilter(StripFilter filter) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   541
        for (int dom=0; dom<_free; dom++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   542
            if (_adapters[dom] != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   543
                _adapters[dom].setFilter(filter);
7f561c08de6b Initial load
duke
parents:
diff changeset
   544
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   545
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   546
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   547
7f561c08de6b Initial load
duke
parents:
diff changeset
   548
    public Node makeNode(int index) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   549
        if (index == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   550
            return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   551
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   552
        return _adapters[getDTMId(index)].makeNode(index);
7f561c08de6b Initial load
duke
parents:
diff changeset
   553
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   554
7f561c08de6b Initial load
duke
parents:
diff changeset
   555
    public Node makeNode(DTMAxisIterator iter) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   556
        // TODO: gather nodes from all DOMs ?
7f561c08de6b Initial load
duke
parents:
diff changeset
   557
        return _main.makeNode(iter);
7f561c08de6b Initial load
duke
parents:
diff changeset
   558
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   559
7f561c08de6b Initial load
duke
parents:
diff changeset
   560
    public NodeList makeNodeList(int index) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   561
        if (index == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   562
            return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   563
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   564
        return _adapters[getDTMId(index)].makeNodeList(index);
7f561c08de6b Initial load
duke
parents:
diff changeset
   565
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   566
7f561c08de6b Initial load
duke
parents:
diff changeset
   567
    public NodeList makeNodeList(DTMAxisIterator iter) {
30521
42e1babcddcc 8062518: AIOBE occurs when accessing to document function in extended function in JAXP
aefimov
parents: 25868
diff changeset
   568
        int index = iter.next();
42e1babcddcc 8062518: AIOBE occurs when accessing to document function in extended function in JAXP
aefimov
parents: 25868
diff changeset
   569
        if (index == DTM.NULL) {
32328
a09e22b759a7 8133924: NPE may be thrown when xsltc select a non-existing node after JDK-8062518
joehw
parents: 30521
diff changeset
   570
            return new DTMAxisIterNodeList(null, null);
30521
42e1babcddcc 8062518: AIOBE occurs when accessing to document function in extended function in JAXP
aefimov
parents: 25868
diff changeset
   571
        }
42e1babcddcc 8062518: AIOBE occurs when accessing to document function in extended function in JAXP
aefimov
parents: 25868
diff changeset
   572
        iter.reset();
42e1babcddcc 8062518: AIOBE occurs when accessing to document function in extended function in JAXP
aefimov
parents: 25868
diff changeset
   573
        return _adapters[getDTMId(index)].makeNodeList(iter);
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   574
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   575
7f561c08de6b Initial load
duke
parents:
diff changeset
   576
    public String getLanguage(int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   577
        return _adapters[getDTMId(node)].getLanguage(node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   578
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   579
7f561c08de6b Initial load
duke
parents:
diff changeset
   580
    public int getSize() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   581
        int size = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
   582
        for (int i=0; i<_size; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   583
            size += _adapters[i].getSize();
7f561c08de6b Initial load
duke
parents:
diff changeset
   584
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   585
        return(size);
7f561c08de6b Initial load
duke
parents:
diff changeset
   586
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   587
7f561c08de6b Initial load
duke
parents:
diff changeset
   588
    public String getDocumentURI(int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   589
        if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   590
            node = DOM.NULL;
7f561c08de6b Initial load
duke
parents:
diff changeset
   591
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   592
        return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getDocumentURI(0);
7f561c08de6b Initial load
duke
parents:
diff changeset
   593
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   594
7f561c08de6b Initial load
duke
parents:
diff changeset
   595
    public boolean isElement(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   596
        if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   597
            return false;
7f561c08de6b Initial load
duke
parents:
diff changeset
   598
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   599
        return(_adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].isElement(node));
7f561c08de6b Initial load
duke
parents:
diff changeset
   600
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   601
7f561c08de6b Initial load
duke
parents:
diff changeset
   602
    public boolean isAttribute(final int node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   603
        if (node == DTM.NULL) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   604
            return false;
7f561c08de6b Initial load
duke
parents:
diff changeset
   605
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   606
        return(_adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].isAttribute(node));
7f561c08de6b Initial load
duke
parents:
diff changeset
   607
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   608
7f561c08de6b Initial load
duke
parents:
diff changeset
   609
    public int getDTMId(int nodeHandle)
7f561c08de6b Initial load
duke
parents:
diff changeset
   610
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   611
        if (nodeHandle == DTM.NULL)
7f561c08de6b Initial load
duke
parents:
diff changeset
   612
            return 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
   613
7f561c08de6b Initial load
duke
parents:
diff changeset
   614
        int id = nodeHandle >>> DTMManager.IDENT_DTM_NODE_BITS;
7f561c08de6b Initial load
duke
parents:
diff changeset
   615
        while (id >= 2 && _adapters[id] == _adapters[id-1]) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   616
            id--;
7f561c08de6b Initial load
duke
parents:
diff changeset
   617
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   618
        return id;
7f561c08de6b Initial load
duke
parents:
diff changeset
   619
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   620
7f561c08de6b Initial load
duke
parents:
diff changeset
   621
    public DOM getDTM(int nodeHandle) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   622
        return _adapters[getDTMId(nodeHandle)];
7f561c08de6b Initial load
duke
parents:
diff changeset
   623
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   624
7f561c08de6b Initial load
duke
parents:
diff changeset
   625
    public int getNodeIdent(int nodeHandle)
7f561c08de6b Initial load
duke
parents:
diff changeset
   626
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   627
        return _adapters[nodeHandle >>> DTMManager.IDENT_DTM_NODE_BITS].getNodeIdent(nodeHandle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   628
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   629
7f561c08de6b Initial load
duke
parents:
diff changeset
   630
    public int getNodeHandle(int nodeId)
7f561c08de6b Initial load
duke
parents:
diff changeset
   631
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   632
        return _main.getNodeHandle(nodeId);
7f561c08de6b Initial load
duke
parents:
diff changeset
   633
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   634
7f561c08de6b Initial load
duke
parents:
diff changeset
   635
    public DOM getResultTreeFrag(int initSize, int rtfType)
7f561c08de6b Initial load
duke
parents:
diff changeset
   636
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   637
        return _main.getResultTreeFrag(initSize, rtfType);
7f561c08de6b Initial load
duke
parents:
diff changeset
   638
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   639
7f561c08de6b Initial load
duke
parents:
diff changeset
   640
    public DOM getResultTreeFrag(int initSize, int rtfType, boolean addToManager)
7f561c08de6b Initial load
duke
parents:
diff changeset
   641
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   642
        return _main.getResultTreeFrag(initSize, rtfType, addToManager);
7f561c08de6b Initial load
duke
parents:
diff changeset
   643
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   644
7f561c08de6b Initial load
duke
parents:
diff changeset
   645
    public DOM getMain()
7f561c08de6b Initial load
duke
parents:
diff changeset
   646
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   647
        return _main;
7f561c08de6b Initial load
duke
parents:
diff changeset
   648
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   649
7f561c08de6b Initial load
duke
parents:
diff changeset
   650
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   651
     * Returns a DOMBuilder class wrapped in a SAX adapter.
7f561c08de6b Initial load
duke
parents:
diff changeset
   652
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   653
    public SerializationHandler getOutputDomBuilder()
7f561c08de6b Initial load
duke
parents:
diff changeset
   654
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   655
        return _main.getOutputDomBuilder();
7f561c08de6b Initial load
duke
parents:
diff changeset
   656
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   657
7f561c08de6b Initial load
duke
parents:
diff changeset
   658
    public String lookupNamespace(int node, String prefix)
7f561c08de6b Initial load
duke
parents:
diff changeset
   659
        throws TransletException
7f561c08de6b Initial load
duke
parents:
diff changeset
   660
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   661
        return _main.lookupNamespace(node, prefix);
7f561c08de6b Initial load
duke
parents:
diff changeset
   662
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   663
7f561c08de6b Initial load
duke
parents:
diff changeset
   664
    // %HZ% Does this method make any sense here???
7f561c08de6b Initial load
duke
parents:
diff changeset
   665
    public String getUnparsedEntityURI(String entity) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   666
        return _main.getUnparsedEntityURI(entity);
7f561c08de6b Initial load
duke
parents:
diff changeset
   667
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   668
7f561c08de6b Initial load
duke
parents:
diff changeset
   669
    // %HZ% Does this method make any sense here???
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 32328
diff changeset
   670
    public Map<String, Integer> getElementsWithIDs() {
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   671
        return _main.getElementsWithIDs();
7f561c08de6b Initial load
duke
parents:
diff changeset
   672
    }
36486
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   673
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   674
    public void release() {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   675
        _main.release();
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   676
    }
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   677
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   678
    private boolean isMatchingAdapterEntry(DOM entry, DOMAdapter adapter) {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   679
        DOM dom = adapter.getDOMImpl();
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   680
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   681
        return (entry == adapter) || (
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   682
            /*
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   683
             * Method addDOMAdapter overwrites for AdaptiveResultTreeImpl
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   684
             * objects the usual entry with an adapter to the nested
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   685
             * DOM, so we must check this here. See last 'if' statement
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   686
             * of addDOMAdapter.
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   687
             */
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   688
            (dom instanceof AdaptiveResultTreeImpl) &&
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   689
            (entry instanceof DOMAdapter) &&
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   690
            (((AdaptiveResultTreeImpl)dom).getNestedDOM() == ((DOMAdapter)entry).getDOMImpl())
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   691
        );
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   692
    }
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   693
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   694
    public void removeDOMAdapter(DOMAdapter adapter) {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   695
        _documents.remove(adapter.getDocumentURI(0));
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   696
        DOM dom = adapter.getDOMImpl();
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   697
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   698
        if (dom instanceof DTMDefaultBase) {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   699
            SuballocatedIntVector ids = ((DTMDefaultBase) dom).getDTMIDs();
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   700
            int idsSize = ids.size();
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   701
            for (int i = 0; i < idsSize; i++) {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   702
                _adapters[ids.elementAt(i) >>> DTMManager.IDENT_DTM_NODE_BITS] = null;
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   703
            }
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   704
        } else {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   705
            int id = dom.getDocument() >>> DTMManager.IDENT_DTM_NODE_BITS;
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   706
            if ((id > 0) && (id < _adapters.length) && isMatchingAdapterEntry(_adapters[id], adapter)) {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   707
                _adapters[id] = null;
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   708
            } else {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   709
                boolean found = false;
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   710
                for (int i = 0; i < _adapters.length; i++) {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   711
                    if (isMatchingAdapterEntry(_adapters[id], adapter)) {
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   712
                        _adapters[i] = null;
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   713
                        found = true;
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   714
                        break;
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   715
                    }
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   716
                }
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   717
            }
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   718
        }
b84e564d2358 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
joehw
parents: 33349
diff changeset
   719
    }
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   720
}