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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ResultEntry result) Adds a new result entry to this series.Returns the contents of this object as aTabularDatainstance, 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.intReturns the ending or maximum index of this series.Returns the index type for this series.intReturns the starting or minimum index of this series.booleanhasNext(IndexedResult current) Returnstrueif there exists a result immediately following the current entry.booleanhasPrevious(IndexedResult current) Returnstrueif there exists a result immediately before the current entry.booleanisEmpty()Returnstrueif this series is empty;falseotherwise.iterator()last()Returns the last result in this series.next(IndexedResult current) Returns the result immediately following the current entry.static ResultSeriesCreates a series containing the populations contained in a result file.static ResultSeriesof(ResultFileReader reader) Creates a series containing the populations contained in a result file.static ResultSeriesof(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.intsize()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, waitMethods inherited from interface org.moeaframework.util.format.Displayable
displayMethods inherited from interface org.moeaframework.util.format.Formattable
display, display, display, save, save, saveMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods 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()Returnstrueif this series is empty;falseotherwise.- Returns:
trueif this series is empty;falseotherwise
-
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
Returnstrueif there exists a result immediately following the current entry.- Parameters:
current- the current entry- Returns:
trueif 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
Returnstrueif there exists a result immediately before the current entry.- Parameters:
current- the current entry- Returns:
trueif there exists a result immediately before the current entry;falseotherwise
-
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:
iteratorin interfaceIterable<IndexedResult>
-
asTabularData
Description copied from interface:FormattableReturns the contents of this object as aTabularDatainstance, which can be used to save, print, or format the data in various ways.- Specified by:
asTabularDatain interfaceFormattable<IndexedResult>- Returns:
- the
TabularDatainstance
-
stream
Description copied from interface:StreamableReturns a stream of values represented by this object.- Specified by:
streamin 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:
-