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 Details

    • ResultSeries

      public ResultSeries(IndexType indexType)
      Constructs a new, empty series.
      Parameters:
      indexType - the index type
  • Method Details

    • getIndexType

      public IndexType getIndexType()
      Returns the index type for this series.
      Returns:
      the index type
    • add

      public void add(ResultEntry result)
      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()
      Returns true if this series is empty; false otherwise.
      Returns:
      true if this series is empty; false otherwise
    • first

      public IndexedResult first()
      Returns the first result in this series.
      Returns:
      the first result
      Throws:
      NoSuchElementException - if the series is empty
    • last

      public IndexedResult last()
      Returns the last result in this series.
      Returns:
      the last result
      Throws:
      NoSuchElementException - if the series is empty
    • at

      public IndexedResult at(int index)
      Returns the result at the specified index. The behavior of this method depends on the IndexType.
      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

      public boolean hasNext(IndexedResult current)
      Returns true 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

      public IndexedResult next(IndexedResult current)
      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

      public boolean hasPrevious(IndexedResult current)
      Returns true 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

      public IndexedResult previous(IndexedResult current)
      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 to at(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 to at(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

      public Set<String> getDefinedProperties()
      Returns the set of property keys that are defined in all results contained within this series.
      Returns:
      the set of property keys
    • iterator

      public Iterator<IndexedResult> iterator()
      Specified by:
      iterator in interface Iterable<IndexedResult>
    • asTabularData

      public TabularData<IndexedResult> asTabularData()
      Description copied from interface: Formattable
      Returns the contents of this object as a TabularData instance, which can be used to save, print, or format the data in various ways.
      Specified by:
      asTabularData in interface Formattable<IndexedResult>
      Returns:
      the TabularData instance
    • stream

      public Stream<IndexedResult> stream()
      Description copied from interface: Streamable
      Returns a stream of values represented by this object.
      Specified by:
      stream in interface Streamable<IndexedResult>
      Returns:
      the stream of values
    • of

      public static ResultSeries of(Population population)
      Creates a series containing the given population, typically used to create a reference set.
      Parameters:
      population - the population
      Returns:
      the series
    • of

      public static ResultSeries of(ResultFileReader reader)
      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

      public static ResultSeries of(File file) throws IOException
      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: