Package org.moeaframework.analysis.io
Class ResultFileReader
java.lang.Object
org.moeaframework.analysis.io.ResultFileReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<ResultEntry>
,Iterator<ResultEntry>
public class ResultFileReader
extends Object
implements Closeable, Iterator<ResultEntry>, Iterable<ResultEntry>
Reads result files created by
ResultFileWriter
.
This reader is expected to gracefully recover from incomplete or improperly formatted files. Unless a serious I/O
error occurred, this reader will attempt to load the file to the last valid entry. This requirement enables a
ResultWriter
to resume processing at a valid state.
- See Also:
-
Constructor Summary
ConstructorDescriptionResultFileReader
(Problem problem, File file) Constructs a result file reader for reading the approximation sets from the specified result file. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ResultFileReader
Constructs a result file reader for reading the approximation sets from the specified result file.- Parameters:
problem
- the problemfile
- the file containing the results- Throws:
IOException
- if an I/O error occurred
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
next
- Specified by:
next
in interfaceIterator<ResultEntry>
-
iterator
- Specified by:
iterator
in interfaceIterable<ResultEntry>
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<ResultEntry>
-
remove
public void remove()- Specified by:
remove
in interfaceIterator<ResultEntry>
-
decode
Decodes string representations of decision variables, returning the variable with the decoded value. Depending on the implementation and variable type, the same variable as provided in the arguments or a new variable will be returned.- Parameters:
variable
- the decision variablestring
- the string representation of the decision variable- Returns:
- the variable with the decoded value
- See Also:
-
open
Opens the result file for reading.- Parameters:
problem
- the problemfile
- the file containing the results- Returns:
- the reader
- Throws:
IOException
- if an I/O error occurred
-