final void setCategory(String c) { if (!isLarge) enableLargeMode(); Block[] catBits = Category.categories.get(c).blocks; weight += Block.add(this.blocks, catBits, 0, BLOCK_COUNT - 1, false); //System.out.println("["+this+"].setCategory("+c+"): weight="+weight); }
final void setCategory(String c) { if (!isLarge) enableLargeMode(); Block[] catBits = Category.categories.get(c).blocks; weight += Block.add(this.blocks, catBits, 0, BLOCK_COUNT - 1, false); //System.out.println("["+this+"].setCategory("+c+"): weight="+weight); }
private static int subtractImpl(BlockSet bs1, BlockSet bs2, boolean inv) { int s = 0; if (!bs1.isLarge && !bs2.isLarge && !inv) { IntBitSet bits1, bits2; if ((bits2 = bs2.block0) != null) { bits1 = bs1.block0; if (bits1 == null) return 0; s += subtract(bits1, bits2, false); } } else { if (!bs1.isLarge) bs1.enableLargeMode(); if (!bs2.isLarge) bs2.enableLargeMode(); s += Block.subtract(bs1.blocks, bs2.blocks, 0, BLOCK_COUNT - 1, inv); } return s; }
private static int subtractImpl(BlockSet bs1, BlockSet bs2, boolean inv) { int s = 0; if (!bs1.isLarge && !bs2.isLarge && !inv) { IntBitSet bits1, bits2; if ((bits2 = bs2.block0) != null) { bits1 = bs1.block0; if (bits1 == null) return 0; s += subtract(bits1, bits2, false); } } else { if (!bs1.isLarge) bs1.enableLargeMode(); if (!bs2.isLarge) bs2.enableLargeMode(); s += Block.subtract(bs1.blocks, bs2.blocks, 0, BLOCK_COUNT - 1, inv); } return s; }
private static int addImpl(BlockSet bs1, BlockSet bs2, boolean inv) { int s = 0; if (!bs1.isLarge && !bs2.isLarge && !inv) { if (bs2.block0 != null) { IntBitSet bits = bs1.block0; if (bits == null) bs1.block0 = bits = new IntBitSet(BLOCK_SIZE); s += add(bits, bs2.block0, 0, BLOCK_SIZE - 1, false); } } else { if (!bs1.isLarge) bs1.enableLargeMode(); if (!bs2.isLarge) bs2.enableLargeMode(); s += Block.add(bs1.blocks, bs2.blocks, 0, BLOCK_COUNT - 1, inv); } return s; }
private static int addImpl(BlockSet bs1, BlockSet bs2, boolean inv) { int s = 0; if (!bs1.isLarge && !bs2.isLarge && !inv) { if (bs2.block0 != null) { IntBitSet bits = bs1.block0; if (bits == null) bs1.block0 = bits = new IntBitSet(); s += add(bits, bs2.block0, 0, BLOCK_SIZE - 1, false); } } else { if (!bs1.isLarge) bs1.enableLargeMode(); if (!bs2.isLarge) bs2.enableLargeMode(); s += Block.add(bs1.blocks, bs2.blocks, 0, BLOCK_COUNT - 1, 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); } }
final void setWordChar(boolean unicode) { if (unicode) { if (!isLarge) enableLargeMode(); weight += Block.add(this.blocks, Category.Word.blocks, 0, BLOCK_COUNT - 1, false); /* setCategory("Lu"); setCategory("Ll"); setCategory("Lt"); setCategory("Lo"); setCategory("Nd"); setChar('_');*/ } else { setRange('a', 'z'); setRange('A', 'Z'); setRange('0', '9'); setChar('_'); } }
final void setWordChar(boolean unicode) { if (unicode) { if (!isLarge) enableLargeMode(); weight += Block.add(this.blocks, Category.Word.blocks, 0, BLOCK_COUNT - 1, false); /* setCategory("Lu"); setCategory("Ll"); setCategory("Lt"); setCategory("Lo"); setCategory("Nd"); setChar('_');*/ } else { setRange('a', 'z'); setRange('A', 'Z'); setRange('0', '9'); setChar('_'); } }