private void enableLargeMode() { if (isLarge) return; Block[] blocks = new Block[BLOCK_COUNT]; this.blocks = blocks; if (block0 != null) { blocks[0] = new Block(block0); } isLarge = true; }
private void enableLargeMode() { if (isLarge) return; Block[] blocks = new Block[BLOCK_COUNT]; this.blocks = blocks; if (block0 != null) { blocks[0] = new Block(block0); } isLarge = true; }
static int add(Block[] targets, Block[] addends, int from, int to, boolean inv) { int s = 0; for (int i = from; i <= to; i++) { Block addend = addends[i]; if (addend == null) { if (!inv) continue; } else if (addend.isFull && inv) continue; Block target = targets[i]; if (target == null) targets[i] = target = new Block(); else if (target.isFull) continue; s += add(target, addend, inv); } return s; }
static int add(Block[] targets, Block[] addends, int from, int to, boolean inv) { int s = 0; for (int i = from; i <= to; i++) { Block addend = addends[i]; if (addend == null) { if (!inv) continue; } else if (addend.isFull && inv) continue; Block target = targets[i]; if (target == null) targets[i] = target = new Block(); else if (target.isFull) continue; s += add(target, addend, inv); } return s; }
final void setRange(char c1, char c2) { //System.out.println("["+this+"].setRange("+c1+","+c2+"):"); //if(c1>31 && c1<=126 && c2>31 && c2<=126) System.out.println("setRange('"+c1+"','"+c2+"'):"); //else System.out.println("setRange(["+Integer.toHexString(c1)+"],["+Integer.toHexString(c2)+"]):"); if (c2 >= 256 || isLarge) { int s = 0; if (!isLarge) { enableLargeMode(); } Block[] blocks = this.blocks; for (int c = c1; c <= c2; c++) { int i2 = (c >> 8) & 0xff; int i = c & 0xff; Block block = blocks[i2]; if (block == null) { blocks[i2] = block = new Block(); } if (block.set(i)) s++; } weight += s; } else { IntBitSet block0 = this.block0; if (block0 == null) { this.block0 = block0 = new IntBitSet(); } weight += set(block0, c1, c2); } }
final void setRange(char c1, char c2) { //System.out.println("["+this+"].setRange("+c1+","+c2+"):"); //if(c1>31 && c1<=126 && c2>31 && c2<=126) System.out.println("setRange('"+c1+"','"+c2+"'):"); //else System.out.println("setRange(["+Integer.toHexString(c1)+"],["+Integer.toHexString(c2)+"]):"); if (c2 >= 256 || isLarge) { int s = 0; if (!isLarge) { enableLargeMode(); } Block[] blocks = this.blocks; for (int c = c1; c <= c2; c++) { int i2 = (c >> 8) & 0xff; int i = c & 0xff; Block block = blocks[i2]; if (block == null) { blocks[i2] = block = new Block(); } if (block.set(i)) s++; } weight += s; } else { IntBitSet block0 = this.block0; if (block0 == null) { this.block0 = block0 = new IntBitSet(BLOCK_SIZE); } weight += set(block0, c1, c2); } }