MOEA Framework 2.12
API Specification

org.moeaframework.analysis.collector
Class Accumulator

java.lang.Object
  extended by org.moeaframework.analysis.collector.Accumulator
All Implemented Interfaces:
Serializable

public class Accumulator
extends Object
implements Serializable

An accumulator stores collected data from a single run of an algorithm.

See Also:
Serialized Form

Constructor Summary
Accumulator()
          Constructs an empty accumulator.
 
Method Summary
 void add(String key, Serializable value)
          Adds the data to the sequence of observations with the specified key.
 Serializable get(String key, int index)
          Returns the value at the specified index for the specified key.
 Set<String> keySet()
          Returns the set of keys stored in this accumulator.
 void saveCSV(File file)
          Saves the contests of this accumulator to a CSV file.
 int size(String key)
          Returns the number of values stored for the specified key.
 String toCSV()
          Returns the contents of this accumulator as a string in CSV format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Accumulator

public Accumulator()
Constructs an empty accumulator.

Method Detail

add

public void add(String key,
                Serializable value)
Adds the data to the sequence of observations with the specified key.

Parameters:
key - the key of this observation
value - the value of this observation

keySet

public Set<String> keySet()
Returns the set of keys stored in this accumulator.

Returns:
the set of keys stored in this accumulator

get

public Serializable get(String key,
                        int index)
Returns the value at the specified index for the specified key.

Parameters:
key - the key
index - the index
Returns:
the value at the specified index for the specified key
Throws:
IllegalArgumentException - if the key was not contained in this accumulator
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size(key))

size

public int size(String key)
Returns the number of values stored for the specified key.

Parameters:
key - the key
Returns:
the number of values stored for the specified key
Throws:
IllegalArgumentException - if the key was not contained in this accumulator

saveCSV

public void saveCSV(File file)
             throws IOException
Saves the contests of this accumulator to a CSV file.

Parameters:
file - the file to create
Throws:
IOException - if an I/O error occurred

toCSV

public String toCSV()
Returns the contents of this accumulator as a string in CSV format.

Returns:
the contents of this accumulator as a string in CSV format

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!