MOEA Framework 2.5
API Specification

org.moeaframework.analysis.sensitivity
Class ResultFileReader

java.lang.Object
  extended by org.moeaframework.analysis.sensitivity.ResultFileReader
All Implemented Interfaces:
Closeable, Iterable<ResultEntry>, Iterator<ResultEntry>

public class ResultFileReader
extends Object
implements Closeable, Iterator<ResultEntry>, Iterable<ResultEntry>

Reads result files created by ResultFileWriter. See the documentation for ResultWriter for a description of the file format.

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:
ResultFileWriter

Constructor Summary
ResultFileReader(Problem problem, File file)
          Constructs a result file reader for reading the approximation sets from the specified result file.
 
Method Summary
 void close()
          Closes this stream and releases any system resources associated with it.
 Variable decode(Variable variable, String string)
          Decodes string representations of decision variables, returning the variable with the decoded value.
 boolean hasNext()
          Returns true if the iteration has more elements.
 Iterator<ResultEntry> iterator()
          Returns an iterator over a set of elements of type T.
 ResultEntry next()
          Returns the next element in the iteration.
 void remove()
          Removes from the underlying collection the last element returned by this iterator (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultFileReader

public ResultFileReader(Problem problem,
                        File file)
                 throws IOException
Constructs a result file reader for reading the approximation sets from the specified result file.

Parameters:
problem - the problem
file - the file containing the results
Throws:
IOException - if an I/O error occurred
Method Detail

close

public void close()
           throws IOException
Description copied from interface: java.io.Closeable
Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

Specified by:
close in interface Closeable
Throws:
IOException - if an I/O error occurs

next

public ResultEntry next()
Description copied from interface: java.util.Iterator
Returns the next element in the iteration.

Specified by:
next in interface Iterator<ResultEntry>
Returns:
the next element in the iteration

iterator

public Iterator<ResultEntry> iterator()
Description copied from interface: java.lang.Iterable
Returns an iterator over a set of elements of type T.

Specified by:
iterator in interface Iterable<ResultEntry>
Returns:
an Iterator.

hasNext

public boolean hasNext()
Description copied from interface: java.util.Iterator
Returns true if the iteration has more elements. (In other words, returns true if Iterator.next() would return an element rather than throwing an exception.)

Specified by:
hasNext in interface Iterator<ResultEntry>
Returns:
true if the iteration has more elements

remove

public void remove()
Description copied from interface: java.util.Iterator
Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to Iterator.next(). The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.

Specified by:
remove in interface Iterator<ResultEntry>

decode

public Variable decode(Variable variable,
                       String string)
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 variable
string - the string representation of the decision variable
Returns:
the variable with the decoded value
See Also:
ResultFileWriter.encode(Variable)

MOEA Framework 2.5
API Specification

Copyright 2009-2015 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Hosted by Get MOEA Framework at SourceForge.net. Fast, secure and Free Open Source software downloads