1 8 package org.ozoneDB.collections; 9 10 import java.util.Collection ; 11 import java.util.Comparator ; 12 import java.util.SortedMap ; 13 import java.util.SortedSet ; 14 15 21 public class NodeTreeSetImpl extends BaseTreeSetImpl implements NodeTreeSet { 22 23 private static final long serialVersionUID = 1L; 24 25 32 public NodeTreeSetImpl() { 33 } 34 35 42 public NodeTreeSetImpl(Comparator comparator) { 43 super(comparator); 44 } 45 46 58 public NodeTreeSetImpl(Collection collection) { 59 super(collection); 60 } 61 62 71 public NodeTreeSetImpl(SortedSet sortedSet) { 72 super(sortedSet); 73 } 74 75 81 NodeTreeSetImpl(SortedMap backingMap) { 82 map = backingMap; 83 } 84 85 90 public Object clone() { 91 92 BaseTreeSet copy = null; 93 try { 94 copy = (BaseTreeSet) database().createObject( 97 NodeTreeSetImpl.class, 98 new Class [] {NodeTreeSetImpl.class}, 99 new Object [] {self()}); 100 } 101 catch (Exception e) { 102 throw new RuntimeException (e); 103 } 104 return copy; 105 } 106 107 122 public SortedSet headSet(Object to) { 123 SortedMap headMap = map.headMap(to); 126 return (NodeTreeSet) database().createObject( 127 NodeTreeSetImpl.class, 128 new Class [] {SortedMap .class}, 129 new Object [] {headMap} 130 ); 131 } 132 133 151 public SortedSet subSet(Object from, Object to) { 152 SortedMap subMap = map.subMap(from, to); 155 return (NodeTreeSet) database().createObject( 156 NodeTreeSetImpl.class, 157 new Class [] {SortedMap .class}, 158 new Object [] {subMap} 159 ); 160 } 161 162 177 public SortedSet tailSet(Object from) { 178 SortedMap tailMap = map.tailMap(from); 181 return (NodeTreeSet) database().createObject( 182 NodeTreeSetImpl.class, 183 new Class [] {SortedMap .class}, 184 new Object [] {tailMap} 185 ); 186 } 187 188 protected SortedMap newBackingMap() { 189 return (NodeTreeMap) database().createObject(NodeTreeMapImpl.class.getName()); 192 } 193 194 protected SortedMap newBackingMap(Comparator comparator) { 195 return (NodeTreeMap) database().createObject(NodeTreeMapImpl.class.getName(), 198 Comparator .class.getName(), new Object [] {comparator}); 199 } 200 201 } | Popular Tags |