public final class CSVDoubleTable extends AbstractCSVTable<Double>
This class reads all data of a csv file as double values.
It can give a minimal, maximal and average value for all entries of a column or of a row.
- Author:
- Dr. Peter Droste, Omix Visualization
-
Constructor Summary
Constructors Constructor Description CSVDoubleTable(File file, String separator, boolean horizontal, int startLine)
Creates a new table that reads the given file from a startline.CSVDoubleTable(File file, String separator, boolean horizontal, int startLine, DecimalFormatSymbols decimalFormatSymbols, Charset charset)
Creates a new table that reads the given file from a startline.CSVDoubleTable(File file, String separator, String quoteChar, boolean horizontal, int startLine)
Creates a new table that reads the given file from a startline.CSVDoubleTable(File file, String separator, String quoteChar, boolean horizontal, int startLine, DecimalFormatSymbols decimalFormatSymbols, Charset charset)
Creates a new table that reads the given file from a startline.CSVDoubleTable(File file, String separatorChar, String quoteChar, String escapeChar, boolean horizontal, int startLine)
Creates a new table that reads the given file from a startline.CSVDoubleTable(File file, String separatorChar, String quoteChar, String escapeChar, boolean horizontal, int startLine, DecimalFormatSymbols decimalFormatSymbols, Charset charset)
Creates a new table that reads the given file from a startline.CSVDoubleTable(File file, String separatorChar, String openingQuoteChar, String closingQuoteChar, String escapeChar, boolean horizontal, int startLine)
Creates a new table that reads the given file from a startline.CSVDoubleTable(File file, String separatorChar, String openingQuoteChar, String closingQuoteChar, String escapeChar, boolean horizontal, int startLine, DecimalFormatSymbols decimalFormatSymbols, Charset charset)
Creates a new table that reads the given file from a startline. -
Method Summary
Modifier and Type Method Description double
avg(int index)
returns the average value of a row (index).double
avg(String identifier)
returns the average value of a column (identifier).protected Double
format(String value)
this method converts a String into a Doubleprotected Double[][]
generateArray(int i, int j)
This method must create the array T[][].double
max(int index)
returns the maximum value of a row (index).double
max(String identifier)
returns the maximum value of a column (identifier).double
min(int index)
returns the minimum value of a row (index).double
min(String identifier)
returns the minimum value of a column (identifier).
-
Constructor Details
-
CSVDoubleTable
@ConstructorProperties({"file","separator","horizontal","startLine"}) public CSVDoubleTable(File file, String separator, boolean horizontal, int startLine)Creates a new table that reads the given file from a startline. The programmer has to specify if the csv file has a vertical header or a horizontal header. The data is seperated by the character given as separator. Cell content in the table may be quoted by the given quote character. The quote character itself can be content of a cell by a leading escape character. This constructor uses the " character as quote character and \ as escape character.- Parameters:
file
-separator
-horizontal
-startLine
-
-
CSVDoubleTable
@ConstructorProperties({"file","separator","horizontal","startLine","decimalFormatSymbols","charset"}) public CSVDoubleTable(File file, String separator, boolean horizontal, int startLine, DecimalFormatSymbols decimalFormatSymbols, Charset charset)Creates a new table that reads the given file from a startline. The programmer has to specify if the csv file has a vertical header or a horizontal header. The data is seperated by the character given as separator. Cell content in the table may be quoted by the given quote character. The quote character itself can be content of a cell by a leading escape character. This constructor uses the " character as quote character and \ as escape character.- Parameters:
file
-separator
-horizontal
-startLine
-charset
- The character set of the input file (e.g. UTF-8)
-
CSVDoubleTable
@ConstructorProperties({"file","separator","quoteChar","horizontal","startLine"}) public CSVDoubleTable(File file, String separator, String quoteChar, boolean horizontal, int startLine)Creates a new table that reads the given file from a startline. The programmer has to specify if the csv file has a vertical header or a horizontal header. The data is seperated by the character given as separator. Cell content in the table may be quoted by the given quote character. The quote character itself can be content of a cell by a leading escape character. This constructor uses the \ as escape character.- Parameters:
file
-separator
-quoteChar
-horizontal
-startLine
-
-
CSVDoubleTable
@ConstructorProperties({"file","quoteChar","separator","horizontal","startLine","decimalFormatSymbols","charset"}) public CSVDoubleTable(File file, String separator, String quoteChar, boolean horizontal, int startLine, DecimalFormatSymbols decimalFormatSymbols, Charset charset)Creates a new table that reads the given file from a startline. The programmer has to specify if the csv file has a vertical header or a horizontal header. The data is seperated by the character given as separator. Cell content in the table may be quoted by the given quote character. The quote character itself can be content of a cell by a leading escape character. This constructor uses the \ as escape character.- Parameters:
file
-separator
-quoteChar
-horizontal
-startLine
-decimalFormatSymbols
- The symbols of the decimal number formatcharset
- The character set of the input file (e.g. UTF-8)
-
CSVDoubleTable
@ConstructorProperties({"file","quoteChar","escapeChar","separator","horizontal","startLine","decimalFormatSymbols"}) public CSVDoubleTable(File file, String separatorChar, String quoteChar, String escapeChar, boolean horizontal, int startLine)Creates a new table that reads the given file from a startline. The programmer has to specify if the csv file has a vertical header or a horizontal header. The data is seperated by the character given as separator. Cell content in the table may be quoted by the given quote character. The quote character itself can be content of a cell by a leading escape character.- Parameters:
file
-separatorChar
-quoteChar
-escapeChar
-horizontal
-startLine
-
-
CSVDoubleTable
@ConstructorProperties({"file","quoteChar","escapeChar","separator","horizontal","startLine","decimalFormatSymbols","charset"}) public CSVDoubleTable(File file, String separatorChar, String quoteChar, String escapeChar, boolean horizontal, int startLine, DecimalFormatSymbols decimalFormatSymbols, Charset charset)Creates a new table that reads the given file from a startline. The programmer has to specify if the csv file has a vertical header or a horizontal header. The data is seperated by the character given as separator. Cell content in the table may be quoted by the given quote character. The quote character itself can be content of a cell by a leading escape character.- Parameters:
file
-separatorChar
-quoteChar
-escapeChar
-horizontal
-startLine
-decimalFormatSymbols
- The symbols of the decimal number formatcharset
- The character set of the input file (e.g. UTF-8)
-
CSVDoubleTable
@ConstructorProperties({"file","openingQuoteChar","closingQuoteChar","escapeChar","separator","horizontal","startLine","decimalFormatSymbols"}) public CSVDoubleTable(File file, String separatorChar, String openingQuoteChar, String closingQuoteChar, String escapeChar, boolean horizontal, int startLine)Creates a new table that reads the given file from a startline. The programmer has to specify if the csv file has a vertical header or a horizontal header. The data is seperated by the character given as separator. Cell content in the table may be quoted by the given quote character. The quote character itself can be content of a cell by a leading escape character.- Parameters:
file
-separatorChar
-openingQuoteChar
-closingQuoteChar
-escapeChar
-horizontal
-startLine
-
-
CSVDoubleTable
@ConstructorProperties({"file","openingQuoteChar","closingQuoteChar","escapeChar","separator","horizontal","startLine","decimalFormatSymbols","charset"}) public CSVDoubleTable(File file, String separatorChar, String openingQuoteChar, String closingQuoteChar, String escapeChar, boolean horizontal, int startLine, DecimalFormatSymbols decimalFormatSymbols, Charset charset)Creates a new table that reads the given file from a startline. The programmer has to specify if the csv file has a vertical header or a horizontal header. The data is seperated by the character given as separator. Cell content in the table may be quoted by the given quote character. The quote character itself can be content of a cell by a leading escape character.- Parameters:
file
-separatorChar
-openingQuoteChar
-closingQuoteChar
-escapeChar
-horizontal
-startLine
-decimalFormatSymbols
- The symbols of the decimal number format. If null, the C decimal format symbols are used.charset
- The character set of the input file (e.g. UTF-8)
-
-
Method Details
-
format
this method converts a String into a Double- Specified by:
format
in classAbstractTable<Double>
- Parameters:
value
-- Returns:
- Double object
- See Also:
AbstractTable.format(java.lang.String)
-
generateArray
Description copied from class:AbstractTable
This method must create the array T[][].- Specified by:
generateArray
in classAbstractTable<Double>
- Returns:
- new Double[i][j]
- See Also:
AbstractTable.generateArray(int, int)
-
min
public double min(int index)returns the minimum value of a row (index).- Parameters:
index
-- Returns:
- minimum
-
max
public double max(int index)returns the maximum value of a row (index).- Parameters:
index
-- Returns:
- maximum
-
avg
public double avg(int index)returns the average value of a row (index).- Parameters:
index
-- Returns:
- average
-
min
returns the minimum value of a column (identifier).- Parameters:
identifier
-- Returns:
- minimum
-
max
returns the maximum value of a column (identifier).- Parameters:
identifier
-- Returns:
- maximum
-
avg
returns the average value of a column (identifier).- Parameters:
identifier
-- Returns:
- average
-