Skip to content

Commit ddedb95

Browse files
committed
wip
1 parent ae92b74 commit ddedb95

File tree

5 files changed

+26
-19
lines changed

5 files changed

+26
-19
lines changed

src/main/java/com/ebremer/beakgraph/HDTish/BitPackedReader.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ public BitPackedReader(ByteBuffer buffer, int b) {
1212
}
1313

1414
public int readNthValue(int n) {
15+
if (n==27) {
16+
int gg = 0;
17+
}
1518
int bitPos = n * b;
1619
int byteIdx = bitPos / 8;
1720
if (byteIdx >= buffer.capacity()) {

src/main/java/com/ebremer/beakgraph/HDTish/BitPackedWriter.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ public byte[] getBuffer() {
4545
return os.toByteArray();
4646
}
4747

48-
// Write the least significant n bits of the integer to the buffer
4948
public void writeInteger(int value) throws IOException {
50-
//if (width < 0 || width > 32) {
51-
// throw new IllegalArgumentException("n must be between 0 and 32 ---> "+value);
52-
// }
5349
entries++;
5450
// Extract the least significant n bits
5551
long bits = value & ((1L << width) - 1);
@@ -68,9 +64,6 @@ public void writeInteger(int value) throws IOException {
6864
}
6965

7066
public void writeLong(long value) throws IOException {
71-
//if (width < 0 || width > 64) {
72-
// throw new IllegalArgumentException("width must be between 0 and 64");
73-
// }
7467
entries++;
7568
long bits = value & ((1L << width) - 1);
7669
bitBuffer = (bitBuffer << width) | bits;
@@ -99,7 +92,6 @@ public static BitPackedWriter forBuffer(Path path, long width) throws IOExceptio
9992
if (width < 0 || width > 64) {
10093
throw new IllegalArgumentException("n must be between 0 and 64 ---> "+width);
10194
}
102-
System.out.println(path+" ---> "+width);
10395
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
10496
ByteWriter fileWriter = new ByteWriter() {
10597
@Override

src/main/java/com/ebremer/beakgraph/HDTish/FiveSectionDictionaryWriter.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,16 @@ public FiveSectionDictionaryWriter build() throws IOException {
298298
c.co = o;
299299
if (o.isLiteral()) {
300300
String dt = o.getLiteralDatatypeURI();
301-
Number n = (Number) o.getLiteralValue();
302301
if (dt.equals(XSD.xlong.getURI())) {
303-
IO.println("ENTERING LONG =======================> "+n);
304-
this.maxLong = Math.max(this.maxLong, n.longValue());
305-
this.minLong = Math.min(this.minLong, n.longValue());
302+
Number n = (Number) o.getLiteralValue();
303+
// IO.println("ENTERING LONG =======================> "+n);
304+
this.maxLong = Math.max(this.maxLong, n.longValue());
305+
this.minLong = Math.min(this.minLong, n.longValue());
306306
} else if (dt.equals(XSD.xint.getURI())) {
307-
IO.println(o+" === ENTERING INTEGER ==== "+o.getLiteralDatatypeURI()+" ===================> "+n);
308-
this.maxInteger = Math.max(this.maxInteger, n.intValue());
309-
this.minInteger = Math.min(this.minInteger, n.intValue());
307+
Number n = (Number) o.getLiteralValue();
308+
// IO.println(o+" === ENTERING INTEGER ==== "+o.getLiteralDatatypeURI()+" ===================> "+n);
309+
this.maxInteger = Math.max(this.maxInteger, n.intValue());
310+
this.minInteger = Math.min(this.minInteger, n.intValue());
310311
}
311312
}
312313
if (subjects.contains(o)) {

src/main/java/com/ebremer/beakgraph/HDTish/HDF5Reader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public static void main(String[] args) {
1616
try (HdfFile hdfFile = new HdfFile(src.toPath())) {
1717
ContiguousDataset dataset = (ContiguousDataset) hdfFile.getDatasetByPath("/HDT/objects/integers");
1818
long width = (Long) dataset.getAttribute("width").getData();
19+
System.out.println("CAPACITY :"+dataset.getBuffer().capacity());
1920
System.out.println("BIT WIDTH = "+width);
2021
BitPackedReader bpr = new BitPackedReader(dataset.getBuffer(), (int) width);
21-
22-
IntStream.range(0, 27).forEach(i->{
22+
IntStream.range(0, 28).forEach(i->{
2323
System.out.println(i+" ==> "+bpr.readNthValue(i));
2424
});
2525

src/main/java/com/ebremer/beakgraph/HDTish/HDF5Writer.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import static com.ebremer.beakgraph.HDTish.UTIL.putAttributes;
55
import io.jhdf.HdfFile;
66
import io.jhdf.WritableHdfFile;
7-
import io.jhdf.api.WritableDataset;
87
import io.jhdf.api.WritableGroup;
98
import java.io.File;
109
import java.io.FileInputStream;
@@ -163,7 +162,19 @@ private HDF5Writer(Builder builder) throws IOException {
163162
}
164163
}
165164
});
166-
}
165+
}
166+
Bs.close();
167+
Bp.close();
168+
Bo.close();
169+
Ss.close();
170+
Sp.close();
171+
So.close();
172+
SBs.close();
173+
SBp.close();
174+
SBo.close();
175+
BBs.close();
176+
BBp.close();
177+
BBo.close();
167178
try (WritableHdfFile hdfFile = HdfFile.write(builder.getDestination().toPath())) {
168179
WritableGroup ultra = hdfFile.putGroup(builder.getName());
169180
WritableGroup group = null;

0 commit comments

Comments
 (0)