00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package com.sleepycat.collections;
00011
00012 import java.util.Comparator;
00013 import java.util.Map;
00014 import java.util.SortedSet;
00015
00047 public class StoredSortedEntrySet extends StoredEntrySet implements SortedSet {
00048
00049 StoredSortedEntrySet(DataView mapView) {
00050
00051 super(mapView);
00052 }
00053
00063 public Comparator comparator() {
00064
00065 return null;
00066 }
00067
00077 public Object first() {
00078
00079 return getFirstOrLast(true);
00080 }
00081
00091 public Object last() {
00092
00093 return getFirstOrLast(false);
00094 }
00095
00111 public SortedSet headSet(Object toMapEntry) {
00112
00113 return subSet(null, false, toMapEntry, false);
00114 }
00115
00133 public SortedSet headSet(Object toMapEntry, boolean toInclusive) {
00134
00135 return subSet(null, false, toMapEntry, toInclusive);
00136 }
00137
00153 public SortedSet tailSet(Object fromMapEntry) {
00154
00155 return subSet(fromMapEntry, true, null, false);
00156 }
00157
00175 public SortedSet tailSet(Object fromMapEntry, boolean fromInclusive) {
00176
00177 return subSet(fromMapEntry, fromInclusive, null, false);
00178 }
00179
00197 public SortedSet subSet(Object fromMapEntry, Object toMapEntry) {
00198
00199 return subSet(fromMapEntry, true, toMapEntry, false);
00200 }
00201
00224 public SortedSet subSet(Object fromMapEntry, boolean fromInclusive,
00225 Object toMapEntry, boolean toInclusive) {
00226
00227 Object fromKey = (fromMapEntry != null) ?
00228 ((Map.Entry) fromMapEntry).getKey() : null;
00229 Object toKey = (toMapEntry != null) ?
00230 ((Map.Entry) toMapEntry).getKey() : null;
00231 try {
00232 return new StoredSortedEntrySet(
00233 view.subView(fromKey, fromInclusive, toKey, toInclusive, null));
00234 } catch (Exception e) {
00235 throw StoredContainer.convertException(e);
00236 }
00237 }
00238 }