Skip to content

Commit

Permalink
Merge pull request #427 from the-qa-company/GH-420-fix-quad-file-hand…
Browse files Browse the repository at this point in the history
…lers

GH-420 Fix quad implementation handler
  • Loading branch information
ate47 authored Oct 9, 2023
2 parents 31e13e0 + 415229f commit 4ede628
Show file tree
Hide file tree
Showing 36 changed files with 980 additions and 406 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,34 @@
* in memory, will throw a {@link NotImplementedException} if we try to add a
* non 0 value
*/
public class EmptyBitmap implements ModifiableBitmap {
public class EmptyBitmap implements ModifiableBitmap, ModifiableMultiLayerBitmap {
/**
* create empty bitmap simulating a bitmap of a particular size
*
* @param size the size
* @return bitmap
*/
public static ModifiableBitmap of(long size) {
return new EmptyBitmap(size);
public static EmptyBitmap of(long size) {
return new EmptyBitmap(size, 0);
}

/**
* create empty bitmap simulating a bitmap of a particular size
*
* @param size the size
* @param layers layers
* @return bitmap
*/
public static EmptyBitmap of(long size, long layers) {
return new EmptyBitmap(size, layers);
}

private long size;
private final long layers;

private EmptyBitmap(long size) {
private EmptyBitmap(long size, long layers) {
this.size = size;
this.layers = layers;
}

@Override
Expand Down Expand Up @@ -84,11 +97,56 @@ public long select1(long n) {
return -1;
}

@Override
public boolean access(long layer, long position) {
return false;
}

@Override
public long rank1(long layer, long position) {
return rank1(position);
}

@Override
public long rank0(long layer, long position) {
return rank0(position);
}

@Override
public long selectPrev1(long layer, long start) {
return selectPrev1(start);
}

@Override
public long selectNext1(long layer, long start) {
return selectNext1(start);
}

@Override
public long select0(long layer, long n) {
return select0(n);
}

@Override
public long select1(long layer, long n) {
return select1(n);
}

@Override
public long getNumBits() {
return size;
}

@Override
public long countOnes(long layer) {
return countOnes();
}

@Override
public long countZeros(long layer) {
return countZeros();
}

@Override
public long countOnes() {
return 0;
Expand Down Expand Up @@ -129,6 +187,16 @@ public void load(InputStream input, ProgressListener listener) {

@Override
public String getType() {
return HDTVocabulary.BITMAP_TYPE_PLAIN;
return layers == 0 ? HDTVocabulary.BITMAP_TYPE_PLAIN : HDTVocabulary.BITMAP_TYPE_ROARING_MULTI;
}

@Override
public long getLayersCount() {
return layers;
}

@Override
public void set(long layer, long position, boolean value) {
set(position, value);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.the_qa_company.qendpoint.core.compact.bitmap;

public interface ModifiableMultiLayerBitmap extends MultiLayerBitmap {
/**
* Set the value of the bit at position pos
*
* @param layer layer
* @param position pos
* @param value value
*/
void set(long layer, long position, boolean value);
}
Loading

0 comments on commit 4ede628

Please sign in to comment.