本文整理了Java中java.util.BitSet.set()
方法的一些代码示例,展示了BitSet.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.set()
方法的具体详情如下:
包路径:java.util.BitSet
类名称:BitSet
方法名:set
[英]Sets the bit at index index to true.
[中]将索引处的位设置为true。
代码示例来源:origin: netty/netty
public void setCleanerFlag(int index) {
if (cleanerFlags == null) {
cleanerFlags = new BitSet();
}
cleanerFlags.set(index);
}
}
代码示例来源:origin: jenkinsci/jenkins
public ArgumentListBuilder prepend(String... args) {
// left-shift the mask
BitSet nm = new BitSet(this.args.size()+args.length);
for(int i=0; i<this.args.size(); i++)
nm.set(i+args.length, mask.get(i));
mask = nm;
this.args.addAll(0, Arrays.asList(args));
return this;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Optionally hide this part of the command line from being printed to the log.
* @param a a command argument
* @param mask true to suppress in output, false to print normally
* @return this
* @see hudson.Launcher.ProcStarter#masks(boolean[])
* @see Launcher#maskedPrintCommandLine(List, boolean[], FilePath)
* @since 1.378
*/
public ArgumentListBuilder add(String a, boolean mask) {
if(a!=null) {
if(mask) {
this.mask.set(args.size());
}
args.add(a);
}
return this;
}
代码示例来源:origin: apache/zeppelin
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, getProgress_result struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetSuccess()) {
oprot.writeI32(struct.success);
}
}
代码示例来源:origin: skylot/jadx
public static BitSet blocksToBitSet(MethodNode mth, List<BlockNode> blocks) {
BitSet bs = new BitSet(mth.getBasicBlocks().size());
for (BlockNode block : blocks) {
bs.set(block.getId());
}
return bs;
}
代码示例来源:origin: spring-projects/spring-framework
private void setMonths(BitSet bits, String value) {
int max = 12;
value = replaceOrdinals(value, "FOO,JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC");
BitSet months = new BitSet(13);
// Months start with 1 in Cron and 0 in Calendar, so push the values first into a longer bit set
setNumberHits(months, value, 1, max + 1);
// ... and then rotate it to the front of the months
for (int i = 1; i <= max; i++) {
if (months.get(i)) {
bits.set(i - 1);
}
}
}
代码示例来源:origin: apache/zookeeper
public synchronized boolean add(Integer elementBit) {
if (elementBit == null || elementBits.get(elementBit)) {
return false;
}
if (cache.size() < cacheSize) {
cache.add(elementBit);
}
elementBits.set(elementBit);
elementCount++;
return true;
}
代码示例来源:origin: apache/zeppelin
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, appendOutput_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetEvent()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetEvent()) {
struct.event.write(oprot);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, removeNimbus_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetNumber()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetNumber()) {
oprot.writeI32(struct.number);
}
}
代码示例来源:origin: skylot/jadx
if (s.getIDom() != block) {
if (domFrontier == null) {
domFrontier = new BitSet(blocks.size());
domFrontier.set(s.getId());
if (blocks.get(p).getIDom() != block) {
if (domFrontier == null) {
domFrontier = new BitSet(blocks.size());
domFrontier.set(p);
代码示例来源:origin: skylot/jadx
private static void placePhi(MethodNode mth, int regNum, LiveVarAnalysis la) {
List<BlockNode> blocks = mth.getBasicBlocks();
int blocksCount = blocks.size();
BitSet hasPhi = new BitSet(blocksCount);
BitSet processed = new BitSet(blocksCount);
Deque<BlockNode> workList = new LinkedList<>();
BitSet assignBlocks = la.getAssignBlocks(regNum);
for (int id = assignBlocks.nextSetBit(0); id >= 0; id = assignBlocks.nextSetBit(id + 1)) {
processed.set(id);
workList.add(blocks.get(id));
}
while (!workList.isEmpty()) {
BlockNode block = workList.pop();
BitSet domFrontier = block.getDomFrontier();
for (int id = domFrontier.nextSetBit(0); id >= 0; id = domFrontier.nextSetBit(id + 1)) {
if (!hasPhi.get(id) && la.isLive(id, regNum)) {
BlockNode df = blocks.get(id);
addPhi(mth, df, regNum);
hasPhi.set(id);
if (!processed.get(id)) {
processed.set(id);
workList.add(df);
}
}
}
}
}
代码示例来源:origin: commons-collections/commons-collections
/**
* Add a Comparator to the end of the chain using the
* given sort order
*
* @param comparator Comparator to add to the end of the chain
* @param reverse false = forward sort order; true = reverse sort order
*/
public void addComparator(Comparator comparator, boolean reverse) {
checkLocked();
comparatorChain.add(comparator);
if (reverse == true) {
orderingBits.set(comparatorChain.size() - 1);
}
}
代码示例来源:origin: apache/kylin
@Override
public BitSet copy(final Kryo kryo, final BitSet original) {
final BitSet result = new BitSet();
final int length = original.length();
for (int i = 0; i < length; i++) {
result.set(i, original.get(i));
}
return result;
}
代码示例来源:origin: neo4j/neo4j
private static void addToSeenList( BitSet target, long id, long lastId )
{
int index = toIntExact( id );
if ( target.get( index ) )
{
throw new IllegalStateException( id + " already seen" );
}
if ( id > lastId )
{
throw new IllegalStateException( "Unexpectedly high id " + id + " seen when last id is " + lastId );
}
target.set( index );
}
代码示例来源:origin: redisson/redisson
public void setCleanerFlag(int index) {
if (cleanerFlags == null) {
cleanerFlags = new BitSet();
}
cleanerFlags.set(index);
}
}
代码示例来源:origin: apache/zeppelin
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, updateAllOutput_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetEvent()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetEvent()) {
struct.event.write(oprot);
}
}
代码示例来源:origin: apache/zeppelin
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, getStatus_result struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetSuccess()) {
oprot.writeString(struct.success);
}
}
代码示例来源:origin: apache/storm
@Override
public void write(org.apache.storm.thrift.protocol.TProtocol prot, TopologyHistoryInfo struct) throws org.apache.storm.thrift.TException {
org.apache.storm.thrift.protocol.TTupleProtocol oprot = (org.apache.storm.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet optionals = new java.util.BitSet();
if (struct.is_set_topo_ids()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.is_set_topo_ids()) {
{
oprot.writeI32(struct.topo_ids.size());
for (java.lang.String _iter866 : struct.topo_ids)
{
oprot.writeString(_iter866);
}
}
}
}
代码示例来源:origin: skylot/jadx
private static void test(MethodNode mth, int regNum, LiveVarAnalysis la) {
List<BlockNode> blocks = mth.getBasicBlocks();
int blocksCount = blocks.size();
BitSet hasPhi = new BitSet(blocksCount);
BitSet processed = new BitSet(blocksCount);
Deque<BlockNode> workList = new LinkedList<>();
BitSet assignBlocks = la.getAssignBlocks(regNum);
for (int id = assignBlocks.nextSetBit(0); id >= 0; id = assignBlocks.nextSetBit(id + 1)) {
processed.set(id);
workList.add(blocks.get(id));
}
while (!workList.isEmpty()) {
BlockNode block = workList.pop();
BitSet domFrontier = block.getDomFrontier();
for (int id = domFrontier.nextSetBit(0); id >= 0; id = domFrontier.nextSetBit(id + 1)) {
if (!hasPhi.get(id) && la.isLive(id, regNum)) {
BlockNode df = blocks.get(id);
addPhi(df, regNum);
hasPhi.set(id);
if (!processed.get(id)) {
processed.set(id);
workList.add(df);
}
}
}
}
}
代码示例来源:origin: apache/ignite
/**
* @param idx Node index.
* @param res Success flag.
*/
private void receivedConnectionStatus(int idx, boolean res) {
assert resCntr.get() < nodes.size();
synchronized (resBitSet) {
resBitSet.set(idx, res);
}
if (resCntr.incrementAndGet() == nodes.size())
onDone(resBitSet);
}
内容来源于网络,如有侵权,请联系作者删除!