Tweaked Java comments and added assert.

pull/39/merge
Project Nayuki 6 years ago
parent 362d552c92
commit e9e7363c55

@ -59,6 +59,7 @@ public final class BitBuffer implements Cloneable {
* @return the length of this sequence * @return the length of this sequence
*/ */
public int bitLength() { public int bitLength() {
assert bitLength >= 0;
return bitLength; return bitLength;
} }

@ -173,7 +173,7 @@ public final class QrSegment {
* @param md the mode, which is not {@code null} * @param md the mode, which is not {@code null}
* @param numCh the data length in characters, which is non-negative * @param numCh the data length in characters, which is non-negative
* @param data the data bits of this segment, which is not {@code null} * @param data the data bits of this segment, which is not {@code null}
* @throws NullPointerException if the mode or bit buffer is {@code null} * @throws NullPointerException if the mode or data is {@code null}
* @throws IllegalArgumentException if the character count is negative * @throws IllegalArgumentException if the character count is negative
*/ */
public QrSegment(Mode md, int numCh, BitBuffer data) { public QrSegment(Mode md, int numCh, BitBuffer data) {
@ -189,7 +189,7 @@ public final class QrSegment {
/*---- Methods ----*/ /*---- Methods ----*/
/** /**
* Returns the data bits of this segment. * Returns a copy of the data bits of this segment.
* @return the data bits of this segment (not {@code null}) * @return the data bits of this segment (not {@code null})
*/ */
public BitBuffer getBits() { public BitBuffer getBits() {
@ -267,7 +267,6 @@ public final class QrSegment {
* Returns the bit width of the segment character count field for this mode object at the specified version number. * Returns the bit width of the segment character count field for this mode object at the specified version number.
* @param ver the version number, which is between 1 to 40 (inclusive) * @param ver the version number, which is between 1 to 40 (inclusive)
* @return the number of bits for the character count, which is between 8 to 16 (inclusive) * @return the number of bits for the character count, which is between 8 to 16 (inclusive)
* @throws IllegalArgumentException if the version number is out of range
*/ */
int numCharCountBits(int ver) { int numCharCountBits(int ver) {
assert QrCode.MIN_VERSION <= ver && ver <= QrCode.MAX_VERSION; assert QrCode.MIN_VERSION <= ver && ver <= QrCode.MAX_VERSION;

Loading…
Cancel
Save