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); }
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; }
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 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('_'); } }