add makeUUID to PositionWritable; use for test cases
diff --git a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/PositionListWritable.java b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/PositionListWritable.java
index 7a5692c..f135292 100644
--- a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/PositionListWritable.java
+++ b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/PositionListWritable.java
@@ -18,7 +18,6 @@
protected int offset;
protected int valueCount;
protected static final byte[] EMPTY = {};
- public static final int LONGBYTES = 8;
protected PositionWritable posIter = new PositionWritable();
@@ -53,8 +52,7 @@
}
public void append(byte mateId, long readId, int posId){
- long uuid = (readId << 17) + ((posId & 0xFFFF) << 1) + (mateId & 0b1);
- append(uuid);
+ append(PositionWritable.makeUUID(mateId, readId, posId));
}
public void append(PositionWritable pos) {
diff --git a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/PositionWritable.java b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/PositionWritable.java
index 593ed65..06d7d9c 100644
--- a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/PositionWritable.java
+++ b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/PositionWritable.java
@@ -40,9 +40,12 @@
Marshal.putLong(uuid, storage, offset);
}
+ public static long makeUUID(byte mateId, long readId, int posId) {
+ return (readId << 17) + ((posId & 0xFFFF) << 1) + (mateId & 0b1);
+ }
+
public void set(byte mateId, long readId, int posId){
- long uuid = (readId << readIdShift) + ((posId & 0xFFFF) << positionIdShift) + (mateId & 0b1);
- Marshal.putLong(uuid, storage, offset);
+ Marshal.putLong(makeUUID(mateId, readId, posId), storage, offset);
}
public void set(PositionWritable pos) {