forked from I2P_Developers/i2p.i2p
Blockfile: Add generics, part 3
This commit is contained in:
@ -442,6 +442,7 @@ public class BlockFile implements Closeable {
|
||||
*
|
||||
* @return null if not found
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K extends Comparable<? super K>, V> BSkipList<K, V> getIndex(String name, Serializer<K> key, Serializer<V> val) throws IOException {
|
||||
// added I2P
|
||||
BSkipList<K, V> bsl = (BSkipList<K, V>) openIndices.get(name);
|
||||
|
@ -73,6 +73,7 @@ public class BSkipLevels<K extends Comparable<? super K>, V> extends SkipLevels<
|
||||
* after the constructor, unless it's a new empty
|
||||
* level and init() was previously called.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public BSkipLevels(BlockFile bf, int levelPage, BSkipList<K, V> bsl) throws IOException {
|
||||
this.levelPage = levelPage;
|
||||
this.bf = bf;
|
||||
@ -378,6 +379,7 @@ public class BSkipLevels<K extends Comparable<? super K>, V> extends SkipLevels<
|
||||
* This needs work.
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean blvlck(boolean fix, int width, SkipLevels<K, V>[] prevLevels) {
|
||||
bf.log.warn(" Skip level at width " + width);
|
||||
bf.log.warn(" levels " + this.levels.length);
|
||||
|
@ -287,6 +287,7 @@ public class BSkipSpan<K extends Comparable<? super K>, V> extends SkipSpan<K, V
|
||||
* Load the whole span's keys and values into memory
|
||||
* @param flushOnError set to false if you are going to flush anyway
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void loadData(boolean flushOnError) throws IOException {
|
||||
if (isKilled)
|
||||
throw new IOException("Already killed!! " + this);
|
||||
|
@ -59,6 +59,7 @@ public class IBSkipSpan<K extends Comparable<? super K>, V> extends BSkipSpan<K,
|
||||
private K firstKey;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public SkipSpan<K, V> newInstance(SkipList<K, V> sl) {
|
||||
if (bf.log.shouldLog(Log.DEBUG))
|
||||
bf.log.debug("Splitting page " + this.page + " containing " + this.nKeys + '/' + this.spanSize);
|
||||
|
@ -62,6 +62,7 @@ public class SkipLevels<K extends Comparable<? super K>, V> implements Flushable
|
||||
/*
|
||||
* @throws IllegalArgumentException if size too big or too small
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public SkipLevels(int size, SkipSpan<K, V> span) {
|
||||
if(size < 1 || size > MAX_SIZE)
|
||||
throw new IllegalArgumentException("Invalid Level Skip size");
|
||||
@ -129,6 +130,7 @@ public class SkipLevels<K extends Comparable<? super K>, V> implements Flushable
|
||||
* and the deleted SkipLevels is taller than this SkipLevels.
|
||||
* rv is null if no object was removed.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object[] remove(int start, K key, SkipList<K, V> sl) {
|
||||
Object[] res = null;
|
||||
SkipLevels<K, V> slvls = null;
|
||||
|
@ -95,6 +95,7 @@ public class SkipList<K extends Comparable<? super K>, V> implements Flushable {
|
||||
return max;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void put(K key, V val) {
|
||||
if(key == null) { throw new NullPointerException(); }
|
||||
if(val == null) { throw new NullPointerException(); }
|
||||
@ -116,6 +117,7 @@ public class SkipList<K extends Comparable<? super K>, V> implements Flushable {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object remove(K key) {
|
||||
if(key == null) { throw new NullPointerException(); }
|
||||
Object[] res = stack.remove(stack.levels.length - 1, key, this);
|
||||
|
@ -50,6 +50,7 @@ public class SkipSpan<K extends Comparable<? super K>, V> implements Flushable {
|
||||
/*
|
||||
* @throws IllegalArgumentException if size too big or too small
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public SkipSpan(int size) {
|
||||
if(size < 1 || size > MAX_SIZE)
|
||||
throw new IllegalArgumentException("Invalid span size " + size);
|
||||
|
Reference in New Issue
Block a user