1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.regionserver;
21
22 import org.apache.hadoop.hbase.KeyValue;
23
24 import java.util.Collection;
25 import java.util.Comparator;
26 import java.util.Iterator;
27 import java.util.NavigableSet;
28 import java.util.SortedSet;
29 import java.util.concurrent.ConcurrentNavigableMap;
30 import java.util.concurrent.ConcurrentSkipListMap;
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 public class KeyValueSkipListSet implements NavigableSet<KeyValue> {
47 private final ConcurrentNavigableMap<KeyValue, KeyValue> delegatee;
48
49 KeyValueSkipListSet(final KeyValue.KVComparator c) {
50 this.delegatee = new ConcurrentSkipListMap<KeyValue, KeyValue>(c);
51 }
52
53 KeyValueSkipListSet(final ConcurrentNavigableMap<KeyValue, KeyValue> m) {
54 this.delegatee = m;
55 }
56
57 public KeyValue ceiling(KeyValue e) {
58 throw new UnsupportedOperationException("Not implemented");
59 }
60
61 public Iterator<KeyValue> descendingIterator() {
62 return this.delegatee.descendingMap().values().iterator();
63 }
64
65 public NavigableSet<KeyValue> descendingSet() {
66 throw new UnsupportedOperationException("Not implemented");
67 }
68
69 public KeyValue floor(KeyValue e) {
70 throw new UnsupportedOperationException("Not implemented");
71 }
72
73 public SortedSet<KeyValue> headSet(final KeyValue toElement) {
74 return headSet(toElement, false);
75 }
76
77 public NavigableSet<KeyValue> headSet(final KeyValue toElement,
78 boolean inclusive) {
79 return new KeyValueSkipListSet(this.delegatee.headMap(toElement, inclusive));
80 }
81
82 public KeyValue higher(KeyValue e) {
83 throw new UnsupportedOperationException("Not implemented");
84 }
85
86 public Iterator<KeyValue> iterator() {
87 return this.delegatee.values().iterator();
88 }
89
90 public KeyValue lower(KeyValue e) {
91 throw new UnsupportedOperationException("Not implemented");
92 }
93
94 public KeyValue pollFirst() {
95 throw new UnsupportedOperationException("Not implemented");
96 }
97
98 public KeyValue pollLast() {
99 throw new UnsupportedOperationException("Not implemented");
100 }
101
102 public SortedSet<KeyValue> subSet(KeyValue fromElement, KeyValue toElement) {
103 throw new UnsupportedOperationException("Not implemented");
104 }
105
106 public NavigableSet<KeyValue> subSet(KeyValue fromElement,
107 boolean fromInclusive, KeyValue toElement, boolean toInclusive) {
108 throw new UnsupportedOperationException("Not implemented");
109 }
110
111 public SortedSet<KeyValue> tailSet(KeyValue fromElement) {
112 return tailSet(fromElement, true);
113 }
114
115 public NavigableSet<KeyValue> tailSet(KeyValue fromElement, boolean inclusive) {
116 return new KeyValueSkipListSet(this.delegatee.tailMap(fromElement, inclusive));
117 }
118
119 public Comparator<? super KeyValue> comparator() {
120 throw new UnsupportedOperationException("Not implemented");
121 }
122
123 public KeyValue first() {
124 return this.delegatee.get(this.delegatee.firstKey());
125 }
126
127 public KeyValue last() {
128 return this.delegatee.get(this.delegatee.lastKey());
129 }
130
131 public boolean add(KeyValue e) {
132 return this.delegatee.put(e, e) == null;
133 }
134
135 public boolean addAll(Collection<? extends KeyValue> c) {
136 throw new UnsupportedOperationException("Not implemented");
137 }
138
139 public void clear() {
140 this.delegatee.clear();
141 }
142
143 public boolean contains(Object o) {
144
145 return this.delegatee.containsKey(o);
146 }
147
148 public boolean containsAll(Collection<?> c) {
149 throw new UnsupportedOperationException("Not implemented");
150 }
151
152 public boolean isEmpty() {
153 return this.delegatee.isEmpty();
154 }
155
156 public boolean remove(Object o) {
157 return this.delegatee.remove(o) != null;
158 }
159
160 public boolean removeAll(Collection<?> c) {
161 throw new UnsupportedOperationException("Not implemented");
162 }
163
164 public boolean retainAll(Collection<?> c) {
165 throw new UnsupportedOperationException("Not implemented");
166 }
167
168 public KeyValue get(KeyValue kv) {
169 return this.delegatee.get(kv);
170 }
171
172 public int size() {
173 return this.delegatee.size();
174 }
175
176 public Object[] toArray() {
177 throw new UnsupportedOperationException("Not implemented");
178 }
179
180 public <T> T[] toArray(T[] a) {
181 throw new UnsupportedOperationException("Not implemented");
182 }
183 }