< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/LocPathIterator.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.xpath.internal.axes;
  23 


 277    * Tell if the expression is a nodeset expression.
 278    *
 279    * @return true if the expression can be represented as a nodeset.
 280    */
 281   public boolean isNodesetExpr()
 282   {
 283     return true;
 284   }
 285 
 286   /**
 287    * Return the first node out of the nodeset, if this expression is
 288    * a nodeset expression.  This is the default implementation for
 289    * nodesets.  Derived classes should try and override this and return a
 290    * value without having to do a clone operation.
 291    * @param xctxt The XPath runtime context.
 292    * @return the first node out of the nodeset, or DTM.NULL.
 293    */
 294   public int asNode(XPathContext xctxt)
 295     throws javax.xml.transform.TransformerException
 296   {
 297     DTMIterator iter = (DTMIterator)m_clones.getInstance();
 298 
 299     int current = xctxt.getCurrentNode();
 300 
 301     iter.setRoot(current, xctxt);
 302 
 303     int next = iter.nextNode();
 304     // m_clones.freeInstance(iter);
 305     iter.detach();
 306     return next;
 307   }
 308 
 309   /**
 310    * Evaluate this operation directly to a boolean.
 311    *
 312    * @param xctxt The runtime execution context.
 313    *
 314    * @return The result of the operation as a boolean.
 315    *
 316    * @throws javax.xml.transform.TransformerException
 317    */


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
   3  * @LastModified: Nov 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 
  22 package com.sun.org.apache.xpath.internal.axes;
  23 


 277    * Tell if the expression is a nodeset expression.
 278    *
 279    * @return true if the expression can be represented as a nodeset.
 280    */
 281   public boolean isNodesetExpr()
 282   {
 283     return true;
 284   }
 285 
 286   /**
 287    * Return the first node out of the nodeset, if this expression is
 288    * a nodeset expression.  This is the default implementation for
 289    * nodesets.  Derived classes should try and override this and return a
 290    * value without having to do a clone operation.
 291    * @param xctxt The XPath runtime context.
 292    * @return the first node out of the nodeset, or DTM.NULL.
 293    */
 294   public int asNode(XPathContext xctxt)
 295     throws javax.xml.transform.TransformerException
 296   {
 297     DTMIterator iter = m_clones.getInstance();
 298 
 299     int current = xctxt.getCurrentNode();
 300 
 301     iter.setRoot(current, xctxt);
 302 
 303     int next = iter.nextNode();
 304     // m_clones.freeInstance(iter);
 305     iter.detach();
 306     return next;
 307   }
 308 
 309   /**
 310    * Evaluate this operation directly to a boolean.
 311    *
 312    * @param xctxt The runtime execution context.
 313    *
 314    * @return The result of the operation as a boolean.
 315    *
 316    * @throws javax.xml.transform.TransformerException
 317    */


< prev index next >