Class AbstractResultMatrix<T>
- java.lang.Object
-
- com.itextpdf.pdfua.checkers.utils.tables.AbstractResultMatrix<T>
-
- Type Parameters:
T
- the type of the cell
- Direct Known Subclasses:
CellResultMatrix
,StructTreeResultMatrix
abstract class AbstractResultMatrix<T> extends java.lang.Object
Class that represents a matrix of cells in a table. It is used to check if the table has valid headers and scopes for the cells.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<T>
cellMatrix
private int
cols
private PdfUAConformance
conformance
protected ITableIterator<T>
iterator
private int
rows
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractResultMatrix(ITableIterator<T> iterator, PdfUAConformance conformance)
Creates a newAbstractResultMatrix
instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
checkValidTableTagging()
Runs the algorithm to check if the table has valid headers and scopes for the cells.private static <Z> java.util.List<Z>
createFixedSizedList(int capacity, java.lang.Object defaultValue)
private void
determineDefaultScope(int rowIdx, int rowspan, int colIdx, int colspan, java.util.List<java.lang.Boolean> scopeMatrix)
(package private) abstract byte[]
getElementId(T cell)
(package private) abstract java.util.List<byte[]>
getHeaders(T cell)
private java.lang.String
getLocationInTable(int row)
private int
getNormalizedRow(int row)
(package private) abstract java.lang.String
getRole(T cell)
(package private) abstract java.lang.String
getScope(T cell)
private boolean
hasValidHeaderIds(T cell, java.util.Set<java.lang.String> knownIds)
private <Z> void
setCell(int row, int rowSpan, int col, int colSpan, java.util.List<Z> arr, Z value)
private void
setColumnValue(int col, int colSpan, java.util.List<java.lang.Boolean> arr, boolean value)
private void
setRowAndColumnValue(int row, int rowSpan, int col, int colSpan, java.util.List<java.lang.Boolean> arr, boolean value)
private void
setRowValue(int row, int rowSpan, java.util.List<java.lang.Boolean> arr, boolean value)
private void
validateTableCells(java.util.Set<java.lang.String> knownIds, java.util.List<java.lang.Boolean> scopeMatrix, boolean hasUnknownHeaders)
-
-
-
Field Detail
-
iterator
protected final ITableIterator<T> iterator
-
cellMatrix
private final java.util.List<T> cellMatrix
-
rows
private final int rows
-
cols
private final int cols
-
conformance
private final PdfUAConformance conformance
-
-
Constructor Detail
-
AbstractResultMatrix
protected AbstractResultMatrix(ITableIterator<T> iterator, PdfUAConformance conformance)
Creates a newAbstractResultMatrix
instance.- Parameters:
iterator
- the iterator that will be used to iterate over the cellsconformance
-PdfUAConformance
of the document that is being checked
-
-
Method Detail
-
checkValidTableTagging
public void checkValidTableTagging()
Runs the algorithm to check if the table has valid headers and scopes for the cells.- Throws:
PdfUAConformanceException
- if the table doesn't have valid headers and scopes for the cells.
-
getHeaders
abstract java.util.List<byte[]> getHeaders(T cell)
-
getScope
abstract java.lang.String getScope(T cell)
-
getElementId
abstract byte[] getElementId(T cell)
-
getRole
abstract java.lang.String getRole(T cell)
-
determineDefaultScope
private void determineDefaultScope(int rowIdx, int rowspan, int colIdx, int colspan, java.util.List<java.lang.Boolean> scopeMatrix)
-
validateTableCells
private void validateTableCells(java.util.Set<java.lang.String> knownIds, java.util.List<java.lang.Boolean> scopeMatrix, boolean hasUnknownHeaders)
-
getLocationInTable
private java.lang.String getLocationInTable(int row)
-
getNormalizedRow
private int getNormalizedRow(int row)
-
setCell
private <Z> void setCell(int row, int rowSpan, int col, int colSpan, java.util.List<Z> arr, Z value)
-
setRowValue
private void setRowValue(int row, int rowSpan, java.util.List<java.lang.Boolean> arr, boolean value)
-
setColumnValue
private void setColumnValue(int col, int colSpan, java.util.List<java.lang.Boolean> arr, boolean value)
-
setRowAndColumnValue
private void setRowAndColumnValue(int row, int rowSpan, int col, int colSpan, java.util.List<java.lang.Boolean> arr, boolean value)
-
hasValidHeaderIds
private boolean hasValidHeaderIds(T cell, java.util.Set<java.lang.String> knownIds)
-
createFixedSizedList
private static <Z> java.util.List<Z> createFixedSizedList(int capacity, java.lang.Object defaultValue)
-
-