Java Doc for DTMIterator.java in  » XML » xalan » org » apache » xml » dtm » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » xalan » org.apache.xml.dtm 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.xml.dtm.DTMIterator

All known Subclasses:   org.apache.xpath.axes.UnionPathIterator,  org.apache.xpath.NodeSetDTM,  org.apache.xpath.axes.NodeSequence,  org.apache.xpath.axes.LocPathIterator,
DTMIterator
public interface DTMIterator (Code)
DTMIterators are used to step through a (possibly filtered) set of nodes. Their API is modeled largely after the DOM NodeIterator.

A DTMIterator is a somewhat unusual type of iterator, in that it can serve both single node iteration and random access.

The DTMIterator's traversal semantics, i.e. how it walks the tree, are specified when it is created, possibly and probably by an XPath UnionExpr.

A DTMIterator is meant to be created once as a master static object, and then cloned many times for runtime use. Or the master object itself may be used for simpler use cases.

At this time, we do not expect DTMIterator to emulate NodeIterator's "maintain relative position" semantics under document mutation. It's likely to respond more like the TreeWalker's "current node" semantics. However, since the base DTM is immutable, this issue currently makes no practical difference.

State: In progress!!



Field Summary
final public static  shortFILTER_ACCEPT
     Accept the node.
final public static  shortFILTER_REJECT
     Reject the node.
final public static  shortFILTER_SKIP
     Skip this single node.


Method Summary
public  voidallowDetachToRelease(boolean allowRelease)
     Specify if it's OK for detach to release the iterator for reuse.
public  Objectclone()
     Get a clone of this iterator, but don't reset the iteration in the process, so that it may be used from the current position.
public  DTMIteratorcloneWithReset()
     Get a cloned Iterator that is reset to the start of the iteration.
public  voiddetach()
     Detaches the DTMIterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.
public  intgetAxis()
     Returns the axis being iterated, if it is known.
public  intgetCurrentNode()
     Get the current node in the iterator.
public  intgetCurrentPos()
     Get the current position within the cached list, which is one less than the next nextNode() call will retrieve.
public  DTMgetDTM(int nodeHandle)
     Get an instance of a DTM that "owns" a node handle.
public  DTMManagergetDTMManager()
     Get an instance of the DTMManager.
public  booleangetExpandEntityReferences()
    

The value of this flag determines whether the children of entity reference nodes are visible to the iterator.

public  intgetLength()
     The number of nodes in the list.
public  intgetRoot()
     The root node of the DTMIterator, as specified when it was created.
public  intgetWhatToShow()
     This attribute determines which node types are presented via the iterator.
public  booleanisDocOrdered()
     Returns true if all the nodes in the iteration well be returned in document order.
public  booleanisFresh()
     Tells if this NodeSetDTM is "fresh", in other words, if the first nextNode() that is called will return the first node in the set.
public  booleanisMutable()
     Tells if this iterator can have nodes added to it or set via the setItem(int node, int index) method.
public  intitem(int index)
     Returns the node handle of an item in the collection.
public  intnextNode()
     Returns the next node in the set and advances the position of the iterator in the set.
public  intpreviousNode()
     Returns the previous node in the set and moves the position of the DTMIterator backwards in the set.
public  voidreset()
     Reset the iterator to the start.
public  voidrunTo(int index)
     If an index is requested, NodeSetDTM will call this method to run the iterator to the index.
public  voidsetCurrentPos(int i)
     Set the current position in the node set.
public  voidsetItem(int node, int index)
     Sets the node at the specified index of this vector to be the specified node.
public  voidsetRoot(int nodeHandle, Object environment)
     Reset the root node of the DTMIterator, overriding the value specified when it was created.
public  voidsetShouldCacheNodes(boolean b)
     If setShouldCacheNodes(true) is called, then nodes will be cached, enabling random access, and giving the ability to do sorts and the like.

Field Detail
FILTER_ACCEPT
final public static short FILTER_ACCEPT(Code)
Accept the node.



FILTER_REJECT
final public static short FILTER_REJECT(Code)
Reject the node. Same behavior as FILTER_SKIP. (In the DOM these differ when applied to a TreeWalker but have the same result when applied to a NodeIterator).



FILTER_SKIP
final public static short FILTER_SKIP(Code)
Skip this single node.





Method Detail
allowDetachToRelease
public void allowDetachToRelease(boolean allowRelease)(Code)
Specify if it's OK for detach to release the iterator for reuse.
Parameters:
  allowRelease - true if it is OK for detach to release this iterator for pooling.



clone
public Object clone() throws CloneNotSupportedException(Code)
Get a clone of this iterator, but don't reset the iteration in the process, so that it may be used from the current position. A clone of this object.
throws:
  CloneNotSupportedException -



cloneWithReset
public DTMIterator cloneWithReset() throws CloneNotSupportedException(Code)
Get a cloned Iterator that is reset to the start of the iteration. A clone of this iteration that has been reset.
throws:
  CloneNotSupportedException -



detach
public void detach()(Code)
Detaches the DTMIterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. After detach has been invoked, calls to nextNode or previousNode will raise a runtime exception.



getAxis
public int getAxis()(Code)
Returns the axis being iterated, if it is known. Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.



getCurrentNode
public int getCurrentNode()(Code)
Get the current node in the iterator. Note that this differs from the DOM's NodeIterator, where the current position lies between two nodes (as part of the maintain-relative-position semantic). The current node handle, or -1.



getCurrentPos
public int getCurrentPos()(Code)
Get the current position within the cached list, which is one less than the next nextNode() call will retrieve. i.e. if you call getCurrentPos() and the return is 0, the next fetch will take place at index 1. The position of the iteration.



getDTM
public DTM getDTM(int nodeHandle)(Code)
Get an instance of a DTM that "owns" a node handle. Since a node iterator may be passed without a DTMManager, this allows the caller to easily get the DTM using just the iterator.
Parameters:
  nodeHandle - the nodeHandle. a non-null DTM reference.



getDTMManager
public DTMManager getDTMManager()(Code)
Get an instance of the DTMManager. Since a node iterator may be passed without a DTMManager, this allows the caller to easily get the DTMManager using just the iterator. a non-null DTMManager reference.



getExpandEntityReferences
public boolean getExpandEntityReferences()(Code)

The value of this flag determines whether the children of entity reference nodes are visible to the iterator. If false, they and their descendants will be rejected. Note that this rejection takes precedence over whatToShow and the filter.

To produce a view of the document that has entity references expanded and does not expose the entity reference node itself, use the whatToShow flags to hide the entity reference node and set expandEntityReferences to true when creating the iterator. To produce a view of the document that has entity reference nodes but no entity expansion, use the whatToShow flags to show the entity reference node and set expandEntityReferences to false.

NOTE: In Xalan's use of DTM we will generally have fully expanded entity references when the document tree was built, and thus this flag will have no effect.

true if entity references will be expanded.



getLength
public int getLength()(Code)
The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. Note that this requires running the iterator to completion, and presumably filling the cache. The number of nodes in the list.



getRoot
public int getRoot()(Code)
The root node of the DTMIterator, as specified when it was created. Note the root node is not the root node of the document tree, but the context node from where the iteration begins and ends. nodeHandle int Handle of the context node.



getWhatToShow
public int getWhatToShow()(Code)
This attribute determines which node types are presented via the iterator. The available set of constants is defined above. Nodes not accepted by whatToShow will be skipped, but their children may still be considered. one of the SHOW_XXX constants, or several ORed together.



isDocOrdered
public boolean isDocOrdered()(Code)
Returns true if all the nodes in the iteration well be returned in document order. true if all the nodes in the iteration well be returned in document order.



isFresh
public boolean isFresh()(Code)
Tells if this NodeSetDTM is "fresh", in other words, if the first nextNode() that is called will return the first node in the set. true if the iteration of this list has not yet begun.



isMutable
public boolean isMutable()(Code)
Tells if this iterator can have nodes added to it or set via the setItem(int node, int index) method. True if the nodelist can be mutated.



item
public int item(int index)(Code)
Returns the node handle of an item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
Parameters:
  index - of the item. The node handle at the indexth position in theDTMIterator, or -1 if that is not a validindex.



nextNode
public int nextNode()(Code)
Returns the next node in the set and advances the position of the iterator in the set. After a DTMIterator has setRoot called, the first call to nextNode() returns that root or (if it is rejected by the filters) the first node within its subtree which is not filtered out. The next node handle in the set being iterated over, orDTM.NULL if there are no more members in that set.



previousNode
public int previousNode()(Code)
Returns the previous node in the set and moves the position of the DTMIterator backwards in the set. The previous node handle in the set being iterated over,or DTM.NULL if there are no more members in that set.



reset
public void reset()(Code)
Reset the iterator to the start. After resetting, the next node returned will be the root node -- or, if that's filtered out, the first node within the root's subtree which is _not_ skipped by the filters.



runTo
public void runTo(int index)(Code)
If an index is requested, NodeSetDTM will call this method to run the iterator to the index. By default this sets m_next to the index. If the index argument is -1, this signals that the iterator should be run to the end and completely fill the cache.
Parameters:
  index - The index to run to, or -1 if the iterator should be runto the end.



setCurrentPos
public void setCurrentPos(int i)(Code)
Set the current position in the node set.
Parameters:
  i - Must be a valid index.



setItem
public void setItem(int node, int index)(Code)
Sets the node at the specified index of this vector to be the specified node. The previous component at that position is discarded.

The index must be a value greater than or equal to 0 and less than the current size of the vector. The iterator must be in cached mode.

Meant to be used for sorted iterators.


Parameters:
  node - Node to set
Parameters:
  index - Index of where to set the node



setRoot
public void setRoot(int nodeHandle, Object environment)(Code)
Reset the root node of the DTMIterator, overriding the value specified when it was created. Note the root node is not the root node of the document tree, but the context node from where the iteration begins.
Parameters:
  nodeHandle - int Handle of the context node.
Parameters:
  environment - The environment object. The environment in which this iterator operates, which should provide:
  • a node (the context node... same value as "root" defined below)
  • a pair of non-zero positive integers (the context position and the context size)
  • a set of variable bindings
  • a function library
  • the set of namespace declarations in scope for the expression.
    • At this time the exact implementation of this environment is application dependent. Probably a proper interface will be created fairly soon.




setShouldCacheNodes
public void setShouldCacheNodes(boolean b)(Code)
If setShouldCacheNodes(true) is called, then nodes will be cached, enabling random access, and giving the ability to do sorts and the like. They are not cached by default. %REVIEW% Shouldn't the other random-access methods throw an exception if they're called on a DTMIterator with this flag set false?
Parameters:
  b - true if the nodes should be cached.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.