class TimeSeries implements Serializable {

    public void addTick(Tick tick) {
        if (tick == null) {
            throw new IllegalArgumentException("Cannot add null tick");
        }
        final int lastTickIndex = ticks.size() - 1;
        if (!ticks.isEmpty()) {
            DateTime seriesEndTime = ticks.get(lastTickIndex).getEndTime();
            if (!tick.getEndTime().isAfter(seriesEndTime)) {
                throw new IllegalArgumentException("Cannot add a tick with end time <= to series end time");
            }
        }

        ticks.add(tick);
        if (beginIndex == -1) {
            // Begin index set to 0 only if if wasn't initialized
            beginIndex = 0;
        }
        endIndex++;
        removeExceedingTicks();
    }

    public  TimeSeries(String name, List<Tick> ticks);
    public  TimeSeries(List<Tick> ticks);
    public  TimeSeries(String name);
    public  TimeSeries();
    private  TimeSeries(String name, List<Tick> ticks, int beginIndex, int endIndex, boolean subSeries);

}