本文整理了Java中org.neo4j.helpers.collection.Visitor
类的一些代码示例,展示了Visitor
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Visitor
类的具体详情如下:
包路径:org.neo4j.helpers.collection.Visitor
类名称:Visitor
[英]A visitor to internalize iteration.
[中]使迭代内部化的访问者。
代码示例来源:origin: neo4j/neo4j
public void serialize( Collection<StorageCommand> commands ) throws IOException
{
for ( StorageCommand command : commands )
{
serializer.visit( command );
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public boolean accept( Visitor<StorageCommand,IOException> visitor ) throws IOException
{
for ( StorageCommand command : commands )
{
if ( visitor.visit( command ) )
{
return true;
}
}
return false;
}
代码示例来源:origin: neo4j/neo4j
/**
* Visits this store, and any other store managed by this store.
* TODO this could, and probably should, replace all override-and-do-the-same-thing-to-all-my-managed-stores
* methods like:
* {@link #makeStoreOk()},
* {@link #close()} (where that method could be deleted all together and do a visit in {@link #close()}),
* {@link #logIdUsage(Logger)},
* {@link #logVersions(Logger)}
* For a good samaritan to pick up later.
*/
void visitStore( Visitor<CommonAbstractStore<RECORD,HEADER>,RuntimeException> visitor )
{
visitor.visit( this );
}
代码示例来源:origin: neo4j/neo4j
/**
* Visit all locks.
* <p/>
* The supplied visitor may not block.
*
* @param visitor visitor for visiting each lock.
*/
public void accept( Visitor<RWLock,RuntimeException> visitor )
{
synchronized ( resourceLockMap )
{
for ( RWLock lock : resourceLockMap.values() )
{
if ( visitor.visit( lock ) )
{
break;
}
}
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public void run() throws IndexPopulationFailedKernelException
{
for ( EntityUpdates update : updates )
{
if ( stop )
{
return;
}
visitor.visit( update );
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public void run() throws IndexPopulationFailedKernelException
{
for ( EntityUpdates update : updates )
{
if ( stop )
{
return;
}
visitor.visit( update );
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public void acceptDiagnosticsVisitor( Object visitor )
{
Visitor<? super DiagnosticsProvider, ? extends RuntimeException> target =
Visitor.SafeGenerics.castOrNull( DiagnosticsProvider.class, RuntimeException.class, visitor );
if ( target != null )
{
for ( DiagnosticsProvider provider : providers )
{
target.visit( provider );
}
}
}
} );
代码示例来源:origin: neo4j/neo4j
private void scanAllFields( int pf_flags, Visitor<PageCursor,IOException> visitor )
{
try ( PageCursor cursor = pagedFile.io( 0, pf_flags ) )
{
if ( cursor.next() )
{
visitor.visit( cursor );
}
}
catch ( IOException e )
{
throw new UnderlyingStorageException( e );
}
}
代码示例来源:origin: neo4j/neo4j
private void writeSomeData( File file, Visitor<ByteBuffer, IOException> visitor ) throws IOException
{
try ( StoreChannel channel = fileSystemRule.get().open( file, OpenMode.READ_WRITE ) )
{
ByteBuffer buffer = ByteBuffer.allocate( 1024 );
visitor.visit( buffer );
buffer.flip();
channel.write( buffer );
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public boolean process( StorageNodeCursor cursor ) throws FAILURE
{
long[] labels = cursor.labels();
if ( labels.length == 0 && labelIds.length != 0 )
{
// This node has no labels at all
return false;
}
if ( labelUpdateVisitor != null )
{
// Notify the label update visitor
labelUpdateVisitor.visit( labelChanges( cursor.entityReference(), EMPTY_LONG_ARRAY, labels ) );
}
if ( propertyUpdatesVisitor != null && containsAnyEntityToken( labelIds, labels ) )
{
// Notify the property update visitor
EntityUpdates.Builder updates = EntityUpdates.forEntity( cursor.entityReference() ).withTokens( labels );
if ( hasRelevantProperty( cursor, updates ) )
{
return propertyUpdatesVisitor.visit( updates.build() );
}
}
return false;
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public <EXCEPTION extends Exception> void scanAllRecords( Visitor<RECORD,EXCEPTION> visitor ) throws EXCEPTION
{
try ( PageCursor cursor = openPageCursorForReading( 0 ) )
{
RECORD record = newRecord();
long highId = getHighId();
for ( long id = getNumberOfReservedLowIds(); id < highId; id++ )
{
getRecordByCursor( id, record, CHECK, cursor );
if ( record.inUse() )
{
visitor.visit( record );
}
}
}
}
代码示例来源:origin: neo4j/neo4j
@Override
protected boolean process( StorageRelationshipScanCursor cursor ) throws FAILURE
{
int reltype = cursor.type();
if ( propertyUpdatesVisitor != null && containsAnyEntityToken( relationshipTypeIds, reltype ) )
{
// Notify the property update visitor
EntityUpdates.Builder updates = EntityUpdates.forEntity( cursor.entityReference() ).withTokens( reltype );
if ( hasRelevantProperty( cursor, updates ) )
{
return propertyUpdatesVisitor.visit( updates.build() );
}
}
return false;
}
}
代码示例来源:origin: neo4j/neo4j
NodeRecord after = new NodeRecord( nodeId );
after.setInUse( true );
visitor.visit( new Command.NodeCommand( new NodeRecord( nodeId ), after ) );
return null;
} );
代码示例来源:origin: neo4j/neo4j
private boolean visitPropertyRecordChain( long firstPropertyRecordId, Visitor<PropertyRecord,RuntimeException> visitor )
throws CircularPropertyRecordChainException
{
if ( Record.NO_NEXT_PROPERTY.is( firstPropertyRecordId ) )
{
return false;
}
MutableLongSet visitedPropertyRecordIds = new LongHashSet( 8 );
visitedPropertyRecordIds.add( firstPropertyRecordId );
long nextProp = firstPropertyRecordId;
while ( !Record.NO_NEXT_PROPERTY.is( nextProp ) )
{
PropertyRecord propRecord = propertyStore.getRecord( nextProp, propertyStore.newRecord(), FORCE );
nextProp = propRecord.getNextProp();
if ( !Record.NO_NEXT_PROPERTY.is( nextProp ) && !visitedPropertyRecordIds.add( nextProp ) )
{
throw new CircularPropertyRecordChainException( propRecord );
}
if ( visitor.visit( propRecord ) )
{
return true;
}
}
return false;
}
代码示例来源:origin: neo4j/neo4j
private void writeSomeData( File file,
Visitor<Pair<LogEntryWriter,Consumer<LogPositionMarker>>,IOException> visitor ) throws IOException
{
try ( LogVersionedStoreChannel versionedStoreChannel = new PhysicalLogVersionedStoreChannel(
fileSystemRule.get().open( file, OpenMode.READ_WRITE ), logVersion, CURRENT_LOG_VERSION );
PositionAwarePhysicalFlushableChannel writableLogChannel = new PositionAwarePhysicalFlushableChannel(
versionedStoreChannel ) )
{
writeLogHeader( writableLogChannel, logVersion, 2L );
Consumer<LogPositionMarker> consumer = marker ->
{
try
{
writableLogChannel.getCurrentPosition( marker );
}
catch ( IOException e )
{
throw new RuntimeException( e );
}
};
LogEntryWriter first = new LogEntryWriter( writableLogChannel );
visitor.visit( Pair.of( first, consumer ) );
}
}
}
代码示例来源:origin: org.neo4j/neo4j-kernel
public void serialize( Collection<StorageCommand> commands ) throws IOException
{
for ( StorageCommand command : commands )
{
serializer.visit( command );
}
}
代码示例来源:origin: org.neo4j/neo4j-kernel
@Override
public boolean accept( Visitor<StorageCommand,IOException> visitor ) throws IOException
{
for ( StorageCommand command : commands )
{
if ( visitor.visit( command ) )
{
return true;
}
}
return false;
}
代码示例来源:origin: org.neo4j/neo4j-kernel
/**
* Visits this store, and any other store managed by this store.
* TODO this could, and probably should, replace all override-and-do-the-same-thing-to-all-my-managed-stores
* methods like:
* {@link #makeStoreOk()},
* {@link #close()} (where that method could be deleted all together and do a visit in {@link #close()}),
* {@link #logIdUsage(Logger)},
* {@link #logVersions(Logger)}
* For a good samaritan to pick up later.
*/
void visitStore( Visitor<CommonAbstractStore<RECORD,HEADER>,RuntimeException> visitor )
{
visitor.visit( this );
}
代码示例来源:origin: org.neo4j/neo4j-core-edge
synchronized void visit( Visitor<SegmentFile,RuntimeException> visitor )
{
ListIterator<SegmentFile> itr = allSegments.listIterator();
boolean terminate = false;
while ( itr.hasNext() && !terminate )
{
terminate = visitor.visit( itr.next() );
}
}
代码示例来源:origin: org.neo4j/neo4j-causal-clustering
synchronized void visit( Visitor<SegmentFile,RuntimeException> visitor )
{
ListIterator<SegmentFile> itr = allSegments.listIterator();
boolean terminate = false;
while ( itr.hasNext() && !terminate )
{
terminate = visitor.visit( itr.next() );
}
}
内容来源于网络,如有侵权,请联系作者删除!