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


001:        package net.sf.saxon.value;
002:
003:        import net.sf.saxon.om.SequenceIterator;
004:        import net.sf.saxon.om.Item;
005:        import net.sf.saxon.om.NamePool;
006:        import net.sf.saxon.expr.XPathContext;
007:        import net.sf.saxon.expr.RangeExpression;
008:        import net.sf.saxon.expr.StaticProperty;
009:        import net.sf.saxon.expr.ExpressionTool;
010:        import net.sf.saxon.trans.XPathException;
011:        import net.sf.saxon.type.ItemType;
012:        import net.sf.saxon.type.Type;
013:        import net.sf.saxon.type.TypeHierarchy;
014:
015:        import java.io.PrintStream;
016:
017:        /**
018:         * This class represents a sequence of consecutive ascending integers, for example 1 to 50.
019:         * The integers must be within the range of a Java long.
020:         */
021:
022:        public class IntegerRange extends Value {
023:
024:            public long start;
025:            public long end;
026:
027:            public IntegerRange(long start, long end) {
028:                this .start = start;
029:                this .end = end;
030:            }
031:
032:            public long getStart() {
033:                return start;
034:            }
035:
036:            public long getEnd() {
037:                return end;
038:            }
039:
040:            /**
041:             * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
042:             * This method indicates which of these methods is provided directly. The other methods will always be available
043:             * indirectly, using an implementation that relies on one of the other methods.
044:             */
045:
046:            public int getImplementationMethod() {
047:                return ITERATE_METHOD;
048:            }
049:
050:            /**
051:             * Return an Iterator to iterate over the values of a sequence. The value of every
052:             * expression can be regarded as a sequence, so this method is supported for all
053:             * expressions. This default implementation handles iteration for expressions that
054:             * return singleton values: for non-singleton expressions, the subclass must
055:             * provide its own implementation.
056:             *
057:             * @param context supplies the context for evaluation
058:             * @return a SequenceIterator that can be used to iterate over the result
059:             *         of the expression
060:             * @throws net.sf.saxon.trans.XPathException
061:             *          if any dynamic error occurs evaluating the
062:             *          expression
063:             */
064:
065:            public SequenceIterator iterate(XPathContext context)
066:                    throws XPathException {
067:                return new RangeExpression.RangeIterator(start, end);
068:            }
069:
070:            /**
071:             * Determine the data type of the items in the expression, if possible
072:             *
073:             * @return AnyItemType (not known)
074:             * @param th
075:             */
076:
077:            public ItemType getItemType(TypeHierarchy th) {
078:                return Type.INTEGER_TYPE;
079:            }
080:
081:            /**
082:             * Determine the cardinality
083:             */
084:
085:            public int getCardinality() {
086:                return StaticProperty.ALLOWS_MANY;
087:            }
088:
089:            /**
090:             * Get the n'th item in the sequence (starting from 0). This is defined for all
091:             * Values, but its real benefits come for a sequence Value stored extensionally
092:             * (or for a MemoClosure, once all the values have been read)
093:             */
094:
095:            public Item itemAt(int n) throws XPathException {
096:                if (n < 0 || n > (end - start)) {
097:                    return null;
098:                }
099:                return new IntegerValue(start + n);
100:            }
101:
102:            /**
103:             * Get the length of the sequence
104:             */
105:
106:            public int getLength() throws XPathException {
107:                return (int) (end - start + 1);
108:            }
109:
110:            /**
111:             * Diagnostic display of the expression
112:             */
113:
114:            public void display(int level, NamePool pool, PrintStream out) {
115:                System.err.println(ExpressionTool.indent(level) + start
116:                        + " to " + end);
117:            }
118:        }
119:
120:        //
121:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
122:        // you may not use this file except in compliance with the License. You may obtain a copy of the
123:        // License at http://www.mozilla.org/MPL/
124:        //
125:        // Software distributed under the License is distributed on an "AS IS" basis,
126:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
127:        // See the License for the specific language governing rights and limitations under the License.
128:        //
129:        // The Original Code is: all this file.
130:        //
131:        // The Initial Developer of the Original Code is Michael H. Kay.
132:        //
133:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
134:        //
135:        // Contributor(s): none.
136:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.