Class ResultSeries
java.lang.Object
org.moeaframework.analysis.series.ResultSeries
- All Implemented Interfaces:
Serializable
,Iterable<IndexedResult>
,Streamable<IndexedResult>
,Displayable
,Formattable<IndexedResult>
public class ResultSeries
extends Object
implements Serializable, Iterable<IndexedResult>, Formattable<IndexedResult>, Streamable<IndexedResult>
Stores a collection
ResultEntry
in a series ordered by the index. The specification of the index along with
the behavior depends on the selected IndexType
.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(ResultEntry result) Adds a new result entry to this series.Returns the contents of this object as aTabularData
instance, which can be used to save, print, or format the data in various ways.at
(int index) Returns the result at the specified index.first()
Returns the first result in this series.Returns the set of property keys that are defined in all results contained within this series.int
Returns the ending or maximum index of this series.Returns the index type for this series.int
Returns the starting or minimum index of this series.boolean
hasNext
(IndexedResult current) Returnstrue
if there exists a result immediately following the current entry.boolean
hasPrevious
(IndexedResult current) Returnstrue
if there exists a result immediately before the current entry.boolean
isEmpty()
Returnstrue
if this series is empty;false
otherwise.iterator()
last()
Returns the last result in this series.next
(IndexedResult current) Returns the result immediately following the current entry.static ResultSeries
Creates a series containing the populations contained in a result file.static ResultSeries
of
(ResultFileReader reader) Creates a series containing the populations contained in a result file.static ResultSeries
of
(Population population) Creates a series containing the given population, typically used to create a reference set.previous
(IndexedResult current) Returns the result immediately before the current entry.int
size()
Returns the size of this series.stream()
Returns a stream of values represented by this object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.moeaframework.util.format.Displayable
display
Methods inherited from interface org.moeaframework.util.format.Formattable
display, display, display, save, save, save
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.moeaframework.analysis.stream.Streamable
asDataStream, asPartition
-
Constructor Details
-
ResultSeries
Constructs a new, empty series.- Parameters:
indexType
- the index type
-
-
Method Details
-
getIndexType
Returns the index type for this series.- Returns:
- the index type
-
add
Adds a new result entry to this series.- Parameters:
result
- the result to add
-
size
public int size()Returns the size of this series.- Returns:
- the size of this series
-
isEmpty
public boolean isEmpty()Returnstrue
if this series is empty;false
otherwise.- Returns:
true
if this series is empty;false
otherwise
-
first
Returns the first result in this series.- Returns:
- the first result
- Throws:
NoSuchElementException
- if the series is empty
-
last
Returns the last result in this series.- Returns:
- the last result
- Throws:
NoSuchElementException
- if the series is empty
-
at
Returns the result at the specified index. The behavior of this method depends on theIndexType
.- Parameters:
index
- the index- Returns:
- the result at the specified index
- Throws:
NoSuchElementException
- if the series is empty or no such entry matches the given index
-
hasNext
Returnstrue
if there exists a result immediately following the current entry.- Parameters:
current
- the current entry- Returns:
true
if there exists a result immediately following the current entry
-
next
Returns the result immediately following the current entry.- Parameters:
current
- the current entry- Returns:
- the next entry
- Throws:
NoSuchElementException
- if there are no more results following the current entry
-
hasPrevious
Returnstrue
if there exists a result immediately before the current entry.- Parameters:
current
- the current entry- Returns:
true
if there exists a result immediately before the current entry;false
otherwise
-
previous
Returns the result immediately before the current entry.- Parameters:
current
- the current entry- Returns:
- the previous entry
- Throws:
NoSuchElementException
- if there are no more results before the current entry
-
getStartingIndex
public int getStartingIndex()Returns the starting or minimum index of this series. Calls toat(int)
will succeed if the provided index is within the starting and ending index.- Returns:
- the starting index
- Throws:
NoSuchElementException
- if the series is empty
-
getEndingIndex
public int getEndingIndex()Returns the ending or maximum index of this series. Calls toat(int)
will succeed if the provided index is within the starting and ending index.- Returns:
- the ending index
- Throws:
NoSuchElementException
- if the series is empty
-
getDefinedProperties
Returns the set of property keys that are defined in all results contained within this series.- Returns:
- the set of property keys
-
iterator
- Specified by:
iterator
in interfaceIterable<IndexedResult>
-
asTabularData
Description copied from interface:Formattable
Returns the contents of this object as aTabularData
instance, which can be used to save, print, or format the data in various ways.- Specified by:
asTabularData
in interfaceFormattable<IndexedResult>
- Returns:
- the
TabularData
instance
-
stream
Description copied from interface:Streamable
Returns a stream of values represented by this object.- Specified by:
stream
in interfaceStreamable<IndexedResult>
- Returns:
- the stream of values
-
of
Creates a series containing the given population, typically used to create a reference set.- Parameters:
population
- the population- Returns:
- the series
-
of
Creates a series containing the populations contained in a result file. The result file should contain the property "NFE" on each entry in order to use NFE as the ordering.- Parameters:
reader
- the result file reader- Returns:
- the series
-
of
Creates a series containing the populations contained in a result file.- Parameters:
file
- the result file- Returns:
- the series
- Throws:
IOException
- if an I/O error occurred- See Also:
-