Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Feb 21, 2025
1 parent b450f5c commit 4e6b402
Show file tree
Hide file tree
Showing 39 changed files with 391 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,54 @@
*/
interface BZip2Constants {

/**
* Constant {@value}.
*/
int BASEBLOCKSIZE = 100_000;

/**
* Constant {@value}.
*/
int MAX_ALPHA_SIZE = 258;

/**
* Constant {@value}.
*/
int MAX_CODE_LEN = 23;

/**
* Constant {@value}.
*/
int RUNA = 0;

/**
* Constant {@value}.
*/
int RUNB = 1;

/**
* Constant {@value}.
*/
int N_GROUPS = 6;

/**
* Constant {@value}.
*/
int G_SIZE = 50;

/**
* Constant {@value}.
*/
int N_ITERS = 4;

/**
* Constant {@value}.
*/
int MAX_SELECTORS = 2 + 900_000 / G_SIZE;

/**
* Constant {@value}.
*/
int NUM_OVERSHOOT_BYTES = 20;

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class BandData {
private Map<Integer, Integer> distinctValues;

/**
* Constructs a new instance of BandData. The band is then analysed.
* Constructs a new instance of BandData. The band is then analyzed.
*
* @param band the band of integers
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class CanonicalCodecFamilies {
// Families of codecs for bands of positive integers that do not correlate
// well (i.e. would not benefit from delta encoding)

/**
* Non-delta unsigned codecs 1.
*/
public static BHSDCodec[] nonDeltaUnsignedCodecs1 = {
// (1,256) is a special case and is considered separately so shouldn't be included here
// CodecEncoding.getCanonicalCodec(1), // (1,256)
Expand All @@ -34,27 +37,39 @@ public class CanonicalCodecFamilies {
CodecEncoding.getCanonicalCodec(13) // (4,256)
};

/**
* Non-delta unsigned codecs 2.
*/
public static BHSDCodec[] nonDeltaUnsignedCodecs2 = { CodecEncoding.getCanonicalCodec(17), // (5,4)
CodecEncoding.getCanonicalCodec(20), // (5,16)
CodecEncoding.getCanonicalCodec(23), // (5,32)
CodecEncoding.getCanonicalCodec(26), // (5,64)
CodecEncoding.getCanonicalCodec(29) // (5,128)
};

/**
* Non-delta unsigned codecs 3.
*/
public static BHSDCodec[] nonDeltaUnsignedCodecs3 = { CodecEncoding.getCanonicalCodec(47), // (2,192)
CodecEncoding.getCanonicalCodec(48), // (2,224)
CodecEncoding.getCanonicalCodec(49), // (2,240)
CodecEncoding.getCanonicalCodec(50), // (2,248)
CodecEncoding.getCanonicalCodec(51) // (2,252)
};

/**
* Non-delta unsigned codecs 4.
*/
public static BHSDCodec[] nonDeltaUnsignedCodecs4 = { CodecEncoding.getCanonicalCodec(70), // (3,192)
CodecEncoding.getCanonicalCodec(71), // (3,224)
CodecEncoding.getCanonicalCodec(72), // (3,240)
CodecEncoding.getCanonicalCodec(73), // (3,248)
CodecEncoding.getCanonicalCodec(74) // (3,252)
};

/**
* Non-delta unsigned codecs 5.
*/
public static BHSDCodec[] nonDeltaUnsignedCodecs5 = { CodecEncoding.getCanonicalCodec(93), // (4,192)
CodecEncoding.getCanonicalCodec(94), // (4,224)
CodecEncoding.getCanonicalCodec(95), // (4,240)
Expand All @@ -65,19 +80,28 @@ public class CanonicalCodecFamilies {
// Families of codecs for bands of positive integers that do correlate well
// and would benefit from delta encoding

/**
* Delta unsigned codecs 1.
*/
public static BHSDCodec[] deltaUnsignedCodecs1 = { CodecEncoding.getCanonicalCodec(3), // (1,256,0,1)
CodecEncoding.getCanonicalCodec(7), // (2,256,0,1)
CodecEncoding.getCanonicalCodec(11), // (3,256,0,1)
CodecEncoding.getCanonicalCodec(15) // (4,256,0,1)
};

/**
* Delta unsigned codecs 2.
*/
public static BHSDCodec[] deltaUnsignedCodecs2 = { CodecEncoding.getCanonicalCodec(32), // (5,4,0,1)
CodecEncoding.getCanonicalCodec(35), // (5,16,0,1)
CodecEncoding.getCanonicalCodec(38), // (5,32,0,1)
CodecEncoding.getCanonicalCodec(41), // (5,64,0,1)
CodecEncoding.getCanonicalCodec(44) // (5,128,0,1)
};

/**
* Delta unsigned codecs 3.
*/
public static BHSDCodec[] deltaUnsignedCodecs3 = { CodecEncoding.getCanonicalCodec(52), // (2,8,0,1)
CodecEncoding.getCanonicalCodec(54), // (2,16,0,1)
CodecEncoding.getCanonicalCodec(56), // (2,32,0,1)
Expand All @@ -89,6 +113,9 @@ public class CanonicalCodecFamilies {
CodecEncoding.getCanonicalCodec(68) // (2,248,0,1)
};

/**
* Delta unsigned codecs 4.
*/
public static BHSDCodec[] deltaUnsignedCodecs4 = { CodecEncoding.getCanonicalCodec(75), // (3,8,0,1)
CodecEncoding.getCanonicalCodec(77), // (3,16,0,1)
CodecEncoding.getCanonicalCodec(79), // (3,32,0,1)
Expand All @@ -100,6 +127,9 @@ public class CanonicalCodecFamilies {
CodecEncoding.getCanonicalCodec(91) // (3,248,0,1)
};

/**
* Delta unsigned codecs 5.
*/
public static BHSDCodec[] deltaUnsignedCodecs5 = { CodecEncoding.getCanonicalCodec(98), // (4,8,0,1)
CodecEncoding.getCanonicalCodec(100), // (4,16,0,1)
CodecEncoding.getCanonicalCodec(102), // (4,32,0,1)
Expand All @@ -114,19 +144,28 @@ public class CanonicalCodecFamilies {
// Families of codecs for bands containing positive and negative integers
// that do correlate well (i.e. delta encoding is used)

/**
* Delta signed codecs 1.
*/
public static BHSDCodec[] deltaSignedCodecs1 = { CodecEncoding.getCanonicalCodec(4), // (1,256,1,1)
CodecEncoding.getCanonicalCodec(8), // (2,256,1,1)
CodecEncoding.getCanonicalCodec(12), // (3,256,1,1)
CodecEncoding.getCanonicalCodec(16) // (4,256,1,1)
};

/**
* Delta signed codecs 2.
*/
public static BHSDCodec[] deltaSignedCodecs2 = { CodecEncoding.getCanonicalCodec(33), // (5,4,1,1)
CodecEncoding.getCanonicalCodec(36), // (5,16,1,1)
CodecEncoding.getCanonicalCodec(39), // (5,32,1,1)
CodecEncoding.getCanonicalCodec(42), // (5,64,1,1)
CodecEncoding.getCanonicalCodec(45) // (5,128,1,1)
};

/**
* Delta signed codecs 3.
*/
public static BHSDCodec[] deltaSignedCodecs3 = { CodecEncoding.getCanonicalCodec(53), // (2,8,1,1)
CodecEncoding.getCanonicalCodec(55), // (2,16,1,1)
CodecEncoding.getCanonicalCodec(57), // (2,32,1,1)
Expand All @@ -138,6 +177,9 @@ public class CanonicalCodecFamilies {
CodecEncoding.getCanonicalCodec(69) // (2,248,1,1)
};

/**
* Delta signed codecs 4.
*/
public static BHSDCodec[] deltaSignedCodecs4 = { CodecEncoding.getCanonicalCodec(76), // (3,8,1,1)
CodecEncoding.getCanonicalCodec(78), // (3,16,1,1)
CodecEncoding.getCanonicalCodec(80), // (3,32,1,1)
Expand All @@ -149,6 +191,9 @@ public class CanonicalCodecFamilies {
CodecEncoding.getCanonicalCodec(92) // (3,248,1,1)
};

/**
* Delta signed codecs 5.
*/
public static BHSDCodec[] deltaSignedCodecs5 = { CodecEncoding.getCanonicalCodec(99), // (4,8,1,1)
CodecEncoding.getCanonicalCodec(101), // (4,16,1,1)
CodecEncoding.getCanonicalCodec(103), // (4,32,1,1)
Expand All @@ -160,6 +205,9 @@ public class CanonicalCodecFamilies {
CodecEncoding.getCanonicalCodec(115) // (4,248,1,1)
};

/**
* Delta double signed codecs 1.
*/
public static BHSDCodec[] deltaDoubleSignedCodecs1 = { CodecEncoding.getCanonicalCodec(34), // (5,4,2,1)
CodecEncoding.getCanonicalCodec(37), // (5,16,2,1)
CodecEncoding.getCanonicalCodec(40), // (5,32,2,1)
Expand All @@ -170,19 +218,28 @@ public class CanonicalCodecFamilies {
// Families of codecs for bands containing positive and negative values that
// do not correlate well (i.e. delta encoding is not used)

/**
* Non-delta signed codecs 1.
*/
public static BHSDCodec[] nonDeltaSignedCodecs1 = { CodecEncoding.getCanonicalCodec(2), // (1,256,1)
CodecEncoding.getCanonicalCodec(6), // (2,256,1)
CodecEncoding.getCanonicalCodec(10), // (3,256,1)
CodecEncoding.getCanonicalCodec(14) // (4,256,1)
};

/**
* Non-delta signed codecs 2.
*/
public static BHSDCodec[] nonDeltaSignedCodecs2 = { CodecEncoding.getCanonicalCodec(18), // (5,4,1)
CodecEncoding.getCanonicalCodec(21), // (5,16,1)
CodecEncoding.getCanonicalCodec(24), // (5,32,1)
CodecEncoding.getCanonicalCodec(27), // (5,64,1)
CodecEncoding.getCanonicalCodec(30) // (5,128,1)
};

/**
* Non-delta double signed codecs 1.
*/
public static BHSDCodec[] nonDeltaDoubleSignedCodecs1 = { CodecEncoding.getCanonicalCodec(19), // (5,4,2)
CodecEncoding.getCanonicalCodec(22), // (5,16,2)
CodecEncoding.getCanonicalCodec(25), // (5,32,2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ public static ByteCodeForm get(final int opcode) {
/**
* Constructs a new instance with the specified opcode and name. Assume no rewrite.
*
* @param opcode int corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param opcode index corresponding to the opcode's value.
* @param name printable name of the opcode.
*/
public ByteCodeForm(final int opcode, final String name) {
this(opcode, name, new int[] { opcode });
Expand All @@ -326,9 +326,9 @@ public ByteCodeForm(final int opcode, final String name) {
/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode int corresponding to the opcode's value.
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite int[] Array of ints. Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
*/
public ByteCodeForm(final int opcode, final String name, final int[] rewrite) {
this.opcode = opcode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
*/
public class ByteForm extends ByteCodeForm {

/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
*/
public ByteForm(final int opcode, final String name, final int[] rewrite) {
super(opcode, name, rewrite);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,25 @@ public class ClassRefForm extends ReferenceForm {

protected boolean widened;

/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
*/
public ClassRefForm(final int opcode, final String name, final int[] rewrite) {
super(opcode, name, rewrite);
}

/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
* @param widened TODO.
*/
public ClassRefForm(final int opcode, final String name, final int[] rewrite, final boolean widened) {
this(opcode, name, rewrite);
this.widened = widened;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
*/
public abstract class ClassSpecificReferenceForm extends ReferenceForm {

/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
*/
public ClassSpecificReferenceForm(final int opcode, final String name, final int[] rewrite) {
super(opcode, name, rewrite);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
*/
public class DoubleForm extends ReferenceForm {

/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
*/
public DoubleForm(final int opcode, final String name, final int[] rewrite) {
super(opcode, name, rewrite);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
*/
public class FieldRefForm extends ReferenceForm {

/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
*/
public FieldRefForm(final int opcode, final String name, final int[] rewrite) {
super(opcode, name, rewrite);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,25 @@
*/
public class FloatRefForm extends SingleByteReferenceForm {

/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
*/
public FloatRefForm(final int opcode, final String name, final int[] rewrite) {
super(opcode, name, rewrite);
}

/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
* @param widened TODO.
*/
public FloatRefForm(final int opcode, final String name, final int[] rewrite, final boolean widened) {
this(opcode, name, rewrite);
this.widened = widened;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
*/
public class IMethodRefForm extends ReferenceForm {

/**
* Constructs a new instance with the specified opcode, name, operandType and rewrite.
*
* @param opcode index corresponding to the opcode's value.
* @param name String printable name of the opcode.
* @param rewrite Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
*/
public IMethodRefForm(final int opcode, final String name, final int[] rewrite) {
super(opcode, name, rewrite);
}
Expand Down
Loading

0 comments on commit 4e6b402

Please sign in to comment.