|
Java example source code file (OneStepIterator.java)
The OneStepIterator.java Java example source code/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: OneStepIterator.java,v 1.2.4.2 2005/09/14 19:45:22 jeffsuttor Exp $
*/
package com.sun.org.apache.xpath.internal.axes;
import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
import com.sun.org.apache.xml.internal.dtm.DTMFilter;
import com.sun.org.apache.xml.internal.dtm.DTMIterator;
import com.sun.org.apache.xpath.internal.Expression;
import com.sun.org.apache.xpath.internal.XPathContext;
import com.sun.org.apache.xpath.internal.compiler.Compiler;
import com.sun.org.apache.xpath.internal.compiler.OpMap;
/**
* This class implements a general iterator for
* those LocationSteps with only one step, and perhaps a predicate.
* @see com.sun.org.apache.xpath.internal.axes#LocPathIterator
* @xsl.usage advanced
*/
public class OneStepIterator extends ChildTestIterator
{
static final long serialVersionUID = 4623710779664998283L;
/** The traversal axis from where the nodes will be filtered. */
protected int m_axis = -1;
/** The DTM inner traversal class, that corresponds to the super axis. */
protected DTMAxisIterator m_iterator;
/**
* Create a OneStepIterator object.
*
* @param compiler A reference to the Compiler that contains the op map.
* @param opPos The position within the op map, which contains the
* location path expression for this itterator.
*
* @throws javax.xml.transform.TransformerException
*/
OneStepIterator(Compiler compiler, int opPos, int analysis)
throws javax.xml.transform.TransformerException
{
super(compiler, opPos, analysis);
int firstStepPos = OpMap.getFirstChildPos(opPos);
m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos);
}
/**
* Create a OneStepIterator object.
*
* @param iterator The DTM iterator which this iterator will use.
* @param axis One of Axis.Child, etc., or -1 if the axis is unknown.
*
* @throws javax.xml.transform.TransformerException
*/
public OneStepIterator(DTMAxisIterator iterator, int axis)
throws javax.xml.transform.TransformerException
{
super(null);
m_iterator = iterator;
m_axis = axis;
int whatToShow = DTMFilter.SHOW_ALL;
initNodeTest(whatToShow);
}
/**
* Initialize the context values for this expression
* after it is cloned.
*
* @param context The XPath runtime context for this
* transformation.
*/
public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
if(m_axis > -1)
m_iterator = m_cdtm.getAxisIterator(m_axis);
m_iterator.setStartNode(m_context);
}
/**
* Detaches the iterator from the set which it iterated over, releasing
* any computational resources and placing the iterator in the INVALID
* state. After<code>detach has been invoked, calls to
* <code>nextNode or
Other Java examples (source code examples)Here is a short list of links related to this Java OneStepIterator.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.