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

StoredSortedKeySet.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: StoredSortedKeySet.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.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 }

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