MOEA Framework 2.2
API Specification

org.moeaframework.analysis.sensitivity
Class MetricFileReader

java.lang.Object
  extended by org.moeaframework.analysis.sensitivity.MetricFileReader
All Implemented Interfaces:
Closeable, Iterable<double[]>, Iterator<double[]>

public class MetricFileReader
extends Object

Reader for metric files produced by MetricFileWriter. The file can contain commented lines starting with '#' characters.

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 MetricFileWriter to resume processing at a valid state.

See Also:
MetricFileWriter

Constructor Summary
MetricFileReader(File file)
          Constructs a metric file reader for reading metric files from the specified file.
MetricFileReader(Reader reader)
          Constructs a metric file reader for reading metric files from the underlying reader.
 
Method Summary
 void close()
          Closes this stream and releases any system resources associated with it.
 boolean hasNext()
          Returns true if the iteration has more elements.
 Iterator<double[]> iterator()
          Returns an iterator over a set of elements of type T.
 double[] 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

MetricFileReader

public MetricFileReader(File file)
                 throws FileNotFoundException
Constructs a metric file reader for reading metric files from the specified file.

Parameters:
file - the metric file
Throws:
FileNotFoundException - if the file was not found

MetricFileReader

public MetricFileReader(Reader reader)
Constructs a metric file reader for reading metric files from the underlying reader.

Parameters:
reader - the underlying reader
Method Detail

iterator

public Iterator<double[]> 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<double[]>
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<double[]>
Returns:
true if the iteration has more elements

next

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

Specified by:
next in interface Iterator<double[]>
Returns:
the next element in the iteration

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<double[]>

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

MOEA Framework 2.2
API Specification

Copyright 2009-2014 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