本文整理了Java中org.apache.commons.lang3.mutable.MutableBoolean.<init>()
方法的一些代码示例,展示了MutableBoolean.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MutableBoolean.<init>()
方法的具体详情如下:
包路径:org.apache.commons.lang3.mutable.MutableBoolean
类名称:MutableBoolean
方法名:<init>
[英]Constructs a new MutableBoolean with the default value of false.
[中]构造一个默认值为false的新可变布尔值。
代码示例来源:origin: neo4j/neo4j
private void logIndexProviderSummary( Map<IndexProviderDescriptor,List<IndexLogRecord>> indexProviders )
{
Set<String> deprecatedIndexProviders = Arrays.stream( GraphDatabaseSettings.SchemaIndex.values() )
.filter( GraphDatabaseSettings.SchemaIndex::deprecated )
.map( GraphDatabaseSettings.SchemaIndex::providerName )
.collect( Collectors.toSet() );
StringJoiner joiner = new StringJoiner( ", ", "Deprecated index providers in use: ",
". Use procedure 'db.indexes()' to see what indexes use which index provider." );
MutableBoolean anyDeprecated = new MutableBoolean();
indexProviders.forEach( ( indexProviderDescriptor, indexLogRecords ) ->
{
if ( deprecatedIndexProviders.contains( indexProviderDescriptor.name() ) )
{
anyDeprecated.setTrue();
int numberOfIndexes = indexLogRecords.size();
joiner.add( indexProviderDescriptor.name() + " (" + numberOfIndexes + (numberOfIndexes == 1 ? " index" : " indexes") + ")" );
}
} );
if ( anyDeprecated.getValue() )
{
userLog.info( joiner.toString() );
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test(expected=NullPointerException.class)
public void testConstructorNull() {
new MutableBoolean(null);
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testCompareTo() {
final MutableBoolean mutBool = new MutableBoolean(false);
assertEquals(0, mutBool.compareTo(new MutableBoolean(false)));
assertEquals(-1, mutBool.compareTo(new MutableBoolean(true)));
mutBool.setValue(true);
assertEquals(+1, mutBool.compareTo(new MutableBoolean(false)));
assertEquals(0, mutBool.compareTo(new MutableBoolean(true)));
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test(expected=NullPointerException.class)
public void testCompareToNull() {
final MutableBoolean mutBool = new MutableBoolean(false);
mutBool.compareTo(null);
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test(expected=NullPointerException.class)
public void testSetNull() {
final MutableBoolean mutBool = new MutableBoolean(false);
mutBool.setValue(null);
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testToString() {
assertEquals(Boolean.FALSE.toString(), new MutableBoolean(false).toString());
assertEquals(Boolean.TRUE.toString(), new MutableBoolean(true).toString());
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testConstructors() {
assertFalse(new MutableBoolean().booleanValue());
assertTrue(new MutableBoolean(true).booleanValue());
assertFalse(new MutableBoolean(false).booleanValue());
assertTrue(new MutableBoolean(Boolean.TRUE).booleanValue());
assertFalse(new MutableBoolean(Boolean.FALSE).booleanValue());
}
代码示例来源:origin: neo4j/neo4j
/**
* @return true if instantiated tree needs to be rebuilt.
*/
private boolean instantiateTree() throws IOException
{
monitors.addMonitorListener( treeMonitor() );
GBPTree.Monitor monitor = monitors.newMonitor( GBPTree.Monitor.class );
MutableBoolean isRebuilding = new MutableBoolean();
Header.Reader readRebuilding =
headerData -> isRebuilding.setValue( headerData.get() == NEEDS_REBUILDING );
index = new GBPTree<>( pageCache, storeFile, new LabelScanLayout(), pageSize, monitor, readRebuilding,
needsRebuildingWriter, recoveryCleanupWorkCollector );
return isRebuilding.getValue();
}
代码示例来源:origin: Netflix/conductor
private boolean verifyTaskInputParameters(ConstraintValidatorContext context, WorkflowDef workflow) {
MutableBoolean valid = new MutableBoolean();
valid.setValue(true);
if (workflow.getTasks() == null) {
return valid.getValue();
}
workflow.getTasks()
.stream()
.filter(workflowTask -> workflowTask.getInputParameters() != null)
.forEach(workflowTask -> {
List<String> errors = ConstraintParamUtil.validateInputParam(workflowTask.getInputParameters(), workflowTask.getName(), workflow);
errors.forEach(message -> context.buildConstraintViolationWithTemplate(message).addConstraintViolation());
if(errors.size() > 0) {
valid.setValue(false);
}
});
return valid.getValue();
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testHashCode() {
final MutableBoolean mutBoolA = new MutableBoolean(false);
final MutableBoolean mutBoolB = new MutableBoolean(false);
final MutableBoolean mutBoolC = new MutableBoolean(true);
assertEquals(mutBoolA.hashCode(), mutBoolA.hashCode());
assertEquals(mutBoolA.hashCode(), mutBoolB.hashCode());
assertFalse(mutBoolA.hashCode() == mutBoolC.hashCode());
assertEquals(mutBoolA.hashCode(), Boolean.FALSE.hashCode());
assertEquals(mutBoolC.hashCode(), Boolean.TRUE.hashCode());
}
代码示例来源:origin: neo4j/neo4j
private Iterable<Path> internalPaths( Node start, Node end, boolean stopAsap )
{
lastMetadata = new Metadata();
if ( start.equals( end ) )
{
return filterPaths(Collections.singletonList( PathImpl.singular( start ) ));
}
Hits hits = new Hits();
Collection<Long> sharedVisitedRels = new HashSet<>();
MutableInt sharedFrozenDepth = new MutableInt( NULL ); // ShortestPathLengthSoFar
MutableBoolean sharedStop = new MutableBoolean();
MutableInt sharedCurrentDepth = new MutableInt( 0 );
try ( DirectionData startData = new DirectionData( start, sharedVisitedRels,
sharedFrozenDepth, sharedStop, sharedCurrentDepth, expander );
DirectionData endData = new DirectionData( end, sharedVisitedRels, sharedFrozenDepth,
sharedStop, sharedCurrentDepth, expander.reverse() ) )
{
while ( startData.hasNext() || endData.hasNext() )
{
goOneStep( startData, endData, hits, startData, stopAsap );
goOneStep( endData, startData, hits, startData, stopAsap );
}
Collection<Hit> least = hits.least();
return least != null ? filterPaths( hitsToPaths( least, start, end, stopAsap, maxResultCount ) ) : Collections.emptyList();
}
}
代码示例来源:origin: neo4j/neo4j
@Test
public void doNotVisitNotModifiedPropertiesOnModifiedNodes() throws ConstraintValidationException, CreateConstraintFailureException
{
state.nodeDoAddLabel( 5, 1 );
MutableBoolean labelsChecked = new MutableBoolean();
state.accept( new TxStateVisitor.Adapter()
{
@Override
public void visitNodeLabelChanges( long id, LongSet added, LongSet removed )
{
labelsChecked.setTrue();
assertEquals( 1, id );
assertEquals( 1, added.size() );
assertTrue( added.contains( 5 ) );
assertTrue( removed.isEmpty() );
}
@Override
public void visitNodePropertyChanges( long id, Iterator<StorageProperty> added, Iterator<StorageProperty> changed, IntIterable removed )
{
fail( "Properties were not changed." );
}
} );
assertTrue( labelsChecked.booleanValue() );
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testEquals() {
final MutableBoolean mutBoolA = new MutableBoolean(false);
final MutableBoolean mutBoolB = new MutableBoolean(false);
final MutableBoolean mutBoolC = new MutableBoolean(true);
assertTrue(mutBoolA.equals(mutBoolA));
assertTrue(mutBoolA.equals(mutBoolB));
assertTrue(mutBoolB.equals(mutBoolA));
assertTrue(mutBoolB.equals(mutBoolB));
assertFalse(mutBoolA.equals(mutBoolC));
assertFalse(mutBoolB.equals(mutBoolC));
assertTrue(mutBoolC.equals(mutBoolC));
assertFalse(mutBoolA.equals(null));
assertFalse(mutBoolA.equals(Boolean.FALSE));
assertFalse(mutBoolA.equals("false"));
}
代码示例来源:origin: neo4j/neo4j
@Test
public void doNotVisitNotModifiedLabelsOnModifiedNodes() throws ConstraintValidationException, CreateConstraintFailureException
{
state.nodeDoAddProperty( 1, 2, stringValue( "propertyValue" ) );
MutableBoolean propertiesChecked = new MutableBoolean();
state.accept( new TxStateVisitor.Adapter()
{
@Override
public void visitNodeLabelChanges( long id, LongSet added, LongSet removed )
{
fail( "Labels were not changed." );
}
@Override
public void visitNodePropertyChanges( long id, Iterator<StorageProperty> added, Iterator<StorageProperty> changed, IntIterable removed )
{
propertiesChecked.setTrue();
assertEquals( 1, id );
assertFalse( changed.hasNext() );
assertTrue( removed.isEmpty() );
assertEquals( 1, Iterators.count( added, Predicates.alwaysTrue() ) );
}
} );
assertTrue( propertiesChecked.booleanValue() );
}
代码示例来源:origin: neo4j/neo4j
@Test
void shouldCatchupRootWhenRootNodeHasTooNewGeneration() throws Exception
{
// given
long id = cursor.getCurrentPageId();
long generation = TreeNode.generation( cursor );
MutableBoolean triggered = new MutableBoolean( false );
Supplier<Root> rootCatchup = () ->
{
triggered.setTrue();
return new Root( id, generation );
};
// when
//noinspection EmptyTryBlock
try ( SeekCursor<KEY,VALUE> ignored = new SeekCursor<>( cursor, node, key( 0 ), key( 1 ), layout,
stableGeneration, unstableGeneration, generationSupplier, rootCatchup, generation - 1,
exceptionDecorator, 1 ) )
{
// do nothing
}
// then
assertTrue( triggered.getValue() );
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testGetSet() {
assertFalse(new MutableBoolean().booleanValue());
assertEquals(Boolean.FALSE, new MutableBoolean().getValue());
final MutableBoolean mutBool = new MutableBoolean(false);
assertEquals(Boolean.FALSE, mutBool.toBoolean());
assertFalse(mutBool.booleanValue());
assertTrue(mutBool.isFalse());
assertFalse(mutBool.isTrue());
mutBool.setValue(Boolean.TRUE);
assertEquals(Boolean.TRUE, mutBool.toBoolean());
assertTrue(mutBool.booleanValue());
assertFalse(mutBool.isFalse());
assertTrue(mutBool.isTrue());
mutBool.setValue(false);
assertFalse(mutBool.booleanValue());
mutBool.setValue(true);
assertTrue(mutBool.booleanValue());
mutBool.setFalse();
assertFalse(mutBool.booleanValue());
mutBool.setTrue();
assertTrue(mutBool.booleanValue());
}
代码示例来源:origin: neo4j/neo4j
final MutableBoolean fired = new MutableBoolean();
FileSystemAbstraction fs = new DelegatingFileSystemAbstraction( efs.get() )
代码示例来源:origin: neo4j/neo4j
MutableBoolean throwException = new MutableBoolean( true );
FileSystemAbstraction fs = new DelegatingFileSystemAbstraction( this.fs )
代码示例来源:origin: neo4j/neo4j
MutableBoolean triggered = new MutableBoolean( false );
long rightChild = 999; // We don't care
代码示例来源:origin: neo4j/neo4j
MutableBoolean triggered = new MutableBoolean( false );
long oldRightChild = 666; // We don't care
内容来源于网络,如有侵权,请联系作者删除!