org.apache.commons.lang.mutable.MutableBoolean类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中org.apache.commons.lang.mutable.MutableBoolean类的一些代码示例,展示了MutableBoolean类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MutableBoolean类的具体详情如下:
包路径:org.apache.commons.lang.mutable.MutableBoolean
类名称:MutableBoolean

MutableBoolean介绍

[英]A mutable boolean wrapper.
[中]一个可变的boolean包装器。

代码示例

代码示例来源:origin: commons-lang/commons-lang

/**
 * Sets the value from any Boolean instance.
 * 
 * @param value  the value to set, not null
 * @throws NullPointerException if the object is null
 */
public void setValue(Object value) {
  setValue(((Boolean) value).booleanValue());
}

代码示例来源:origin: apache/drill

protected static ASTNode rewriteGroupingFunctionAST(final List<ASTNode> grpByAstExprs, ASTNode targetNode,
    final boolean noneSet) throws SemanticException {
 final MutableBoolean visited = new MutableBoolean(false);
 final MutableBoolean found = new MutableBoolean(false);
 if (visited.booleanValue() && !found.booleanValue()) {
  throw new SemanticException(ErrorMsg.HIVE_GROUPING_FUNCTION_EXPR_NOT_IN_GROUPBY.getMsg());

代码示例来源:origin: apache/incubator-druid

MutableBoolean firstAttempt = new MutableBoolean(true);
Map<String, LookupExtractorFactoryContainer> lookupMap = RetryUtils.retry(
  () -> {
   if (firstAttempt.isTrue()) {
    firstAttempt.setValue(false);
   } else if (lookupConfig.getCoordinatorRetryDelay() > 0) {

代码示例来源:origin: Evolveum/midpoint

public static boolean hasAllDefinitions(ObjectFilter filter) {
  final MutableBoolean hasAllDefinitions = new MutableBoolean(true);
  Visitor visitor = f -> {
    if (f instanceof ValueFilter) {
      ItemDefinition definition = ((ValueFilter<?,?>) f).getDefinition();
      if (definition == null) {
        hasAllDefinitions.setValue(false);
      }
    }
  };
  filter.accept(visitor);
  return hasAllDefinitions.booleanValue();
}

代码示例来源:origin: org.apache.bookkeeper/bookkeeper-server

@Override
  public void process(long ledgerId, long entryStartPos, ByteBuf entry) {
    if (!stopScanning.booleanValue()) {
      if ((rangeEndPos != -1) && (entryStartPos > rangeEndPos)) {
        stopScanning.setValue(true);
      } else {
        int entrySize = entry.readableBytes();
        /**
         * entrySize of an entry (inclusive of payload and
         * header) value is stored as int value in log file, but
         * it is not counted in the entrySize, hence for calculating
         * the end position of the entry we need to add additional
         * 4 (intsize of entrySize). Please check
         * EntryLogger.scanEntryLog.
         */
        long entryEndPos = entryStartPos + entrySize + 4 - 1;
        if (((rangeEndPos == -1) || (entryStartPos <= rangeEndPos)) && (rangeStartPos <= entryEndPos)) {
          formatEntry(entryStartPos, entry, printMsg);
          entryFound.setValue(true);
        }
      }
    }
  }
});

代码示例来源:origin: commons-lang/commons-lang

/**
 * Compares this object to the specified object. The result is <code>true</code> if and only if the argument is
 * not <code>null</code> and is an <code>MutableBoolean</code> object that contains the same
 * <code>boolean</code> value as this object.
 * 
 * @param obj  the object to compare with, null returns false
 * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
 */
public boolean equals(Object obj) {
  if (obj instanceof MutableBoolean) {
    return value == ((MutableBoolean) obj).booleanValue();
  }
  return false;
}

代码示例来源:origin: voldemort/voldemort

vals1 = pruneAndResolve(vals1, new MutableBoolean());
assertEquals("Must have one winning version", 1, vals1.size());
assertEquals("Must resolve to onlineClock", onlineClock1, vals1.get(0).getVersion());

代码示例来源:origin: stackoverflow.com

List<YourClass> someList = new ArrayList<>();
 MutableBoolean result = new MutableBoolean(true);
 someList.stream().map(YourClass::getBooleanMember).forEach(b -> result.setValue(result.getValue() && b));

代码示例来源:origin: naver/ngrinder

final MutableBoolean safeDist = new MutableBoolean(safe);
ConsoleProperties consoleComponent = getConsoleComponent(ConsoleProperties.class);
final File file = consoleComponent.getDistributionDirectory().getFile();
    if (safeDist.isTrue()) {
if (safeDist.isFalse()) {
  ThreadUtils.sleep(1000);
  checkSafetyWithCacheState(fileDistribution, cacheStateCondition, fileCount);

代码示例来源:origin: naver/ngrinder

GrinderProperties properties = new GrinderProperties(scriptFile);
properties.setAssociatedFile(new File("long-time-prepare-test.properties"));
final MutableBoolean timeouted = new MutableBoolean(false);
console1.addListener(new SingleConsole.ConsoleShutdownListener() {
  @Override
console1.startTest(properties);
for (int i = 0; i < 20; i++) {
  if (timeouted.isTrue()) {
    break;
assertTrue(timeouted.isTrue());

代码示例来源:origin: stackoverflow.com

private static boolean lineExists(Optional<List<Map<String, Map<String, List<Map<String, String>>>>>> ordersOrNull, Line lineItem) {
 final String LINE_ITEMS = "lineItems";
 final String ELEMENTS = "elements";
 final String NOTE = "note";
 MutableBoolean exists = new MutableBoolean(false);

 // if there is no order payload then the order hasn't already been posted so there can't be a duplicate line item
 ordersOrNull.ifPresent(orders -> {
  orders.stream().filter(order -> order.containsKey(LINE_ITEMS))
   .map(order -> order.get(LINE_ITEMS))
   .filter(lineItems -> lineItems.containsKey(ELEMENTS))
   .flatMap(lineItems -> lineItems.get(ELEMENTS).stream())
   .filter(element -> element.containsKey(NOTE) && element.get(NOTE).contains(lineItem.getNote()))
   .map(existingLine  -> existingLine.get(NOTE))
   .findAny()
   .ifPresent(n -> {
    System.out.println(String.format("Line item with note containing %s already exists in order.", lineItem.getNote()));
    exists.set();
  });
 });
 return exists.get();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@Override
 public Boolean get() {
  final MutableBoolean result = new MutableBoolean(false);
  cache.accept(new CacheVisitor() {
   @Override
   public void visit(int numOutstandingMmaps,
     Map<ExtendedBlockId, ShortCircuitReplica> replicas,
     Map<ExtendedBlockId, InvalidToken> failedLoads,
     Map<Long, ShortCircuitReplica> evictable,
     Map<Long, ShortCircuitReplica> evictableMmapped) {
    Assert.assertEquals(expectedOutstandingMmaps, numOutstandingMmaps);
    ShortCircuitReplica replica =
      replicas.get(ExtendedBlockId.fromExtendedBlock(block));
    Assert.assertNotNull(replica);
    Slot slot = replica.getSlot();
    if ((expectedIsAnchorable != slot.isAnchorable()) ||
      (expectedIsAnchored != slot.isAnchored())) {
     LOG.info("replica " + replica + " has isAnchorable = " +
      slot.isAnchorable() + ", isAnchored = " + slot.isAnchored() + 
      ".  Waiting for isAnchorable = " + expectedIsAnchorable + 
      ", isAnchored = " + expectedIsAnchored);
     return;
    }
    result.setValue(true);
   }
  });
  return result.toBoolean();
 }
}, 10, 60000);

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

replicaInfo1.getReplica().getMetaStream());
replicaInfo1.getReplica().unref();
final MutableBoolean triedToCreate = new MutableBoolean(false);
do {
 Thread.sleep(10);
  replicaInfo2.getReplica().unref();
} while (triedToCreate.isFalse());
cache.close();

代码示例来源:origin: PhoenicisOrg/phoenicis

@Override
public void run() {
  while (running.isTrue()) {
    for (ExecutorService executorServiceToWatch : poolsToObserve) {
      final ControlledThreadPoolExecutorService pool = (ControlledThreadPoolExecutorService) executorServiceToWatch;

代码示例来源:origin: Evolveum/midpoint

MutableBoolean isAcceptable = new MutableBoolean(true);
for (ProhibitedValueItemType prohibitedItemType: prohibitedValuesType.getItem()) {
        failAction.accept(prohibitedItemType);
      isAcceptable.setValue(false);
      return false;
return isAcceptable.booleanValue();

代码示例来源:origin: org.integratedmodelling/klab-common

/**
 * Get the dimensional offsets for the passed full offset.
 * 
 * @param nonTemporalOffset
 * @return
 */
protected int[] getOffsets(int offset, MutableBoolean nodata) {
  int[] extentOffsets = scale.getCursor().getElementIndexes(offset);
  int[] dimensionOffsets = new int[dimensionCount];
  int eIdx = 0, dIdx = 0;
  nodata.setValue(false);
  for (IExtent ext : scale) {
    for (int o : ext.getDimensionOffsets(extentOffsets[eIdx], true)) {
      dimensionOffsets[dIdx++] = o;
    }
    if (!nodata.booleanValue()) {
      nodata.setValue(!ext.isCovered(extentOffsets[eIdx]));
    }
    eIdx++;
  }
  return dimensionOffsets;
}

代码示例来源:origin: org.apache.bookkeeper/bookkeeper-server

@Override
public boolean accept(long ledgerId) {
  return !stopScanning.booleanValue();
}

代码示例来源:origin: stackoverflow.com

...
final MutableBoolean finished = new MutableBoolean(false);
new Thread(new Runnable(){
  public void run() {
    doComplicatedStuff(finished);
  }
}).start();

Thread.sleep(4000);
finished.setValue(true);

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

final MutableBoolean calledCreate = new MutableBoolean(false);
replicaInfos[0] = cache.fetchOrCreate(
  new ExtendedBlockId(0, "test_bp1"),
Assert.assertTrue(calledCreate.isTrue());

代码示例来源:origin: voldemort/voldemort

List<Versioned<byte[]>> vals = lockHandle.getValues();
List<Integer> keyReplicas = routingPlan.getReplicationNodeList(routingPlan.getMasterPartitionId(key.get()));
MutableBoolean didPrune = new MutableBoolean(false);
List<Versioned<byte[]>> prunedVals = pruneNonReplicaEntries(vals,
                              keyReplicas,
if(didPrune.booleanValue()) {
  List<Versioned<byte[]>> resolvedVals = VectorClockUtils.resolveVersions(prunedVals);

相关文章