@Test public void testAdditionOfDuplicatePeriod() { OHLCSeries s1 = new OHLCSeries("s1"); s1.add(new Year(2006), 1.0, 1.0, 1.0, 1.0); try { s1.add(new Year(2006), 1.0, 1.0, 1.0, 1.0); fail("Should have thrown a SeriesException on duplicate value"); } catch (SeriesException e) { assertEquals("X-value already exists.", e.getMessage()); } }
public void add(RegularTimePeriod period, double open, double high, double low, double close) { if (getItemCount() > 0) { OHLCItem item0 = (OHLCItem) this.getDataItem(0); if (!period.getClass().equals(item0.getPeriod().getClass())) { throw new IllegalArgumentException( "Can't mix RegularTimePeriod class types."); } } super.add(new OHLCItem(period, open, high, low, close), true); }
OHLCSeries extends ComparableObjectSeries { public void add(RegularTimePeriod period, double open, double high, double low, double close) { if (getItemCount() > 0) { OHLCItem item0 = (OHLCItem) this.getDataItem(0); if (!period.getClass().equals(item0.getPeriod().getClass())) { throw new IllegalArgumentException( "Can't mix RegularTimePeriod class types."); } } super.add(new OHLCItem(period, open, high, low, close), true); } }
OHLCSeries extends ComparableObjectSeries { public void add(RegularTimePeriod period, double open, double high, double low, double close) { if (getItemCount() > 0) { OHLCItem item0 = (OHLCItem) this.getDataItem(0); if (!period.getClass().equals(item0.getPeriod().getClass())) { throw new IllegalArgumentException( "Can't mix RegularTimePeriod class types."); } } super.add(new OHLCItem(period, open, high, low, close), true); } OHLCSeries(Comparable key); }
OHLCSeries extends ComparableObjectSeries { public void add(RegularTimePeriod period, double open, double high, double low, double close) { if (getItemCount() > 0) { OHLCItem item0 = (OHLCItem) this.getDataItem(0); if (!period.getClass().equals(item0.getPeriod().getClass())) { throw new IllegalArgumentException( "Can't mix RegularTimePeriod class types."); } } super.add(new OHLCItem(period, open, high, low, close), true); } OHLCSeries(Comparable key); RegularTimePeriod getPeriod(int index); @Override ComparableObjectItem getDataItem(int index); void add(RegularTimePeriod period, double open, double high,
            double low, double close); void add(OHLCItem item); @Override ComparableObjectItem remove(int index); }
OHLCSeries extends ComparableObjectSeries { public void add(RegularTimePeriod period, double open, double high, double low, double close) { if (getItemCount() > 0) { OHLCItem item0 = (OHLCItem) this.getDataItem(0); if (!period.getClass().equals(item0.getPeriod().getClass())) { throw new IllegalArgumentException( "Can't mix RegularTimePeriod class types."); } } super.add(new OHLCItem(period, open, high, low, close), true); } OHLCSeries(Comparable key); RegularTimePeriod getPeriod(int index); @Override ComparableObjectItem getDataItem(int index); void add(RegularTimePeriod period, double open, double high,
            double low, double close); void add(OHLCItem item); @Override ComparableObjectItem remove(int index);  }