Source Code Cross Referenced for TreeEnumeration.java in  » XML » saxonb » net » sf » saxon » tree » 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 » saxonb » net.sf.saxon.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sf.saxon.tree;
002:
003:        import net.sf.saxon.om.AxisIterator;
004:        import net.sf.saxon.om.Item;
005:        import net.sf.saxon.om.LookaheadIterator;
006:        import net.sf.saxon.pattern.NodeTest;
007:
008:        abstract class TreeEnumeration implements  AxisIterator,
009:                LookaheadIterator {
010:
011:            protected NodeImpl start;
012:            protected NodeImpl next;
013:            protected NodeTest nodeTest;
014:            protected NodeImpl current = null;
015:            protected int position = 0;
016:
017:            //protected int last = -1;
018:
019:            /**
020:             * Create an axis enumeration for a given type and name of node, from a given
021:             * origin node
022:             * @param origin the node from which the axis originates
023:             * @param nodeTest test to be satisfied by the returned nodes, or null if all nodes
024:             * are to be returned.
025:             */
026:
027:            public TreeEnumeration(NodeImpl origin, NodeTest nodeTest) {
028:                next = origin;
029:                start = origin;
030:                this .nodeTest = nodeTest;
031:            }
032:
033:            /**
034:             * Test whether a node conforms to the node type and name constraints.
035:             * Note that this returns true if the supplied node is null, this is a way of
036:             * terminating a loop.
037:             */
038:
039:            protected boolean conforms(NodeImpl node) {
040:                if (node == null || nodeTest == null) {
041:                    return true;
042:                }
043:                return nodeTest.matches(node);
044:            }
045:
046:            /**
047:             * Advance along the axis until a node is found that matches the required criteria
048:             */
049:
050:            protected final void advance() {
051:                do {
052:                    step();
053:                } while (!conforms(next));
054:            }
055:
056:            /**
057:             * Advance one step along the axis: the resulting node might not meet the required
058:             * criteria for inclusion
059:             */
060:
061:            protected abstract void step();
062:
063:            /**
064:             * Determine whether there are more items to come. Note that this operation
065:             * is stateless and it is not necessary (or usual) to call it before calling
066:             * next(). It is used only when there is an explicit need to tell if we
067:             * are at the last element.
068:             *
069:             * @return true if there are more items in the sequence
070:             */
071:
072:            public boolean hasNext() {
073:                return next != null;
074:            }
075:
076:            /**
077:             * Return the next node in the enumeration
078:             */
079:
080:            public final Item next() {
081:                if (next == null) {
082:                    current = null;
083:                    position = -1;
084:                    return null;
085:                } else {
086:                    current = next;
087:                    position++;
088:                    advance();
089:                    return current;
090:                }
091:            }
092:
093:            /**
094:             * Return the current Item
095:             */
096:
097:            public final Item current() {
098:                return current;
099:            }
100:
101:            /**
102:             * Return the current position
103:             */
104:
105:            public final int position() {
106:                return position;
107:            }
108:
109:            /**
110:             * Get properties of this iterator, as a bit-significant integer.
111:             *
112:             * @return the properties of this iterator. This will be some combination of
113:             *         properties such as {@link GROUNDED}, {@link LAST_POSITION_FINDER},
114:             *         and {@link LOOKAHEAD}. It is always
115:             *         acceptable to return the value zero, indicating that there are no known special properties.
116:             *         It is acceptable for the properties of the iterator to change depending on its state.
117:             */
118:
119:            public int getProperties() {
120:                return LOOKAHEAD;
121:            }
122:
123:            /**
124:             * Indicate that any nodes returned in the sequence will be atomized. This
125:             * means that if it wishes to do so, the implementation can return the typed
126:             * values of the nodes rather than the nodes themselves. The implementation
127:             * is free to ignore this hint.
128:             * @param atomizing true if the caller of this iterator will atomize any
129:             * nodes that are returned, and is therefore willing to accept the typed
130:             * value of the nodes instead of the nodes themselves.
131:             */
132:
133:            //public void setIsAtomizing(boolean atomizing) {}
134:        }
135:
136:        //
137:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
138:        // you may not use this file except in compliance with the License. You may obtain a copy of the
139:        // License at http://www.mozilla.org/MPL/
140:        //
141:        // Software distributed under the License is distributed on an "AS IS" basis,
142:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
143:        // See the License for the specific language governing rights and limitations under the License.
144:        //
145:        // The Original Code is: all this file.
146:        //
147:        // The Initial Developer of the Original Code is Michael H. Kay.
148:        //
149:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
150:        //
151:        // Contributor(s): none.
152:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.