< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/ForwardPositionIterator.java

Print this page


   1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   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 
  22 package com.sun.org.apache.xalan.internal.xsltc.dom;
  23 


  43  * whether the result of getPosition() should be
  44  * interpreted as being equal to position().
  45  * But when the expression appears in apply-templates of
  46  * for-each, the position() function operates in document
  47  * order.
  48  *
  49  * The only effect of the ForwardPositionIterator is to force
  50  * the result of isReverse() to false, so that
  51  * BasisLibrary.positionF() calculates position() in a way
  52  * that's consistent with the context in which the
  53  * iterator is being used."
  54  *
  55  * (Apparently the correction of isReverse() occurs
  56  * implicitly, by inheritance. This class also appears
  57  * to maintain its own position counter, which seems
  58  * redundant.)
  59  *
  60  * @deprecated This class exists only for backwards compatibility with old
  61  *             translets.  New code should not reference it.
  62  */

  63 public final class ForwardPositionIterator extends DTMAxisIteratorBase {
  64 
  65     private DTMAxisIterator _source;
  66 
  67     public ForwardPositionIterator(DTMAxisIterator source) {
  68         _source = source;
  69     }
  70 
  71     public DTMAxisIterator cloneIterator() {
  72         try {
  73             final ForwardPositionIterator clone =
  74                 (ForwardPositionIterator) super.clone();
  75             clone._source = _source.cloneIterator();
  76             clone._isRestartable = false;
  77             return clone.reset();
  78         }
  79         catch (CloneNotSupportedException e) {
  80             BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
  81                                       e.toString());
  82             return null;


   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 
  21 package com.sun.org.apache.xalan.internal.xsltc.dom;
  22 


  42  * whether the result of getPosition() should be
  43  * interpreted as being equal to position().
  44  * But when the expression appears in apply-templates of
  45  * for-each, the position() function operates in document
  46  * order.
  47  *
  48  * The only effect of the ForwardPositionIterator is to force
  49  * the result of isReverse() to false, so that
  50  * BasisLibrary.positionF() calculates position() in a way
  51  * that's consistent with the context in which the
  52  * iterator is being used."
  53  *
  54  * (Apparently the correction of isReverse() occurs
  55  * implicitly, by inheritance. This class also appears
  56  * to maintain its own position counter, which seems
  57  * redundant.)
  58  *
  59  * @deprecated This class exists only for backwards compatibility with old
  60  *             translets.  New code should not reference it.
  61  */
  62 @Deprecated
  63 public final class ForwardPositionIterator extends DTMAxisIteratorBase {
  64 
  65     private DTMAxisIterator _source;
  66 
  67     public ForwardPositionIterator(DTMAxisIterator source) {
  68         _source = source;
  69     }
  70 
  71     public DTMAxisIterator cloneIterator() {
  72         try {
  73             final ForwardPositionIterator clone =
  74                 (ForwardPositionIterator) super.clone();
  75             clone._source = _source.cloneIterator();
  76             clone._isRestartable = false;
  77             return clone.reset();
  78         }
  79         catch (CloneNotSupportedException e) {
  80             BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
  81                                       e.toString());
  82             return null;


< prev index next >