From 50962a4fa39497237cb35af9e3d3d2cee13a0bf0 Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 27 Jun 2024 13:08:11 +0300 Subject: [PATCH] Minor fixes --- .../wcag/algorithms/entities/content/TextBlock.java | 6 ++++++ .../wcag/algorithms/entities/lists/ListInterval.java | 2 +- .../consumers/AccumulatedNodeConsumer.java | 2 +- .../semanticalgorithms/consumers/ClusterTableConsumer.java | 2 +- .../consumers/LinesPreprocessingConsumer.java | 7 ++----- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/verapdf/wcag/algorithms/entities/content/TextBlock.java b/src/main/java/org/verapdf/wcag/algorithms/entities/content/TextBlock.java index 2997b6eb..33d05ea0 100644 --- a/src/main/java/org/verapdf/wcag/algorithms/entities/content/TextBlock.java +++ b/src/main/java/org/verapdf/wcag/algorithms/entities/content/TextBlock.java @@ -73,6 +73,12 @@ public void add(TextLine line) { textLines.add(line); super.add(line); } + + public void add(List lines) { + for (TextLine line : lines) { + add(line); + } + } public int getLinesNumber() { return textLines.size(); diff --git a/src/main/java/org/verapdf/wcag/algorithms/entities/lists/ListInterval.java b/src/main/java/org/verapdf/wcag/algorithms/entities/lists/ListInterval.java index 42a0257e..0febd8f4 100644 --- a/src/main/java/org/verapdf/wcag/algorithms/entities/lists/ListInterval.java +++ b/src/main/java/org/verapdf/wcag/algorithms/entities/lists/ListInterval.java @@ -13,7 +13,7 @@ public class ListInterval { private List listItemsInfos = new ArrayList<>(); public Integer numberOfColumns; - public ListInterval() { + public ListInterval() { } diff --git a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/AccumulatedNodeConsumer.java b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/AccumulatedNodeConsumer.java index 5ced97ee..3aad2e93 100644 --- a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/AccumulatedNodeConsumer.java +++ b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/AccumulatedNodeConsumer.java @@ -259,7 +259,7 @@ else if (differentLinesProbability >= toColumnsMergeProbability) { mergeProbability = differentLinesProbability; TextColumn lastColumn = new TextColumn(currentTextNode.getLastColumn()); TextBlock lastBlock = new TextBlock(lastColumn.getLastTextBlock()); - lastBlock.getLines().addAll(lines); + lastBlock.add(lines); lastColumn.setLastTextBlock(lastBlock); currentTextNode.setLastColumn(lastColumn); if (nextTextNode.getColumnsNumber() > 1) { diff --git a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/ClusterTableConsumer.java b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/ClusterTableConsumer.java index fe616657..19dca5bb 100644 --- a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/ClusterTableConsumer.java +++ b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/ClusterTableConsumer.java @@ -26,7 +26,7 @@ public class ClusterTableConsumer extends WCAGConsumer { private final List tables; private final List lists; - public ClusterTableConsumer() { + public ClusterTableConsumer() { tables = new ArrayList<>(); lists = new ArrayList<>(); init(); diff --git a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/LinesPreprocessingConsumer.java b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/LinesPreprocessingConsumer.java index dec87715..8d9a60ee 100644 --- a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/LinesPreprocessingConsumer.java +++ b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/LinesPreprocessingConsumer.java @@ -6,10 +6,7 @@ import org.verapdf.wcag.algorithms.semanticalgorithms.containers.StaticContainers; import org.verapdf.wcag.algorithms.semanticalgorithms.utils.WCAGProgressStatus; -import java.util.List; -import java.util.LinkedList; -import java.util.Set; -import java.util.HashSet; +import java.util.*; public class LinesPreprocessingConsumer extends WCAGConsumer { @@ -32,7 +29,7 @@ public void findTableBorders() { } private List findTableBorders(Integer pageNumber) { - List tableBorders = new LinkedList<>(); + List tableBorders = new ArrayList<>(); Set set = new HashSet<>(StaticContainers.getLinesCollection().getHorizontalLines(pageNumber)); set.addAll(StaticContainers.getLinesCollection().getVerticalLines(pageNumber)); set.addAll(StaticContainers.getLinesCollection().getSquares(pageNumber));