data
Class OptimizationDataHandler

java.lang.Object
  extended by data.DataHandler
      extended by data.OptimizationDataHandler

public class OptimizationDataHandler
extends DataHandler

Extends DataHandler by supporting a getBestDesign() method: automatically orders DataPoints as they are added, using a DataPointComparer. Perhaps this can be modified to support other comparators as well.

Author:
dgorur

Field Summary
 
Fields inherited from class data.DataHandler
lastBlock
 
Constructor Summary
OptimizationDataHandler()
          Default constructor.
OptimizationDataHandler(java.util.Comparator<DataPoint> comparator)
          Constructs an OptimizationDataHandler using the supplied comparator to sort designs.
 
Method Summary
 boolean add(DataPoint dataPoint)
          Adds the given DataPoint to the set of data.
 void clear()
          Clears all data.
 DataPoint getBestDesign()
          Returns the best design in the set of data.
 DataPoint remove(int index)
          Removes the DataPoint at the specified index.
 
Methods inherited from class data.DataHandler
addBlock, addListener, contains, get, getDataListeners, indexOf, isEmpty, iterator, remove, removeLastBlock, removeListener, removeRange, size, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptimizationDataHandler

public OptimizationDataHandler()
Default constructor.


OptimizationDataHandler

public OptimizationDataHandler(java.util.Comparator<DataPoint> comparator)
Constructs an OptimizationDataHandler using the supplied comparator to sort designs.

Parameters:
comparator - the given comparator.
Method Detail

add

public boolean add(DataPoint dataPoint)
Description copied from class: DataHandler
Adds the given DataPoint to the set of data. Notifies DataListeners of the addition.

Overrides:
add in class DataHandler
Parameters:
dataPoint - the given DataPoint.
See Also:
ArrayList.add(java.lang.Object)

clear

public void clear()
Description copied from class: DataHandler
Clears all data. Notifies its DataListeners of the change.

Overrides:
clear in class DataHandler
See Also:
ArrayList.clear()

getBestDesign

public DataPoint getBestDesign()
Returns the best design in the set of data.

Returns:
the best design, as determined by a DataPointComparer.

remove

public DataPoint remove(int index)
Description copied from class: DataHandler
Removes the DataPoint at the specified index. Notifies DataListeners.

Overrides:
remove in class DataHandler
See Also:
ArrayList.remove(int)