@Override public boolean isCurrentRowValid( Batch batch ) { CachedNode node = batch.getNode(indexInRow); if (node == null) return true; return node.getKey().getWorkspaceKey().equals(workspaceKey); } };
@Override public double getScore( String selectorName ) throws RepositoryException { if (!iterator.hasSelector(selectorName)) { throw new RepositoryException(JcrI18n.selectorNotUsedInQuery.text(selectorName, iterator.query)); } int nodeIndex = iterator.columns.getSelectorNames().indexOf(selectorName); return batchAtRow.getScore(nodeIndex); }
assert first != null || second != null; @SuppressWarnings( "null" ) final String workspaceName = first != null ? first.getWorkspaceName() : second.getWorkspaceName(); assert first == null || workspaceName.equals(first.getWorkspaceName()); assert second == null || workspaceName.equals(second.getWorkspaceName()); assert first == null || first.width() == firstWidth; assert second == null || second.width() == secondWidth; if (first == null) { assert second != null; // both are not null per first line rowCount = second.rowCount(); } else if (second == null) { rowCount = first.rowCount(); } else { long firstSize = first.rowCount(); long secondSize = second.rowCount(); if (firstSize == -1 || secondSize == -1) rowCount = -1; else rowCount = Math.max(firstSize, secondSize);
assert first != null || second != null; @SuppressWarnings( "null" ) final String workspaceName = first != null ? first.getWorkspaceName() : second.getWorkspaceName(); assert first == null || workspaceName.equals(first.getWorkspaceName()); assert second == null || workspaceName.equals(second.getWorkspaceName()); assert first == null || first.width() == firstWidth; assert second == null || second.width() == secondWidth; if (first == null) { assert second != null; // both are not null per first line rowCount = second.rowCount(); } else if (second == null) { rowCount = first.rowCount(); } else { long firstSize = first.rowCount(); long secondSize = second.rowCount(); if (firstSize == -1 || secondSize == -1) rowCount = -1; else rowCount = Math.max(firstSize, secondSize);
/** * Create a sequence of nodes that iterates over the supplied batches of nodes. Note that the supplied iterator is accessed * lazily as the resulting sequence instance is {@link #nextBatch() used}. * * @param batches the iterable container containing the node batches to be returned; if null, an {@link #emptySequence empty * instance} is returned * @param width the width of the batch; must be positive * @return the sequence of nodes; never null */ public static NodeSequence withBatches( final Collection<Batch> batches, final int width ) { if (batches == null || batches.isEmpty()) return emptySequence(width); if (batches.size() == 1) { Batch batch = batches.iterator().next(); assert width == batch.width(); return withBatch(batch); } // Tally the size of each batch ... long rowCount = 0L; for (Batch batch : batches) { long count = batch.rowCount(); rowCount = count < 0L ? -1L : rowCount + count; } return withBatches(batches.iterator(), width, rowCount); }
/** * Create a sequence of nodes that iterates over the supplied batches of nodes. Note that the supplied iterator is accessed * lazily as the resulting sequence instance is {@link #nextBatch() used}. * * @param batches the iterable container containing the node batches to be returned; if null, an {@link #emptySequence empty * instance} is returned * @param width the width of the batch; must be positive * @return the sequence of nodes; never null */ public static NodeSequence withBatches( final Collection<Batch> batches, final int width ) { if (batches == null || batches.isEmpty()) return emptySequence(width); if (batches.size() == 1) { Batch batch = batches.iterator().next(); assert width == batch.width(); return withBatch(batch); } // Tally the size of each batch ... long rowCount = 0L; for (Batch batch : batches) { long count = batch.rowCount(); rowCount = count < 0L ? -1L : rowCount + count; } return withBatches(batches.iterator(), width, rowCount); }
@Override public Batch nextBatch() { Batch batch = RestartableSequence.this.original.nextBatch(); if (batch == null) { // There are no more batches, so we have seen, copied, and loaded all of the batches ... loadedAll = true; return null; } // Otherwise, make a copy of it and load it into the storage ... boolean loadIntoMemory = inMemoryBatches != null && actualNumRowsInMemory < numRowsInMemory; totalSize += loadBatch(batch, loadIntoMemory, copiedBatch); if (batchSize.get() == 0L) batchSize.set(copiedBatch.get().rowCount()); return copiedBatch.get(); } };
@Override public Batch nextBatch() { Batch batch = RestartableSequence.this.original.nextBatch(); if (batch == null) { // There are no more batches, so we have seen, copied, and loaded all of the batches ... loadedAll = true; return null; } // Otherwise, make a copy of it and load it into the storage ... boolean loadIntoMemory = inMemoryBatches != null && actualNumRowsInMemory < numRowsInMemory; totalSize += loadBatch(batch, loadIntoMemory, copiedBatch); if (batchSize.get() == 0L) batchSize.set(copiedBatch.get().rowCount()); return copiedBatch.get(); } };
@Override public String getWorkspaceName() { return original.getWorkspaceName(); }
@Override public long rowCount() { return right.rowCount(); }
@Override public int width() { return original.width(); }
@Override public String getWorkspaceName() { return original.getWorkspaceName(); }
@Override public String getWorkspaceName() { return original.getWorkspaceName(); }
@Override public long rowCount() { return left.rowCount(); }
@Override public long rowCount() { return original.rowCount(); }
@Override public long getRowCount() { return sequence.rowCount(); }
@Override public int width() { return batch.width(); }
@Override public int width() { return original.width(); }
@Override public int width() { return sequence.width(); }