KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > xsltc > dom > ClonedNodeListIterator


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: ClonedNodeListIterator.java,v 1.2 2004/02/16 22:54:59 minchau Exp $
18  */

19
20 package org.apache.xalan.xsltc.dom;
21
22 import org.apache.xml.dtm.DTMAxisIterator;
23 import org.apache.xml.dtm.ref.DTMAxisIteratorBase;
24
25 /**
26  * A ClonedNodeListIterator is returned by the cloneIterator() method
27  * of a CachedNodeListIterator. Its next() method retrieves the nodes from
28  * the cache of the CachedNodeListIterator.
29  */

30 public final class ClonedNodeListIterator extends DTMAxisIteratorBase {
31
32     /**
33      * Source for this iterator.
34      */

35     private CachedNodeListIterator _source;
36     private int _index = 0;
37
38     public ClonedNodeListIterator(CachedNodeListIterator source) {
39     _source = source;
40     }
41
42     public void setRestartable(boolean isRestartable) {
43     //_isRestartable = isRestartable;
44
//_source.setRestartable(isRestartable);
45
}
46
47     public DTMAxisIterator setStartNode(int node) {
48     return this;
49     }
50
51     public int next() {
52         return _source.getNode(_index++);
53     }
54     
55     public int getPosition() {
56         return _index == 0 ? 1 : _index;
57     }
58
59     public int getNodeByPosition(int pos) {
60         return _source.getNode(pos);
61     }
62     
63     public DTMAxisIterator cloneIterator() {
64     return _source.cloneIterator();
65     }
66
67     public DTMAxisIterator reset() {
68         _index = 0;
69         return this;
70     }
71     
72     public void setMark() {
73     _source.setMark();
74     }
75
76     public void gotoMark() {
77     _source.gotoMark();
78     }
79 }
80
Popular Tags