
net.sf.nervalreports.generators.TeXTableInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tex-generator Show documentation
Show all versions of tex-generator Show documentation
This is the TeX generator package of NervalReports (a lightweight report creation library),
used to generate a report in a LaTeX file (.tex).
/** This file is part of nervalreports.
*
* nervalreports is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nervalreports is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with nervalreports. If not, see . */
package net.sf.nervalreports.generators;
import java.util.LinkedList;
/** Informations and construction state variables for current table definition in LaTeX. */
/* default */ class TeXTableInfo {
/** List with current active spans (row and column) in the table. */
private final LinkedList spanList;
/** Counter of the current number of rows in the table (used for color alternation). */
private int currentTableLineCounter;
/** Width information of all columns. When there's no column width information available,
* the array will be null
. */
private final int[] columnWidth;
/** Width of the border (null
for none). */
private final Float borderWidth;
/** Counter of header cell indexes [0, n). */
private int currentTableHeaderElement;
/** Counter of row cell indexes [0,n]. */
private int currentTableRowElement;
/** Number of columns of the table. */
private final int totalColumns;
/** Default constructor. */
public TeXTableInfo(int[] columnWidth, Float borderWidth, int totalColumns) {
this.columnWidth = columnWidth;
this.spanList = new LinkedList();
this.currentTableLineCounter = 0;
this.borderWidth = borderWidth;
this.totalColumns = totalColumns;
clearCurrentTableHeaderElement();
}
/** @return {@link #columnWidth}. */
public int[] getColumnWidth() {
return columnWidth;
}
/** @return {@link #borderWidth}. */
public Float getBorderWidth() {
return borderWidth;
}
/** @return if current row element is the first one. */
public boolean isFirstTableRowElement() {
return currentTableRowElement == 0;
}
/** @return {@link #currentTableRowElement}. */
public int getCurrentTableRowElement() {
return currentTableRowElement;
}
/** Reset {@link #currentTableRowElement} to 0.*/
public void resetCurrentTableRowElement() {
this.currentTableRowElement = 0;
}
/** Increment by 'n' the value of {@link #currentTableRowElement}.
* @param n amount to add to {@link #currentTableRowElement}. */
public void incCurrentTableRowElement(int n) {
this.currentTableRowElement += n;
}
/** @return {@link #spanList}. */
public LinkedList getSpanList() {
return spanList;
}
/** @return {@link #currentTableLineCounter}. */
public int getCurrentTableLineCounter() {
return currentTableLineCounter;
}
/** Increment by one the value of {@link #currentTableLineCounter}. */
public void incCurrentTableLineCounter() {
this.currentTableLineCounter++;
}
/** @return {@link #currentTableHeaderElement}. */
public int getCurrentTableHeaderElement() {
return currentTableHeaderElement;
}
/** Reset current value of {@link #currentTableHeaderElement}.*/
public void clearCurrentTableHeaderElement() {
this.currentTableHeaderElement = 0;
}
/** Increment by 'n' the value of {@link #currentTableHeaderElement}.
* @param n amount to add to {@link #currentTableHeaderElement}. */
public void incCurrentTableHeaderElement(int n) {
this.currentTableHeaderElement += n;
}
/** @return totalColumns. */
public int getTotalColumns() {
return totalColumns;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy