All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.barrybecker4.simulation.trading.model.runner.StockSeries Maven / Gradle / Ivy

There is a newer version: 1.6.2
Show newest version
/** Copyright by Barry G. Becker, 2015. Licensed under MIT License: http://www.opensource.org/licenses/MIT  */
package com.barrybecker4.simulation.trading.model.runner;

import com.barrybecker4.common.math.function.Function;

import java.util.LinkedList;


/**
 * A collection of stock market series to show.
 * Just keeps track of the last N series.
 * @author Barry Becker
 */
public class StockSeries extends LinkedList {

    private int maxNum;


    public StockSeries(int maxSeriesToKeep) {
        maxNum = maxSeriesToKeep;
    }

    public boolean add(Function func) {
        boolean success = super.add(func);
        if (size() > maxNum) {
            remove(0);
        }
        return success;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy