Source Code Cross Referenced for StoredSortedEntrySet.java in  » JMX » je » com » sleepycat » collections » 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 » JMX » je » com.sleepycat.collections 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*-
002:         * See the file LICENSE for redistribution information.
003:         *
004:         * Copyright (c) 2000,2008 Oracle.  All rights reserved.
005:         *
006:         * $Id: StoredSortedEntrySet.java,v 1.24.2.2 2008/01/07 15:14:06 cwl Exp $
007:         */
008:
009:        package com.sleepycat.collections;
010:
011:        import java.util.Comparator;
012:        import java.util.Map;
013:        import java.util.SortedSet;
014:
015:        /**
016:         * The SortedSet returned by Map.entrySet().  This class may not be
017:         * instantiated directly.  Contrary to what is stated by {@link Map#entrySet}
018:         * this class does support the {@link #add} and {@link #addAll} methods.
019:         *
020:         * <p>The {@link java.util.Map.Entry#setValue} method of the Map.Entry objects
021:         * that are returned by this class and its iterators behaves just as the {@link
022:         * StoredIterator#set} method does.</p>
023:         *
024:         * <p>In addition to the standard SortedSet methods, this class provides the
025:         * following methods for stored sorted sets only.  Note that the use of these
026:         * methods is not compatible with the standard Java collections interface.</p>
027:         * <ul>
028:         * <li>{@link #headSet(Object, boolean)}</li>
029:         * <li>{@link #tailSet(Object, boolean)}</li>
030:         * <li>{@link #subSet(Object, boolean, Object, boolean)}</li>
031:         * </ul>
032:         *
033:         * @author Mark Hayes
034:         */
035:        public class StoredSortedEntrySet extends StoredEntrySet implements 
036:                SortedSet {
037:
038:            StoredSortedEntrySet(DataView mapView) {
039:
040:                super (mapView);
041:            }
042:
043:            /**
044:             * Returns null since comparators are not supported.  The natural ordering
045:             * of a stored collection is data byte order, whether the data classes
046:             * implement the {@link java.lang.Comparable} interface or not.
047:             * This method does not conform to the {@link SortedSet#comparator}
048:             * interface.
049:             *
050:             * @return null.
051:             */
052:            public Comparator comparator() {
053:
054:                return null;
055:            }
056:
057:            /**
058:             * Returns the first (lowest) element currently in this sorted set.
059:             * This method conforms to the {@link SortedSet#first} interface.
060:             *
061:             * @return the first element.
062:             *
063:             * @throws RuntimeExceptionWrapper if a {@link
064:             * com.sleepycat.je.DatabaseException} is thrown.
065:             */
066:            public Object first() {
067:
068:                return getFirstOrLast(true);
069:            }
070:
071:            /**
072:             * Returns the last (highest) element currently in this sorted set.
073:             * This method conforms to the {@link SortedSet#last} interface.
074:             *
075:             * @return the last element.
076:             *
077:             * @throws RuntimeExceptionWrapper if a {@link
078:             * com.sleepycat.je.DatabaseException} is thrown.
079:             */
080:            public Object last() {
081:
082:                return getFirstOrLast(false);
083:            }
084:
085:            /**
086:             * Returns a view of the portion of this sorted set whose elements are
087:             * strictly less than toMapEntry.
088:             * This method conforms to the {@link SortedSet#headSet} interface.
089:             *
090:             * <p>Note that the return value is a StoredCollection and must be treated
091:             * as such; for example, its iterators must be explicitly closed.</p>
092:             *
093:             * @param toMapEntry the upper bound.
094:             *
095:             * @return the subset.
096:             *
097:             * @throws RuntimeExceptionWrapper if a {@link
098:             * com.sleepycat.je.DatabaseException} is thrown.
099:             */
100:            public SortedSet headSet(Object toMapEntry) {
101:
102:                return subSet(null, false, toMapEntry, false);
103:            }
104:
105:            /**
106:             * Returns a view of the portion of this sorted set whose elements are
107:             * strictly less than toMapEntry, optionally including toMapEntry.
108:             * This method does not exist in the standard {@link SortedSet} interface.
109:             *
110:             * <p>Note that the return value is a StoredCollection and must be treated
111:             * as such; for example, its iterators must be explicitly closed.</p>
112:             *
113:             * @param toMapEntry is the upper bound.
114:             *
115:             * @param toInclusive is true to include toMapEntry.
116:             *
117:             * @return the subset.
118:             *
119:             * @throws RuntimeExceptionWrapper if a {@link
120:             * com.sleepycat.je.DatabaseException} is thrown.
121:             */
122:            public SortedSet headSet(Object toMapEntry, boolean toInclusive) {
123:
124:                return subSet(null, false, toMapEntry, toInclusive);
125:            }
126:
127:            /**
128:             * Returns a view of the portion of this sorted set whose elements are
129:             * greater than or equal to fromMapEntry.
130:             * This method conforms to the {@link SortedSet#tailSet} interface.
131:             *
132:             * <p>Note that the return value is a StoredCollection and must be treated
133:             * as such; for example, its iterators must be explicitly closed.</p>
134:             *
135:             * @param fromMapEntry is the lower bound.
136:             *
137:             * @return the subset.
138:             *
139:             * @throws RuntimeExceptionWrapper if a {@link
140:             * com.sleepycat.je.DatabaseException} is thrown.
141:             */
142:            public SortedSet tailSet(Object fromMapEntry) {
143:
144:                return subSet(fromMapEntry, true, null, false);
145:            }
146:
147:            /**
148:             * Returns a view of the portion of this sorted set whose elements are
149:             * strictly greater than fromMapEntry, optionally including fromMapEntry.
150:             * This method does not exist in the standard {@link SortedSet} interface.
151:             *
152:             * <p>Note that the return value is a StoredCollection and must be treated
153:             * as such; for example, its iterators must be explicitly closed.</p>
154:             *
155:             * @param fromMapEntry is the lower bound.
156:             *
157:             * @param fromInclusive is true to include fromMapEntry.
158:             *
159:             * @return the subset.
160:             *
161:             * @throws RuntimeExceptionWrapper if a {@link
162:             * com.sleepycat.je.DatabaseException} is thrown.
163:             */
164:            public SortedSet tailSet(Object fromMapEntry, boolean fromInclusive) {
165:
166:                return subSet(fromMapEntry, fromInclusive, null, false);
167:            }
168:
169:            /**
170:             * Returns a view of the portion of this sorted set whose elements range
171:             * from fromMapEntry, inclusive, to toMapEntry, exclusive.
172:             * This method conforms to the {@link SortedSet#subSet} interface.
173:             *
174:             * <p>Note that the return value is a StoredCollection and must be treated
175:             * as such; for example, its iterators must be explicitly closed.</p>
176:             *
177:             * @param fromMapEntry is the lower bound.
178:             *
179:             * @param toMapEntry is the upper bound.
180:             *
181:             * @return the subset.
182:             *
183:             * @throws RuntimeExceptionWrapper if a {@link
184:             * com.sleepycat.je.DatabaseException} is thrown.
185:             */
186:            public SortedSet subSet(Object fromMapEntry, Object toMapEntry) {
187:
188:                return subSet(fromMapEntry, true, toMapEntry, false);
189:            }
190:
191:            /**
192:             * Returns a view of the portion of this sorted set whose elements are
193:             * strictly greater than fromMapEntry and strictly less than toMapEntry,
194:             * optionally including fromMapEntry and toMapEntry.
195:             * This method does not exist in the standard {@link SortedSet} interface.
196:             *
197:             * <p>Note that the return value is a StoredCollection and must be treated
198:             * as such; for example, its iterators must be explicitly closed.</p>
199:             *
200:             * @param fromMapEntry is the lower bound.
201:             *
202:             * @param fromInclusive is true to include fromMapEntry.
203:             *
204:             * @param toMapEntry is the upper bound.
205:             *
206:             * @param toInclusive is true to include toMapEntry.
207:             *
208:             * @return the subset.
209:             *
210:             * @throws RuntimeExceptionWrapper if a {@link
211:             * com.sleepycat.je.DatabaseException} is thrown.
212:             */
213:            public SortedSet subSet(Object fromMapEntry, boolean fromInclusive,
214:                    Object toMapEntry, boolean toInclusive) {
215:
216:                Object fromKey = (fromMapEntry != null) ? ((Map.Entry) fromMapEntry)
217:                        .getKey()
218:                        : null;
219:                Object toKey = (toMapEntry != null) ? ((Map.Entry) toMapEntry)
220:                        .getKey() : null;
221:                try {
222:                    return new StoredSortedEntrySet(view.subView(fromKey,
223:                            fromInclusive, toKey, toInclusive, null));
224:                } catch (Exception e) {
225:                    throw StoredContainer.convertException(e);
226:                }
227:            }
228:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.