1 8 9 package com.sleepycat.collections; 10 11 import java.util.Comparator ; 12 import java.util.SortedSet ; 13 14 import com.sleepycat.bind.EntryBinding; 15 import com.sleepycat.je.Database; 16 17 36 public class StoredSortedKeySet extends StoredKeySet implements SortedSet { 37 38 55 public StoredSortedKeySet(Database database, EntryBinding keyBinding, 56 boolean writeAllowed) { 57 58 super(new DataView(database, keyBinding, null, null, 59 writeAllowed, null)); 60 } 61 62 StoredSortedKeySet(DataView keySetView) { 63 64 super(keySetView); 65 } 66 67 76 public Comparator comparator() { 77 78 return null; 79 } 80 81 90 public Object first() { 91 92 return getFirstOrLast(true); 93 } 94 95 104 public Object last() { 105 106 return getFirstOrLast(false); 107 } 108 109 124 public SortedSet headSet(Object toKey) { 125 126 return subSet(null, false, toKey, false); 127 } 128 129 146 public SortedSet headSet(Object toKey, boolean toInclusive) { 147 148 return subSet(null, false, toKey, toInclusive); 149 } 150 151 166 public SortedSet tailSet(Object fromKey) { 167 168 return subSet(fromKey, true, null, false); 169 } 170 171 188 public SortedSet tailSet(Object fromKey, boolean fromInclusive) { 189 190 return subSet(fromKey, fromInclusive, null, false); 191 } 192 193 210 public SortedSet subSet(Object fromKey, Object toKey) { 211 212 return subSet(fromKey, true, toKey, false); 213 } 214 215 237 public SortedSet subSet(Object fromKey, boolean fromInclusive, 238 Object toKey, boolean toInclusive) { 239 240 try { 241 return new StoredSortedKeySet( 242 view.subView(fromKey, fromInclusive, toKey, toInclusive, null)); 243 } catch (Exception e) { 244 throw StoredContainer.convertException(e); 245 } 246 } 247 } 248 | Popular Tags |