本文整理汇总了Java中java.util.BitSet.clone方法的典型用法代码示例。如果您正苦于以下问题:Java BitSet.clone方法的具体用法?Java BitSet.clone怎么用?Java BitSet.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.BitSet
的用法示例。
在下文中一共展示了BitSet.clone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeAt
import java.util.BitSet; //导入方法依赖的package包/类
/** Removes specified amount of bits from the set.
*/
private static BitSet removeAt (BitSet b, int at, int len, int newSize) {
BitSet clone = (BitSet)b.clone ();
int max = b.length ();
while (at < max) {
clone.set (at, b.get (at + len));
at++;
}
clone.set (newSize, b.size (), false);
return clone;
}
示例2: computeImplies
import java.util.BitSet; //导入方法依赖的package包/类
/** Returns the implication of two bit sets */
private BitSet computeImplies(BitSet arg1, BitSet arg2) {
BitSet result = (BitSet) arg2.clone();
for (int i = 0; i < this.nodeCount; i++) {
if (!result.get(i)) {
result.set(i, arg1.get(i));
}
}
return result;
}
示例3: updatePredecessors
import java.util.BitSet; //导入方法依赖的package包/类
protected void updatePredecessors() {
TIntObjectIterator<BitSet> iterator = nodeToSplit.getValue().predecessors.iterator();
Node<ValueNode> parent = nodeToSplit.getParent();
BitSet letterToDeleted = new BitSet();
while(iterator.hasNext()) {
iterator.advance();
int letter = iterator.key();
BitSet statePrevs = iterator.value();
BitSet stateLeft = (BitSet) statePrevs.clone();
for(int stateNr = statePrevs.nextSetBit(0)
; stateNr >= 0
; stateNr = statePrevs.nextSetBit(stateNr + 1)) {
ValueNode statePrev = states.get(stateNr);
Node<ValueNode> nodeOther = sift(statePrev.label.append(letter), parent);
if (nodeOther != nodeToSplit) {
updateTransition(stateNr, letter, nodeOther.getValue().id);
stateLeft.clear(stateNr);
}
}
if(stateLeft.isEmpty()) {
letterToDeleted.set(letter);
}else {
iterator.setValue(stateLeft);
}
}
for(int letter = letterToDeleted.nextSetBit(0)
; letter >= 0
; letter = letterToDeleted.nextSetBit(letter + 1)) {
nodeToSplit.getValue().predecessors.remove(letter);
}
}
示例4: create_actions
import java.util.BitSet; //导入方法依赖的package包/类
protected static BitSet create_actions(BitSet actions)
{
BitSet b;
b = actions == null ? new BitSet() : (BitSet) actions.clone();
if (b.isEmpty())
{
b.set(PRINT_STATISTICS);
}
return b;
}
示例5: processBlock
import java.util.BitSet; //导入方法依赖的package包/类
@SuppressWarnings("try")
private void processBlock(AbstractBlockBase<?> block, Deque<AbstractBlockBase<?>> worklist) {
DebugContext debug = lir.getDebug();
if (updateOutBlock(block)) {
try (Indent indent = debug.logAndIndent("handle block %s", block)) {
ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block);
// get out set and mark intervals
BitSet outSet = liveOutMap.get(block);
markOutInterval(outSet, getBlockEnd(instructions));
printLiveSet("liveOut", outSet);
// process instructions
BlockClosure closure = new BlockClosure((BitSet) outSet.clone());
for (int i = instructions.size() - 1; i >= 0; i--) {
LIRInstruction inst = instructions.get(i);
closure.processInstructionBottomUp(inst);
}
// add predecessors to work list
for (AbstractBlockBase<?> b : block.getPredecessors()) {
worklist.add(b);
}
// set in set and mark intervals
BitSet inSet = closure.getCurrentSet();
liveInMap.put(block, inSet);
markInInterval(inSet, getBlockBegin(instructions));
printLiveSet("liveIn", inSet);
}
}
}
示例6: simplify
import java.util.BitSet; //导入方法依赖的package包/类
private void simplify(LoopRegion loop, BitSet live, int index) {
List<IRegion> children = loop.getChildren();
BitSet copy = (BitSet)live.clone();
for (int i = children.size() - 1; i >= 0; i--) {
visit(children.get(i), copy);
}
if (check(loop, new BitSet(size))) {
//can simplify
int startIndex = getFirstBlock(loop);
BlockNode newBlock = BlockSpiltVisitor.startNewBlock(method, -1);
MulRegion mulRegion = new MulRegion(newBlock, loop.getParent());
remover.clear();
doSimplify(loop, newBlock, mulRegion);
for (IRegion region : mulRegion.getChildren()) {
if (region instanceof Region)
newBlock.getInstructions().add(((Region) region).getInsn().getInstruction());
}
method.getMethodData().moveInstructions(startIndex, newBlock.getInstructions());
method.getMethodData().removeInstructions(remover);
remover.clear();
loop.getParent().getChildren().remove(loop);
loop.getParent().getChildren().add(index, mulRegion);
} else {
//can not, simplify children
for (int i = children.size() - 1; i >= 0; i--) {
visitLoop(children.get(i), live, i);
}
}
}
示例7: simplify
import java.util.BitSet; //导入方法依赖的package包/类
private void simplify(LoopRegion loop, BitSet live, int index) {
List<IRegion> children = loop.getChildren();
BitSet copy = (BitSet)live.clone();
for (int i = children.size() - 1; i >= 0; i--) {
//remove top level insns
for (IRegion child : children.get(i).getChildren()) {
if (child instanceof Region)
((Region) child).getInsn().add(AFlag.REMOVE_FOR_FLAT);
}
visit(children.get(i), copy);
}
if (check(loop, new BitSet(size))) {
//can simplify
System.out.println("do simplify...");
int startIndex = getFirstBlock(loop);
BlockNode newBlock = BlockSpiltVisitor.startNewBlock(method, -1);
MulRegion mulRegion = new MulRegion(newBlock, loop.getParent());
remover.clear();
doSimplify(loop, newBlock, mulRegion);
for (IRegion region : mulRegion.getChildren()) {
if (region instanceof Region)
newBlock.getInstructions().add(((Region) region).getInsn().getInstruction());
}
method.getMethodData().moveInstructions(startIndex, newBlock.getInstructions());
method.getMethodData().removeInstructions(remover);
remover.clear();
loop.getParent().getChildren().remove(loop);
loop.getParent().getChildren().add(index, mulRegion);
} else {
//can not, simplify children
for (int i = children.size() - 1; i >= 0; i--) {
visitLoop(children.get(i), live, i);
}
}
}
示例8: hasTopic
import java.util.BitSet; //导入方法依赖的package包/类
public boolean hasTopic(Topic topic) {
BitSet m = new BloomFilter(topic).mask;
BitSet m1 = (BitSet) m.clone();
m1.and(mask);
return m1.equals(m);
}
示例9: computeNeg
import java.util.BitSet; //导入方法依赖的package包/类
/** Returns the negation of a (bit) set. */
private BitSet computeNeg(BitSet arg) {
BitSet result = (BitSet) arg.clone();
result.flip(0, this.nodeCount);
return result;
}
示例10: computeOr
import java.util.BitSet; //导入方法依赖的package包/类
/** Returns the disjunction of two bit sets. */
private BitSet computeOr(BitSet arg1, BitSet arg2) {
BitSet result = (BitSet) arg1.clone();
result.or(arg2);
return result;
}
示例11: computeAnd
import java.util.BitSet; //导入方法依赖的package包/类
/** Returns the conjunction of two bit sets */
private BitSet computeAnd(BitSet arg1, BitSet arg2) {
BitSet result = (BitSet) arg1.clone();
result.and(arg2);
return result;
}
示例12: intersection
import java.util.BitSet; //导入方法依赖的package包/类
public int intersection(BitSet a, BitSet b) {
BitSet c = (BitSet)a.clone();
c.and(b);
return c.cardinality();
}
示例13: subset
import java.util.BitSet; //导入方法依赖的package包/类
private static boolean subset(BitSet sub, BitSet sup) {
BitSet subcopy = (BitSet) sub.clone();
subcopy.andNot(sup);
return subcopy.isEmpty();
}
示例14: subset
import java.util.BitSet; //导入方法依赖的package包/类
private static boolean subset(BitSet sub, BitSet sup) {
BitSet subcopy = (BitSet) sub.clone();
subcopy.andNot(sup);
return subcopy.isEmpty();
}
示例15: VirtualStackSlotRange
import java.util.BitSet; //导入方法依赖的package包/类
public VirtualStackSlotRange(int id, int slots, BitSet objects, LIRKind kind) {
super(id, kind);
this.slots = slots;
this.objects = (BitSet) objects.clone();
}