1 8 9 package com.sleepycat.collections; 10 11 import java.util.Comparator ; 12 import java.util.Map ; 13 import java.util.SortedSet ; 14 15 35 public class StoredSortedEntrySet extends StoredEntrySet implements SortedSet { 36 37 StoredSortedEntrySet(DataView mapView) { 38 39 super(mapView); 40 } 41 42 51 public Comparator comparator() { 52 53 return null; 54 } 55 56 65 public Object first() { 66 67 return getFirstOrLast(true); 68 } 69 70 79 public Object last() { 80 81 return getFirstOrLast(false); 82 } 83 84 99 public SortedSet headSet(Object toMapEntry) { 100 101 return subSet(null, false, toMapEntry, false); 102 } 103 104 121 public SortedSet headSet(Object toMapEntry, boolean toInclusive) { 122 123 return subSet(null, false, toMapEntry, toInclusive); 124 } 125 126 141 public SortedSet tailSet(Object fromMapEntry) { 142 143 return subSet(fromMapEntry, true, null, false); 144 } 145 146 163 public SortedSet tailSet(Object fromMapEntry, boolean fromInclusive) { 164 165 return subSet(fromMapEntry, fromInclusive, null, false); 166 } 167 168 185 public SortedSet subSet(Object fromMapEntry, Object toMapEntry) { 186 187 return subSet(fromMapEntry, true, toMapEntry, false); 188 } 189 190 212 public SortedSet subSet(Object fromMapEntry, boolean fromInclusive, 213 Object toMapEntry, boolean toInclusive) { 214 215 Object fromKey = (fromMapEntry != null) ? 216 ((Map.Entry ) fromMapEntry).getKey() : null; 217 Object toKey = (toMapEntry != null) ? 218 ((Map.Entry ) toMapEntry).getKey() : null; 219 try { 220 return new StoredSortedEntrySet( 221 view.subView(fromKey, fromInclusive, toKey, toInclusive, null)); 222 } catch (Exception e) { 223 throw StoredContainer.convertException(e); 224 } 225 } 226 } 227 | Popular Tags |