Package org.moeaframework.analysis.io
Interface OutputWriter
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
MetricFileWriter
,ResultFileWriter
Writes output files. As they allow the
Evaluator
to automatically resume itself at the last known good
result, output writers are expected to cleanup the file and return the number of valid entries through
getNumberOfEntries()
.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Common settings when creating an output writer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(ResultEntry entry) Appends the specified non-dominated population and optional attributes to the file.int
Returns the number of entries in the file.static boolean
Replaces the destination file with the source file, but only if content is different.
-
Method Details
-
getNumberOfEntries
int getNumberOfEntries()Returns the number of entries in the file. If the file already existed, this returns the number of complete entries in the output file. This value is incremented on every invocation to theappend(org.moeaframework.analysis.io.ResultEntry)
method.- Returns:
- the number of entries in the file
-
append
Appends the specified non-dominated population and optional attributes to the file.- Parameters:
entry
- the non-dominated population and optional attributes- Throws:
IOException
- if an I/O error occurred
-
replace
Replaces the destination file with the source file, but only if content is different. This avoids changing the modification timestamp on the file if the files are identical.- Parameters:
source
- the source file, which is required to existdestination
- the destination file, which might not exist- Returns:
true
if the destination was updated;false
otherwise- Throws:
IOException
- if an I/O error occurred
-