private boolean isAlphaOr646ToNumericLatch(int pos) { // Next is alphanumeric if there are 3 positions and they are all zeros if (pos + 3 > this.information.getSize()) { return false; } for (int i = pos; i < pos + 3; ++i) { if (this.information.get(i)) { return false; } } return true; }
static int extractNumericValueFromBitArray(BitArray information, int pos, int bits) { int value = 0; for (int i = 0; i < bits; ++i) { if (information.get(pos + i)) { value |= 1 << (bits - i - 1); } } return value; }
private static int getNextSecondBar(BitArray row, int initialPos) { int currentPos; if (row.get(initialPos)) { currentPos = row.getNextUnset(initialPos); currentPos = row.getNextSet(currentPos); } else { currentPos = row.getNextSet(initialPos); currentPos = row.getNextUnset(currentPos); } return currentPos; }
private boolean isAlphaOr646ToNumericLatch(int pos) { // Next is alphanumeric if there are 3 positions and they are all zeros if (pos + 3 > this.information.getSize()) { return false; } for (int i = pos; i < pos + 3; ++i) { if (this.information.get(i)) { return false; } } return true; }
static int extractNumericValueFromBitArray(BitArray information, int pos, int bits) { int value = 0; for (int i = 0; i < bits; ++i) { if (information.get(pos + i)) { value |= 1 << (bits - i - 1); } } return value; }
private static int getNextSecondBar(BitArray row, int initialPos) { int currentPos; if (row.get(initialPos)) { currentPos = row.getNextUnset(initialPos); currentPos = row.getNextSet(currentPos); } else { currentPos = row.getNextSet(initialPos); currentPos = row.getNextUnset(currentPos); } return currentPos; }
private boolean isStillNumeric(int pos) { // It's numeric if it still has 7 positions // and one of the first 4 bits is "1". if (pos + 7 > this.information.getSize()) { return pos + 4 <= this.information.getSize(); } for (int i = pos; i < pos + 3; ++i) { if (this.information.get(i)) { return true; } } return this.information.get(pos + 3); }
private boolean isAlphaOr646ToNumericLatch(int pos) { // Next is alphanumeric if there are 3 positions and they are all zeros if (pos + 3 > this.information.size) { return false; } for (int i = pos; i < pos + 3; ++i) { if (this.information.get(i)) { return false; } } return true; }
private boolean isStillNumeric(int pos) { // It's numeric if it still has 7 positions // and one of the first 4 bits is "1". if (pos + 7 > this.information.getSize()) { return pos + 4 <= this.information.getSize(); } for (int i = pos; i < pos + 3; ++i) { if (this.information.get(i)) { return true; } } return this.information.get(pos + 3); }
private static int getNextSecondBar(BitArray row, int initialPos){ int currentPos = initialPos; boolean current = row.get(currentPos); while(currentPos < row.size && row.get(currentPos) == current) { currentPos++; } current = !current; while(currentPos < row.size && row.get(currentPos) == current) { currentPos++; } return currentPos; }
public void appendBitArray(BitArray other) { int otherSize = other.getSize(); ensureCapacity(size + otherSize); for (int i = 0; i < otherSize; i++) { appendBit(other.get(i)); } }
/** * Reverses all bits in the array. */ public void reverse() { int[] newBits = new int[bits.length]; int size = this.size; for (int i = 0; i < size; i++) { if (get(size - i - 1)) { newBits[i >> 5] |= 1 << (i & 0x1F); } } bits = newBits; }
public void appendBitArray(BitArray other) { int otherSize = other.getSize(); ensureCapacity(size + otherSize); for (int i = 0; i < otherSize; i++) { appendBit(other.get(i)); } }
static int extractNumericValueFromBitArray(BitArray information, int pos, int bits) { if(bits > 32) { throw new IllegalArgumentException("extractNumberValueFromBitArray can't handle more than 32 bits"); } int value = 0; for(int i = 0; i < bits; ++i) { if (information.get(pos + i)) { value |= (1 << (bits - i - 1)); } } return value; }
public String toString() { StringBuffer result = new StringBuffer(size); for (int i = 0; i < size; i++) { if ((i & 0x07) == 0) { result.append(' '); } result.append(get(i) ? 'X' : '.'); } return result.toString(); }
@Override public String toString() { StringBuilder result = new StringBuilder(size); for (int i = 0; i < size; i++) { if ((i & 0x07) == 0) { result.append(' '); } result.append(get(i) ? 'X' : '.'); } return result.toString(); }
@Override public String toString() { StringBuilder result = new StringBuilder(size); for (int i = 0; i < size; i++) { if ((i & 0x07) == 0) { result.append(' '); } result.append(get(i) ? 'X' : '.'); } return result.toString(); }
public String toString() { StringBuffer result = new StringBuffer(size); for (int i = 0; i < size; i++) { if ((i & 0x07) == 0) { result.append(' '); } result.append(get(i) ? 'X' : '.'); } return result.toString(); }
public void appendBitArray(BitArray other) { int otherSize = other.size; ensureCapacity(size + otherSize); for (int i = 0; i < otherSize; i++) { appendBit(other.get(i)); } }
public void appendBitArray(BitArray other) { int otherSize = other.size; ensureCapacity(size + otherSize); for (int i = 0; i < otherSize; i++) { appendBit(other.get(i)); } }