org.apache.commons.configuration.tree.xpath
Class ConfigurationNodeIteratorAttribute

java.lang.Object
  extended byorg.apache.commons.configuration.tree.xpath.ConfigurationNodeIteratorBase
      extended byorg.apache.commons.configuration.tree.xpath.ConfigurationNodeIteratorAttribute
All Implemented Interfaces:
org.apache.commons.jxpath.ri.model.NodeIterator

class ConfigurationNodeIteratorAttribute
extends ConfigurationNodeIteratorBase

A specialized node iterator implementation that deals with attribute nodes.

Version:
$Id: ConfigurationNodeIteratorAttribute.java 439648 2006-09-02 20:42:10Z oheger $
Author:
Oliver Heger

Constructor Summary
ConfigurationNodeIteratorAttribute(org.apache.commons.jxpath.ri.model.NodePointer parent, org.apache.commons.jxpath.ri.QName name)
          Creates a new instance of ConfigurationNodeIteratorAttribute.
 
Method Summary
protected  org.apache.commons.jxpath.ri.model.NodePointer createNodePointer(ConfigurationNode node)
          Creates the configuration node pointer for the current position.
protected  List createSubNodeList(ConfigurationNode node, org.apache.commons.jxpath.ri.QName name)
          Determines which attributes are selected based on the passed in node name.
protected  int getMaxPosition()
          Returns the maximum position for this iterator.
 org.apache.commons.jxpath.ri.model.NodePointer getNodePointer()
          Returns the current node pointer.
protected  org.apache.commons.jxpath.ri.model.NodePointer getParent()
          Returns the parent node pointer.
 int getPosition()
          Returns the position of the iteration.
protected  int getStartOffset()
          Returns the start offset of the iteration.
protected  void initSubNodeList(List nodes)
          Initializes the list of sub nodes for the iteration.
protected  int positionToIndex(int pos)
          Returns the index in the data list for the given position.
 boolean setPosition(int pos)
          Sets the position of the iteration.
protected  void setStartOffset(int startOffset)
          Sets the start offset of the iteration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationNodeIteratorAttribute

public ConfigurationNodeIteratorAttribute(org.apache.commons.jxpath.ri.model.NodePointer parent,
                                          org.apache.commons.jxpath.ri.QName name)
Creates a new instance of ConfigurationNodeIteratorAttribute.

Parameters:
parent - the parent node pointer
name - the name of the selected attribute
Method Detail

createSubNodeList

protected List createSubNodeList(ConfigurationNode node,
                                 org.apache.commons.jxpath.ri.QName name)
Determines which attributes are selected based on the passed in node name.

Parameters:
node - the current node
name - the name of the selected attribute
Returns:
a list with the selected attributes

getPosition

public int getPosition()
Returns the position of the iteration.

Specified by:
getPosition in interface org.apache.commons.jxpath.ri.model.NodeIterator
Returns:
the position

setPosition

public boolean setPosition(int pos)
Sets the position of the iteration.

Specified by:
setPosition in interface org.apache.commons.jxpath.ri.model.NodeIterator
Parameters:
pos - the new position
Returns:
a flag if this is a valid position

getNodePointer

public org.apache.commons.jxpath.ri.model.NodePointer getNodePointer()
Returns the current node pointer.

Specified by:
getNodePointer in interface org.apache.commons.jxpath.ri.model.NodeIterator
Returns:
the current pointer in this iteration

getParent

protected org.apache.commons.jxpath.ri.model.NodePointer getParent()
Returns the parent node pointer.

Returns:
the parent node pointer

getStartOffset

protected int getStartOffset()
Returns the start offset of the iteration.

Returns:
the start offset

setStartOffset

protected void setStartOffset(int startOffset)
Sets the start offset of the iteration. This is used when a start element was set.

Parameters:
startOffset - the start offset

initSubNodeList

protected void initSubNodeList(List nodes)
Initializes the list of sub nodes for the iteration. This method must be called during initialization phase.

Parameters:
nodes - the list with the sub nodes

getMaxPosition

protected int getMaxPosition()
Returns the maximum position for this iterator.

Returns:
the maximum allowed position

createNodePointer

protected org.apache.commons.jxpath.ri.model.NodePointer createNodePointer(ConfigurationNode node)
Creates the configuration node pointer for the current position. This method is called by getNodePointer(). Derived classes must create the correct pointer object.

Parameters:
node - the current configuration node
Returns:
the node pointer

positionToIndex

protected int positionToIndex(int pos)
Returns the index in the data list for the given position. This method also checks the reverse flag.

Parameters:
pos - the position (1-based)
Returns:
the corresponding list index


Copyright © 2001-2006 The Apache Software Foundation. All Rights Reserved.