Blockfile: Add generics, part 3

This commit is contained in:
zzz
2016-04-20 12:59:24 +00:00
parent 0d19fe44c2
commit 0067c8d1bd
7 changed files with 10 additions and 0 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);