Package org.flag4j.io
Class PrintOptions
java.lang.Object
org.flag4j.io.PrintOptions
-
Field Summary
Modifier and TypeFieldDescriptionprivate static boolean
A flag which indicates if each value should be centered within its column.static final boolean
Default flag for centering elements when printing.static final int
Default maximum number of columns to print.static final int
Default maximum number of rows to print.static final int
Default padding between elements when printing.static final int
Default precision (i.e.private static int
Maximum number of columns to print from a matrix/vector.private static int
Maximum number of rows to print from a matrix.private static int
Padding to apply to each size of an element.private static int
Precision of the printed matrix values. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
Gets the current maximum number of columns to print.static int
Gets the maximum number of rows to print.static int
Gets the current padding amount for columns.static int
Gets the current printing precision.static void
resetAll()
Resets all print options to their default values.static void
setCentering
(boolean center) Sets the centering flag.static void
setMaxColumns
(int maxColumns) Sets the maximum number of columns to print.static void
setMaxRows
(int maxRows) Set the maximum number of rows to print.static void
setMaxRowsCols
(int maxRowCols) Set the maximum number of rows and columns to print.static void
setMaxRowsCols
(int maxRows, int maxCols) Set the maximum number of rows and columns to print.static void
setPadding
(int padding) Sets the minimum padding amount for the columns.static void
setPrecision
(int precision) Sets the printing precision for which values in a matrix/vectorstatic boolean
Gets the centering flag.
-
Field Details
-
DEFAULT_PADDING
public static final int DEFAULT_PADDINGDefault padding between elements when printing.- See Also:
-
DEFAULT_MAX_ROWS
public static final int DEFAULT_MAX_ROWSDefault maximum number of rows to print.- See Also:
-
DEFAULT_MAX_COLS
public static final int DEFAULT_MAX_COLSDefault maximum number of columns to print.- See Also:
-
DEFAULT_PRECISION
public static final int DEFAULT_PRECISIONDefault precision (i.e. number of decimals) to use when printing.- See Also:
-
DEFAULT_CENTER
public static final boolean DEFAULT_CENTERDefault flag for centering elements when printing.- See Also:
-
padding
private static int paddingPadding to apply to each size of an element. Padding is divided up to either side of the element. For instance, if
padding=4
then two spaces will be placed on either side of each element. Further, since this is done per element, each element will have 4 spaces between them (in addition to any additional padding from column alignment within a matrix).If negative, zero padding will be used.
Default Value:
DEFAULT_PADDING
-
maxRows
private static int maxRowsMaximum number of rows to print from a matrix. If a matrix has more rows than this value, rows with indices larger than this value, except for the last row, will not be printed. If zero or negative all rows will be printed. The last row is always printed
Default Value:
DEFAULT_MAX_ROWS
-
maxColumns
private static int maxColumnsMaximum number of columns to print from a matrix/vector. If a matrix has more columns than this value, columns with indices equal to or larger than this value, except for the last column, will not be printed. If zero or negative all columns will be printed. The last column is always printed.
Default Value:DEFAULT_MAX_COLS
-
precision
private static int precisionPrecision of the printed matrix values. i.e. the number of decimal places printed. If negative, max precision is used.
Default Value:DEFAULT_PRECISION
. -
center
private static boolean centerA flag which indicates if each value should be centered within its column.
Default value:DEFAULT_PRECISION
.
-
-
Constructor Details
-
PrintOptions
private PrintOptions()Hide default constructor.
-
-
Method Details
-
setCentering
public static void setCentering(boolean center) Sets the centering flag.- Parameters:
center
- Flag for centering values within its column.
-
useCentering
public static boolean useCentering()Gets the centering flag.- Returns:
- The current value of the center flag.
-
setPrecision
public static void setPrecision(int precision) Sets the printing precision for which values in a matrix/vector- Parameters:
precision
- The precision to use.
-
getPrecision
public static int getPrecision()Gets the current printing precision.- Returns:
- The current printing precision.
-
getMaxColumns
public static int getMaxColumns()Gets the current maximum number of columns to print.- Returns:
- The current maximum number of columns to print.
-
setMaxColumns
public static void setMaxColumns(int maxColumns) Sets the maximum number of columns to print.- Parameters:
maxColumns
- Maximum number of columns to print.
-
getMaxRows
public static int getMaxRows()Gets the maximum number of rows to print.- Returns:
- The maximum number of rows to print.
-
setMaxRows
public static void setMaxRows(int maxRows) Set the maximum number of rows to print.- Parameters:
maxRows
- The new maximum number of rows to print.
-
setMaxRowsCols
public static void setMaxRowsCols(int maxRows, int maxCols) Set the maximum number of rows and columns to print.- Parameters:
maxRows
- The new maximum number of rows to print.maxCols
- The maximum number of columns to print.
-
setMaxRowsCols
public static void setMaxRowsCols(int maxRowCols) Set the maximum number of rows and columns to print.- Parameters:
maxRowCols
- The new maximum number of rows and columns to print.
-
getPadding
public static int getPadding()Gets the current padding amount for columns.- Returns:
- The current padding amount for columns.
-
setPadding
public static void setPadding(int padding) Sets the minimum padding amount for the columns.- Parameters:
padding
- New padding amount for the columns.
-
resetAll
public static void resetAll()Resets all print options to their default values.
-