00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package com.sleepycat.collections;
00011
00012 import java.util.Comparator;
00013 import java.util.SortedSet;
00014
00015 import com.sleepycat.bind.EntryBinding;
00016 import com.sleepycat.db.Database;
00017
00048 public class StoredSortedKeySet extends StoredKeySet implements SortedSet {
00049
00067 public StoredSortedKeySet(Database database, EntryBinding keyBinding,
00068 boolean writeAllowed) {
00069
00070 super(new DataView(database, keyBinding, null, null,
00071 writeAllowed, null));
00072 }
00073
00074 StoredSortedKeySet(DataView keySetView) {
00075
00076 super(keySetView);
00077 }
00078
00088 public Comparator comparator() {
00089
00090 return null;
00091 }
00092
00102 public Object first() {
00103
00104 return getFirstOrLast(true);
00105 }
00106
00116 public Object last() {
00117
00118 return getFirstOrLast(false);
00119 }
00120
00136 public SortedSet headSet(Object toKey) {
00137
00138 return subSet(null, false, toKey, false);
00139 }
00140
00158 public SortedSet headSet(Object toKey, boolean toInclusive) {
00159
00160 return subSet(null, false, toKey, toInclusive);
00161 }
00162
00178 public SortedSet tailSet(Object fromKey) {
00179
00180 return subSet(fromKey, true, null, false);
00181 }
00182
00200 public SortedSet tailSet(Object fromKey, boolean fromInclusive) {
00201
00202 return subSet(fromKey, fromInclusive, null, false);
00203 }
00204
00222 public SortedSet subSet(Object fromKey, Object toKey) {
00223
00224 return subSet(fromKey, true, toKey, false);
00225 }
00226
00249 public SortedSet subSet(Object fromKey, boolean fromInclusive,
00250 Object toKey, boolean toInclusive) {
00251
00252 try {
00253 return new StoredSortedKeySet(
00254 view.subView(fromKey, fromInclusive, toKey, toInclusive, null));
00255 } catch (Exception e) {
00256 throw StoredContainer.convertException(e);
00257 }
00258 }
00259 }