Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gpapadis committed Aug 27, 2021
1 parent eb8d063 commit 94ea20e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
public abstract class AbstractBlockProcessing implements IBlockProcessing {

protected void printOriginalStatistics(List<AbstractBlock> inputBlocks) {
long comparisons = 0;
for (AbstractBlock block : inputBlocks) {
comparisons += block.getNoOfComparisons();
}
long comparisons = inputBlocks.stream().mapToLong(AbstractBlock::getNoOfComparisons).sum();

Log.info("Original blocks\t:\t" + inputBlocks.size());
Log.info("Original comparisons\t:\t" + comparisons);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public List<AbstractBlock> refineBlocks(List<AbstractBlock> blocks) {
setThreshold(newBlocks);

int noOfPurgedBlocks = 0;
float totalComparisons = 0;
long totalComparisons = 0;
final Iterator<AbstractBlock> blocksIterator = newBlocks.iterator();
while (blocksIterator.hasNext()) {
AbstractBlock aBlock = blocksIterator.next();
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/scify/jedai/datamodel/SimilarityPairs.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ public void addComparison(Comparison comparison) {
}

private long countComparisons(List<AbstractBlock> blocks) {
long comparisons = 0;
for (AbstractBlock block : blocks) {
comparisons += block.getNoOfComparisons();
}
long comparisons = blocks.stream().mapToLong(AbstractBlock::getNoOfComparisons).sum();

if (comparisons > MAX_COMPARISONS) {
throw new IllegalStateException("Very high number of comparisons to be executed. "
Expand Down

0 comments on commit 94ea20e

Please sign in to comment.