Package org.moeaframework.util.io
Class MatrixReader
java.lang.Object
org.moeaframework.util.io.MatrixReader
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Iterable<double[]>,- Iterator<double[]>
- Direct Known Subclasses:
- MetricFileReader
public class MatrixReader
extends Object
implements Iterable<double[]>, Iterator<double[]>, Closeable
Reader of files containing matrices.  A matrix contains numerical data separated into rows and columns.  The values
 in a row are separated by whitespace.
 
The file can contain commented lines starting with '#' characters.
 Parsing stops at the first error.  Check the error flag to determine if an error was encountered.  An
 exception may or may not be thrown, depending on the type of error and the value of the suppressExceptions
 flag.  If exceptions are suppressed, a warning message will be printed.
- 
Constructor SummaryConstructorsConstructorDescriptionMatrixReader(File file) Constructs a reader for loading a matrix contained in the specified file.MatrixReader(File file, int numberOfColumns) Constructs a reader for loading a matrix contained in the specified file.MatrixReader(Reader reader) Constructs a reader for loading a matrix accessed through the underlying reader.MatrixReader(Reader reader, int numberOfColumns) Constructs a reader for loading a matrix accessed through the underlying reader.
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface java.util.IteratorforEachRemaining
- 
Constructor Details- 
MatrixReaderConstructs a reader for loading a matrix contained in the specified file.- Parameters:
- file- the file containing the matrix
- Throws:
- FileNotFoundException- if the file was not found
 
- 
MatrixReaderConstructs a reader for loading a matrix contained in the specified file.- Parameters:
- file- the file containing the matrix
- numberOfColumns- the expected number of columns; or -1 if the matrix has no fixed column count
- Throws:
- FileNotFoundException- if the file was not found
 
- 
MatrixReaderConstructs a reader for loading a matrix accessed through the underlying reader.- Parameters:
- reader- the underlying reader
 
- 
MatrixReaderConstructs a reader for loading a matrix accessed through the underlying reader.- Parameters:
- reader- the underlying reader
- numberOfColumns- the expected number of columns; or -1 if the matrix has no fixed column count
 
 
- 
- 
Method Details- 
getErrorHandlerReturns the error handler used by this reader.- Returns:
- the error handler
 
- 
iterator
- 
hasNextpublic boolean hasNext()
- 
nextpublic double[] next()
- 
removepublic void remove()
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 
-