public static NodeSequence withBatch ( final Batch sequence ) { if ( sequence == null ) return emptySequence ( 1 ) ; return new NodeSequence ( ) { private boolean done = false ; @ Override public int width ( ) { return sequence . width ( ) ; } @ Override public long getRowCount ( ) { return sequence . rowCount ( ) ; } @ Override public boolean isEmpty ( ) { return sequence . isEmpty ( ) ; } @ Override public Batch nextBatch ( ) { if ( done ) return null ; done = true ; return sequence ; } @ Override public void close ( ) { } @ Override public String toString ( ) { return "(sequence-with-batch width=" + width ( ) + " " + sequence + " )" ; } } ; }
Create a sequence of nodes that returns the supplied single batch of nodes .