1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Oct 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21 package com.sun.org.apache.xerces.internal.dom;
22
23 import java.util.ArrayList;
55 * getElementsByTagName case. The current solution is for Nodes to
56 * maintain a change count (eventually that may be a Digest instead),
57 * which the NodeList tracks and uses to invalidate itself.
58 * <P>
59 * Unfortunately, this does _not_ respond efficiently in the case that
60 * the dynamic behavior was supposed to address: scanning a tree while
61 * it is being extended. That requires knowing which subtrees have
62 * changed, which can become an arbitrarily complex problem.
63 * <P>
64 * We save some work by filling the vector only as we access the
65 * item()s... but I suspect the same users who demanded index-based
66 * access will also start by doing a getLength() to control their loop,
67 * blowing this optimization out of the water.
68 * <P>
69 * NOTE: Level 2 of the DOM will probably _not_ use NodeList for its
70 * extended search mechanisms, partly for the reasons just discussed.
71 *
72 * @xerces.internal
73 *
74 * @since PR-DOM-Level-1-19980818.
75 */
76 public class DeepNodeListImpl
77 implements NodeList {
78
79 //
80 // Data
81 //
82 protected NodeImpl rootNode; // Where the search started
83 protected String tagName; // Or "*" to mean all-tags-acceptable
84 protected int changes = 0;
85 protected List<Node> nodes;
86
87 protected String nsName;
88 protected boolean enableNS = false;
89
90 //
91 // Constructors
92 //
93
94 /** Constructor. */
|
1 /*
2 * Copyright (c) 2017, 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 package com.sun.org.apache.xerces.internal.dom;
21
22 import java.util.ArrayList;
54 * getElementsByTagName case. The current solution is for Nodes to
55 * maintain a change count (eventually that may be a Digest instead),
56 * which the NodeList tracks and uses to invalidate itself.
57 * <P>
58 * Unfortunately, this does _not_ respond efficiently in the case that
59 * the dynamic behavior was supposed to address: scanning a tree while
60 * it is being extended. That requires knowing which subtrees have
61 * changed, which can become an arbitrarily complex problem.
62 * <P>
63 * We save some work by filling the vector only as we access the
64 * item()s... but I suspect the same users who demanded index-based
65 * access will also start by doing a getLength() to control their loop,
66 * blowing this optimization out of the water.
67 * <P>
68 * NOTE: Level 2 of the DOM will probably _not_ use NodeList for its
69 * extended search mechanisms, partly for the reasons just discussed.
70 *
71 * @xerces.internal
72 *
73 * @since PR-DOM-Level-1-19980818.
74 * @LastModified: Oct 2017
75 */
76 public class DeepNodeListImpl
77 implements NodeList {
78
79 //
80 // Data
81 //
82 protected NodeImpl rootNode; // Where the search started
83 protected String tagName; // Or "*" to mean all-tags-acceptable
84 protected int changes = 0;
85 protected List<Node> nodes;
86
87 protected String nsName;
88 protected boolean enableNS = false;
89
90 //
91 // Constructors
92 //
93
94 /** Constructor. */
|