本文整理汇总了Java中org.apache.commons.lang.mutable.MutableBoolean类的典型用法代码示例。如果您正苦于以下问题:Java MutableBoolean类的具体用法?Java MutableBoolean怎么用?Java MutableBoolean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MutableBoolean类属于org.apache.commons.lang.mutable包,在下文中一共展示了MutableBoolean类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyFilters
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
private void applyFilters(ScanTreeNode unfilteredRoot, ScanTreeNode issuesFilteredRoot, ScanTreeNode licenseFilteredRoot, MutableBoolean severitySelected, MutableBoolean licenseSelected) {
severitySelected.setValue(isSeveritySelected(unfilteredRoot));
licenseSelected.setValue(isLicenseSelected(unfilteredRoot));
for (int i = 0; i < unfilteredRoot.getChildCount(); i++) {
ScanTreeNode unfilteredChild = (ScanTreeNode) unfilteredRoot.getChildAt(i);
ScanTreeNode filteredSeverityChild = getFilteredTreeNode(unfilteredChild);
ScanTreeNode filteredLicenseChild = (ScanTreeNode) unfilteredChild.clone();
MutableBoolean childSeveritySelected = new MutableBoolean();
MutableBoolean childLicenseSelected = new MutableBoolean();
applyFilters(unfilteredChild, filteredSeverityChild, filteredLicenseChild, childSeveritySelected, childLicenseSelected);
if (childSeveritySelected.booleanValue()) {
severitySelected.setValue(true);
issuesFilteredRoot.add(filteredSeverityChild);
}
if (childLicenseSelected.booleanValue()) {
licenseSelected.setValue(true);
licenseFilteredRoot.add(filteredLicenseChild);
}
}
}
示例2: allocSlot
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
public Slot allocSlot(DatanodeInfo datanode, DomainPeer peer,
MutableBoolean usedPeer, ExtendedBlockId blockId,
String clientName) throws IOException {
lock.lock();
try {
if (closed) {
LOG.trace(this + ": the DfsClientShmManager isclosed.");
return null;
}
EndpointShmManager shmManager = datanodes.get(datanode);
if (shmManager == null) {
shmManager = new EndpointShmManager(datanode);
datanodes.put(datanode, shmManager);
}
return shmManager.allocSlot(peer, usedPeer, clientName, blockId);
} finally {
lock.unlock();
}
}
示例3: getTaxEnt
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
@Override
public List<TaxEnt> getTaxEnt(TaxEnt q, MutableBoolean askQuestion) throws FloraOnException {
// TODO when imported name has not subsp., doesn't work, e.g. cistus ladanifer sulcatus
if(q.getName() == null || q.getName().equals("")) throw new QueryException("Invalid blank name.");
ArangoCursor<TaxEnt> cursor;
String query = AQLQueries.getString("NodeWorkerDriver.12", q.getName().substring(0, 3));
// FIXME: when no rank is specified!
try {
cursor = database.query(query, null, null, TaxEnt.class);
if(!cursor.hasNext()) // node does not exist
return Collections.emptyList();
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
return matchTaxEntToTaxEntList(q, cursor, askQuestion);
}
示例4: SwingView
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
/**
* Constructor
*/
public SwingView() {
super(FRAME_TITLE);
// Content
this.cardDialog = new CardPlayDialog(this);
this.deckButton = new DeckButton();
this.discardPileButtons = new HashMap<Suit, DiscardPileButton>();
this.playerOneExpeditionLabels = new HashMap<Suit, ExpedLabel>();
this.playerOneTotalLabel = new JLabel();
this.playerTwoExpeditionLabels = new HashMap<Suit, ExpedLabel>();
this.playerTwoTotalLabel = new JLabel();
this.playerTwoHandButtons = new HandButton[Hand.LIMIT];
this.popupExpedMenu = new JPopupMenu();
this.popupExpedMenu.setEnabled(false);
this.showRunningScores = new MutableBoolean(true);
this.statusBar = new JLabel();
// Menu Bar
menuBar = new MenuBar(this.showRunningScores);
menuBar.addShowRunningScoresListener(new ShowRunningScoresListener());
setJMenuBar(menuBar);
// Only adding one component to this frame allows it to have a border
add(getFramePanel());
setResizable(false);
pack();
setLocationRelativeTo(null);
}
示例5: waitForReplicaAnchorStatus
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
private void waitForReplicaAnchorStatus(final ShortCircuitCache cache,
final ExtendedBlock block, final boolean expectedIsAnchorable,
final boolean expectedIsAnchored, final int expectedOutstandingMmaps)
throws Exception {
GenericTestUtils.waitFor(new Supplier<Boolean>() {
@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);
}
示例6: testExpiry
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
@Test(timeout=60000)
public void testExpiry() throws Exception {
final ShortCircuitCache cache =
new ShortCircuitCache(2, 1, 1, 10000000, 1, 10000000, 0);
final TestFileDescriptorPair pair = new TestFileDescriptorPair();
ShortCircuitReplicaInfo replicaInfo1 =
cache.fetchOrCreate(
new ExtendedBlockId(123, "test_bp1"),
new SimpleReplicaCreator(123, cache, pair));
Preconditions.checkNotNull(replicaInfo1.getReplica());
Preconditions.checkState(replicaInfo1.getInvalidTokenException() == null);
pair.compareWith(replicaInfo1.getReplica().getDataStream(),
replicaInfo1.getReplica().getMetaStream());
replicaInfo1.getReplica().unref();
final MutableBoolean triedToCreate = new MutableBoolean(false);
do {
Thread.sleep(10);
ShortCircuitReplicaInfo replicaInfo2 =
cache.fetchOrCreate(
new ExtendedBlockId(123, "test_bp1"), new ShortCircuitReplicaCreator() {
@Override
public ShortCircuitReplicaInfo createShortCircuitReplicaInfo() {
triedToCreate.setValue(true);
return null;
}
});
if ((replicaInfo2 != null) && (replicaInfo2.getReplica() != null)) {
replicaInfo2.getReplica().unref();
}
} while (triedToCreate.isFalse());
cache.close();
}
示例7: handleThrowable
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
public void handleThrowable(Throwable t1, ServerName serverName,
MutableBoolean couldNotCommunicateWithServer) throws IOException {
Throwable t2 = translateException(t1);
boolean isLocalException = !(t2 instanceof RemoteException);
if (isLocalException && isConnectionException(t2)) {
couldNotCommunicateWithServer.setValue(true);
handleFailureToServer(serverName, t2);
}
}
示例8: addToken
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
private void addToken(TokenGroup group, int start, int end, String charString, MutableBoolean isNewLine,
Token lastToken) {
Token token = new Token(start, end, charString);
if (isNewLine.booleanValue()) {
group.addNewLine(start);
isNewLine.setValue(false);
}
token.setPreceedBySpace(start - lastToken.getEnd() > 0);
int spaces = 0;
if (lastToken != null && lastToken.getEnd() != 0) {
int endLast = lastToken.getEnd();
spaces = lastToken.getSpaceOffset();
if (start == endLast) {
spaces++;
} else {
spaces -= Math.max(0, start - endLast - 1);
}
}
token.setSpaceOffset(spaces);
// Normalization
String n;
if (charString.length() == 1) {
int c = charString.charAt(0);
n = normalizedChars.get(c);
} else {
n = normalizedStrings.get(charString);
}
if (n != null) {
token.setNormForm(n);
}
lastToken.updateByToken(token);
group.addToken(token);
}
示例9: testExpiry
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
@Test(timeout=100000)
public void testExpiry() throws Exception {
final ShortCircuitCache cache =
new ShortCircuitCache(2, 1, 1, 10000000, 1, 10000000, 0);
final TestFileDescriptorPair pair = new TestFileDescriptorPair();
ShortCircuitReplicaInfo replicaInfo1 =
cache.fetchOrCreate(
new ExtendedBlockId(123, "test_bp1"),
new SimpleReplicaCreator(123, cache, pair));
Preconditions.checkNotNull(replicaInfo1.getReplica());
Preconditions.checkState(replicaInfo1.getInvalidTokenException() == null);
pair.compareWith(replicaInfo1.getReplica().getDataStream(),
replicaInfo1.getReplica().getMetaStream());
replicaInfo1.getReplica().unref();
final MutableBoolean triedToCreate = new MutableBoolean(false);
do {
Thread.sleep(10);
ShortCircuitReplicaInfo replicaInfo2 =
cache.fetchOrCreate(
new ExtendedBlockId(123, "test_bp1"), new ShortCircuitReplicaCreator() {
@Override
public ShortCircuitReplicaInfo createShortCircuitReplicaInfo() {
triedToCreate.setValue(true);
return null;
}
});
if ((replicaInfo2 != null) && (replicaInfo2.getReplica() != null)) {
replicaInfo2.getReplica().unref();
}
} while (triedToCreate.isFalse());
cache.close();
}
示例10: processAuthorizationContainerDelta
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
private <C extends Containerable> boolean processAuthorizationContainerDelta(ContainerDelta<C> cdelta, final Collection<ItemPath> allowedItems) {
final MutableBoolean itemDecision = new MutableBoolean(true);
cdelta.foreach(cval -> {
if (!isContainerAllowed(cval, allowedItems)) {
itemDecision.setValue(false);
}
});
return itemDecision.booleanValue();
}
示例11: readBlobFromRDD
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
@Override
protected FrameBlock readBlobFromRDD(RDDObject rdd, MutableBoolean status)
throws IOException
{
//note: the read of a frame block from an RDD might trigger
//lazy evaluation of pending transformations.
RDDObject lrdd = rdd;
//prepare return status (by default only collect)
status.setValue(false);
MetaDataFormat iimd = (MetaDataFormat) _metaData;
MatrixCharacteristics mc = iimd.getMatrixCharacteristics();
int rlen = (int)mc.getRows();
int clen = (int)mc.getCols();
//handle missing schema if necessary
ValueType[] lschema = (_schema!=null) ? _schema :
UtilFunctions.nCopies(clen>=1 ? (int)clen : 1, ValueType.STRING);
FrameBlock fb = null;
try {
//prevent unnecessary collect through rdd checkpoint
if( rdd.allowsShortCircuitCollect() ) {
lrdd = (RDDObject)rdd.getLineageChilds().get(0);
}
//collect frame block from binary block RDD
fb = SparkExecutionContext.toFrameBlock(lrdd, lschema, rlen, clen);
}
catch(DMLRuntimeException ex) {
throw new IOException(ex);
}
//sanity check correct output
if( fb == null )
throw new IOException("Unable to load frame from rdd.");
return fb;
}
示例12: checkProhibitedValues
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
private <O extends ObjectType, R extends ObjectType> boolean checkProhibitedValues(String newPassword, ProhibitedValuesType prohibitedValuesType, AbstractValuePolicyOriginResolver<O> originResolver,
Consumer<ProhibitedValueItemType> failAction, String shortDesc, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {
if (prohibitedValuesType == null || originResolver == null) {
return true;
}
MutableBoolean isAcceptable = new MutableBoolean(true);
for (ProhibitedValueItemType prohibitedItemType: prohibitedValuesType.getItem()) {
ItemPathType itemPathType = prohibitedItemType.getPath();
if (itemPathType == null) {
throw new SchemaException("No item path defined in prohibited item in "+shortDesc);
}
ItemPath itemPath = itemPathType.getItemPath();
ResultHandler<R> handler = (object, objectResult) -> {
PrismProperty<Object> objectProperty = object.findProperty(itemPath);
if (objectProperty == null) {
return true;
}
if (isMatching(newPassword, objectProperty)) {
if (failAction != null) {
failAction.accept(prohibitedItemType);
}
isAcceptable.setValue(false);
return false;
}
return true;
};
originResolver.resolve(handler, prohibitedItemType, shortDesc, task, result);
}
return isAcceptable.booleanValue();
}
示例13: registerTouchedListener
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
public boolean registerTouchedListener(final IModel<? extends TouchedListener> listener, String... wicketIdPrefixes) {
final MutableBoolean changed = new MutableBoolean(false);
doWithMatchingModels(new ModelCallback() {
@Override
public boolean doWithModel(TouchedListenerModelWrapper<?> model) {
if (model.registerTouchedListener(listener)) {
changed.setValue(true);
}
return true;
}
}, wicketIdPrefixes);
return changed.booleanValue();
}
示例14: unregisterTouchedListener
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
public boolean unregisterTouchedListener(final IModel<? extends TouchedListener> listener,
String... wicketIdPrefixes) {
final MutableBoolean changed = new MutableBoolean(false);
doWithMatchingModels(new ModelCallback() {
@Override
public boolean doWithModel(TouchedListenerModelWrapper<?> model) {
if (model.unregisterTouchedListener(listener)) {
changed.setValue(true);
}
return true;
}
}, wicketIdPrefixes);
return changed.booleanValue();
}
示例15: testExpiry
import org.apache.commons.lang.mutable.MutableBoolean; //导入依赖的package包/类
@Test(timeout=60000)
public void testExpiry() throws Exception {
final ShortCircuitCache cache =
new ShortCircuitCache(2, 1, 1, 10000000, 1, 10000, 0);
final TestFileDescriptorPair pair = new TestFileDescriptorPair();
ShortCircuitReplicaInfo replicaInfo1 =
cache.fetchOrCreate(
new ExtendedBlockId(123, "test_bp1"), new SimpleReplicaCreator(123, cache, pair));
Preconditions.checkNotNull(replicaInfo1.getReplica());
Preconditions.checkState(replicaInfo1.getInvalidTokenException() == null);
pair.compareWith(replicaInfo1.getReplica().getDataStream(),
replicaInfo1.getReplica().getMetaStream());
replicaInfo1.getReplica().unref();
final MutableBoolean triedToCreate = new MutableBoolean(false);
do {
Thread.sleep(10);
ShortCircuitReplicaInfo replicaInfo2 =
cache.fetchOrCreate(
new ExtendedBlockId(123, "test_bp1"), new ShortCircuitReplicaCreator() {
@Override
public ShortCircuitReplicaInfo createShortCircuitReplicaInfo() {
triedToCreate.setValue(true);
return null;
}
});
if ((replicaInfo2 != null) && (replicaInfo2.getReplica() != null)) {
replicaInfo2.getReplica().unref();
}
} while (triedToCreate.isFalse());
cache.close();
}