public void BackwardSim(IScope scope, int chartCycle) { this.setResetAllBefore(chartCycle); ArrayList<ChartDataSource> sourcestoremove = new ArrayList<ChartDataSource>(); ArrayList<ChartDataSource> sourcestoadd = new ArrayList<ChartDataSource>(); for (ChartDataSource source : sources) { if (source.isCumulative || source.isCumulativeY) { ChartDataSource newsource = source.getClone(scope, chartCycle); newsource.createInitialSeries(scope); sourcestoremove.add(source); sourcestoadd.add(newsource); } } for (ChartDataSource source : sourcestoremove) { sources.remove(source); } for (ChartDataSource source : sourcestoadd) { this.addDataSource(source); } if (this.getXSeriesValues().size() > 0) { ArrayList<Double> ser = this.getXSeriesValues(); for (int i = 0; i < this.getXSeriesValues().size(); i++) { if (ser.get(i) == chartCycle - 1) { this.commonXindex = i; } } } if (this.getYSeriesValues().size() > 0) { ArrayList<Double> sery = this.getYSeriesValues(); for (int i = 0; i < this.getYSeriesValues().size(); i++) { if (sery.get(i) == chartCycle - 1) { this.commonYindex = i; } } } }