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