Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

StoredSortedEntrySet.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2000-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: StoredSortedEntrySet.java,v 12.2 2005/10/05 20:40:10 mark Exp $
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 }

Generated on Sun Dec 25 12:14:31 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2