Source Code Cross Referenced for SortScan.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » access » sort » 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 » Database DBMS » db derby 10.2 » org.apache.derby.impl.store.access.sort 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.store.access.sort.SortScan
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.impl.store.access.sort;
023:
024:        import org.apache.derby.iapi.reference.SQLState;
025:
026:        import org.apache.derby.iapi.services.io.FormatableBitSet;
027:
028:        import org.apache.derby.iapi.services.sanity.SanityManager;
029:        import org.apache.derby.iapi.services.io.Storable;
030:
031:        import org.apache.derby.iapi.error.StandardException;
032:
033:        import org.apache.derby.iapi.store.access.conglomerate.TransactionManager;
034:        import org.apache.derby.iapi.store.access.RowUtil;
035:        import org.apache.derby.iapi.store.access.ScanController;
036:
037:        import org.apache.derby.iapi.types.DataValueDescriptor;
038:
039:        /**
040:
041:         Abstract base class for merge sort scans.
042:
043:         **/
044:
045:        public abstract class SortScan extends Scan {
046:
047:            /**
048:            The sort that this class is scanning.
049:             **/
050:            protected MergeSort sort = null;
051:
052:            /**
053:            The transactionManager that opened this scan.
054:             **/
055:            protected TransactionManager tran = null;
056:
057:            /**
058:            The row at the current position of the scan, from which
059:            fetch will return values.
060:             **/
061:            protected DataValueDescriptor[] current;
062:
063:            /**
064:            The row at the current position of the scan, from which
065:            fetch will return values.
066:             **/
067:            protected boolean hold;
068:
069:            /*
070:             * Constructors
071:             */
072:            SortScan(MergeSort sort, TransactionManager tran, boolean hold) {
073:                super ();
074:                this .sort = sort;
075:                this .tran = tran;
076:                this .hold = hold;
077:            }
078:
079:            /*
080:             * Abstract methods of Scan
081:             */
082:
083:            /**
084:            Fetch the row at the next position of the Scan.
085:
086:            If there is a valid next position in the scan then
087:            the value in the template storable row is replaced
088:            with the value of the row at the current scan
089:            position.  The columns of the template row must
090:            be of the same type as the actual columns in the
091:            underlying conglomerate.
092:
093:            The resulting contents of templateRow after a fetchNext() 
094:            which returns false is undefined.
095:
096:            The result of calling fetchNext(row) is exactly logically
097:            equivalent to making a next() call followed by a fetch(row)
098:            call.  This interface allows implementations to optimize 
099:            the 2 calls if possible.
100:
101:            RESOLVE (mikem - 2/24/98) - come back to this and see if 
102:            coding this differently saves in sort scans, as did the
103:            heap recoding.
104:
105:            @param row The template row into which the value
106:            of the next position in the scan is to be stored.
107:
108:            @return True if there is a next position in the scan,
109:            false if there isn't.
110:
111:            @exception StandardException Standard exception policy.
112:             **/
113:            public final boolean fetchNext(DataValueDescriptor[] row)
114:                    throws StandardException {
115:                boolean ret_val = next();
116:
117:                if (ret_val)
118:                    fetch(row);
119:
120:                return (ret_val);
121:            }
122:
123:            /**
124:            Fetch the row at the current position of the Scan.
125:            @see ScanController#fetch
126:             **/
127:            public final void fetch(DataValueDescriptor[] result)
128:                    throws StandardException {
129:                if (SanityManager.DEBUG) {
130:                    SanityManager.ASSERT(sort != null);
131:                }
132:
133:                if (current == null) {
134:                    throw StandardException
135:                            .newException(SQLState.SORT_SCAN_NOT_POSITIONED);
136:                }
137:
138:                // Make sure the passed in template row is of the correct type.
139:                sort.checkColumnTypes(result);
140:
141:                // RESOLVE
142:                // Note that fetch() basically throws away the object's passed in.
143:                // We should figure out how to allow callers in this situation to
144:                // not go through the work of allocating objects in the first place.
145:
146:                // Sort has allocated objects for this row, and will not 
147:                // reference them any more.  So just pass the objects out
148:                // to the caller instead of copying them into the provided
149:                // objects.
150:                System.arraycopy(current, 0, result, 0, result.length);
151:            }
152:
153:            /**
154:            Fetch the row at the current position of the Scan and does not apply the
155:            qualifiers.
156:            
157:            This method will always throw an exception.
158:            (SQLState.SORT_IMPROPER_SCAN_METHOD)
159:            
160:            @see ScanController#fetchWithoutQualify
161:             **/
162:            public final void fetchWithoutQualify(DataValueDescriptor[] result)
163:                    throws StandardException {
164:                throw StandardException
165:                        .newException(SQLState.SORT_IMPROPER_SCAN_METHOD);
166:
167:            }
168:
169:            /**
170:            Close the scan.	@see ScanController#close
171:             **/
172:            public void close() {
173:                sort = null;
174:                current = null;
175:
176:                tran.closeMe(this );
177:            }
178:
179:            /*
180:             * Methods of SortScan.  Arranged alphabetically.
181:             */
182:        }
w__w___w_.__j__av_a_2s._co__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.