本文整理了Java中java.util.BitSet.xor()
方法的一些代码示例,展示了BitSet.xor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.xor()
方法的具体详情如下:
包路径:java.util.BitSet
类名称:BitSet
方法名:xor
[英]Logically xors the bits of this BitSet with bs.
[中]逻辑上,将该位集的位与B进行异或。
代码示例来源:origin: org.apache.hadoop/hadoop-common
@Override
public void xor(Filter filter) {
if(filter == null
|| !(filter instanceof BloomFilter)
|| filter.vectorSize != this.vectorSize
|| filter.nbHash != this.nbHash) {
throw new IllegalArgumentException("filters cannot be xor-ed");
}
bits.xor(((BloomFilter) filter).bits);
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Bitwise XOR together two BitSets. Called when the '^' operator is used
* between two bit sets.
*
* @param left a BitSet
* @param right another BitSet to bitwise AND
* @return the bitwise XOR of both BitSets
* @since 1.5.0
*/
public static BitSet xor(BitSet left, BitSet right) {
BitSet result = (BitSet) left.clone();
result.xor(right);
return result;
}
代码示例来源:origin: stackoverflow.com
ms[j].xor(temp);
bxor.get(i).add(j, ms[j]);
代码示例来源:origin: konsoletyper/teavm
lowHighSurrogates.xor(clazz.getLowHighSurrogates());
lowHighSurrogates.and(clazz.getLowHighSurrogates());
altSurrogates = true;
bits.xor(clazz.getBits());
bits.and(clazz.getBits());
alt = true;
代码示例来源:origin: konsoletyper/teavm
lowHighSurrogates.xor(cc.getLowHighSurrogates());
lowHighSurrogates.and(cc.getLowHighSurrogates());
altSurrogates = !altSurrogates;
bits.xor(cc.getBits());
bits.and(cc.getBits());
alt = !alt;
代码示例来源:origin: konsoletyper/teavm
lowHighSurrogates.xor(clazz.getLowHighSurrogates());
lowHighSurrogates.and(clazz.getLowHighSurrogates());
altSurrogates = false;
bits.xor(clazz.getBits());
bits.and(clazz.getBits());
alt = false;
代码示例来源:origin: stackoverflow.com
void swap(BitSet s1, BitSet s2) {
s1.xor(s2);
s2.xor(s1);
s1.xor(s2);
}
代码示例来源:origin: vsch/flexmark-java
public BitIntegerSet xor(BitIntegerSet set) {myBits.xor(set.myBits); return this;}
public BitIntegerSet andNot(BitIntegerSet set) {myBits.andNot(set.myBits); return this;}
代码示例来源:origin: vsch/flexmark-java
public BitIntegerSet xor(BitSet set) {myBits.xor(set); return this;}
public BitIntegerSet andNot(BitSet set) {myBits.andNot(set); return this;}
代码示例来源:origin: apache/accumulo
@Override
public void xor(final Filter filter) {
if (filter == null || !(filter instanceof BloomFilter) || filter.vectorSize != this.vectorSize
|| filter.nbHash != this.nbHash) {
throw new IllegalArgumentException("filters cannot be xor-ed");
}
bits.xor(((BloomFilter) filter).bits);
}
代码示例来源:origin: klout/brickhouse
@Override
public void xor(Filter filter) {
BloomFilter bfilter = (BloomFilter) filter;
if (filter == null
|| !(filter instanceof BloomFilter)
|| bfilter.vectorSize != this.vectorSize
|| bfilter.nbHash != this.nbHash) {
throw new IllegalArgumentException("filters cannot be xor-ed");
}
bits.xor(((BloomFilter) filter).bits);
}
代码示例来源:origin: vsch/flexmark-java
@Override
public boolean containsAll(Collection<?> collection) {
if (collection instanceof BitIntegerSet) {
BitSet other = ((BitIntegerSet) collection).myBits;
BitSet bitSet = (BitSet) this.myBits.clone();
bitSet.xor(other);
bitSet.and(other);
return bitSet.isEmpty();
}
for (Object o : collection) {
if (!contains(o)) return false;
}
return true;
}
代码示例来源:origin: vsch/flexmark-java
@Override
public boolean addAll(Collection<? extends Integer> collection) {
if (collection instanceof BitIntegerSet) {
BitSet other = ((BitIntegerSet) collection).myBits;
BitSet bitSet = (BitSet) this.myBits.clone();
myBits.or(other);
bitSet.xor(bitSet);
return !bitSet.isEmpty();
}
boolean changed = false;
for (Object o : collection) {
if (add((Integer) o)) changed = true;
}
return changed;
}
代码示例来源:origin: vsch/flexmark-java
@Override
public boolean retainAll(Collection<?> collection) {
BitSet other;
if (!(collection instanceof BitSet)) {
other = new BitSet();
for (Object o : collection) {
if (contains(o)) {
other.set((Integer) o);
}
}
} else {
other = (BitSet) collection;
}
BitSet bitSet = (BitSet) this.myBits.clone();
myBits.and(other);
bitSet.xor(bitSet);
return !bitSet.isEmpty();
}
代码示例来源:origin: vsch/flexmark-java
@Override
public boolean removeAll(Collection<?> collection) {
if (collection instanceof BitIntegerSet) {
BitSet other = ((BitIntegerSet) collection).myBits;
BitSet bitSet = (BitSet) this.myBits.clone();
myBits.andNot(other);
bitSet.xor(bitSet);
return !bitSet.isEmpty();
}
boolean changed = false;
for (Object o : collection) {
if (contains(o)) {
myBits.clear((Integer) o);
changed = true;
}
}
return changed;
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
public void xor(final Filter filter) {
if (filter == null || !(filter instanceof BloomFilter) || filter.vectorSize != this.vectorSize
|| filter.nbHash != this.nbHash) {
throw new IllegalArgumentException("filters cannot be xor-ed");
}
bits.xor(((BloomFilter) filter).bits);
}
代码示例来源:origin: mayconbordin/streaminer
@Override
public void xor(AbstractFilter filter) {
if(filter == null
|| !(filter instanceof BloomFilter)
|| filter.vectorSize != this.vectorSize
|| filter.nbHash != this.nbHash) {
throw new IllegalArgumentException("filters cannot be xor-ed");
}
bits.xor(((BloomFilter) filter).bits);
}
代码示例来源:origin: codeminders/javadrone
private static void printBitSetDiff(BitSet current, BitSet old)
{
if(current.length() != old.length())
{
System.err.println("BitSet size does not match!");
return;
}
BitSet diff = (BitSet) current.clone();
diff.xor(old);
System.err.println(diff);
}
代码示例来源:origin: google/closure-templates
void verify() {
checkState(delayReleaseClaims == 0, "%s lazy scope(s) are still active", delayReleaseClaims);
checkState(slotsToRelease.isEmpty(), "%s slots are waiting to be released", slotsToRelease);
BitSet unavailableSlots = new BitSet(nextSlotToClaim);
unavailableSlots.set(0, nextSlotToClaim);
// now the only bits on will be the ones where available slots has '0'.
unavailableSlots.xor(availableSlots);
checkState(
unavailableSlots.isEmpty(), "Expected all slots to be available: %s", unavailableSlots);
}
}
代码示例来源:origin: io.brooklyn/brooklyn-utils-common
/** represents the result of this bit list logically XORred with the other */
public BitList xorred(BitList other) {
BitSet result = asBitSet();
result.xor(other.asBitSet());
return new BitList(result, Math.max(length, other.length));
}
内容来源于网络,如有侵权,请联系作者删除!