List of usage examples for org.jfree.data.time TimePeriodValues getItemCount
@Override public int getItemCount()
From source file:org.jfree.data.time.TimePeriodValuesTest.java
/** * A test for bug report 1161329.//from www. jav a 2 s. c o m */ @Test public void test1161329() { TimePeriodValues tpv = new TimePeriodValues("Test"); RegularTimePeriod t = new Day(); tpv.add(t, 1.0); t = t.next(); tpv.add(t, 2.0); tpv.delete(0, 1); assertEquals(0, tpv.getItemCount()); tpv.add(t, 2.0); assertEquals(1, tpv.getItemCount()); }
From source file:org.jfree.data.time.TimePeriodValuesCollection.java
/** * Returns the range of the values in this dataset's domain. * * @param includeInterval a flag that determines whether or not the * x-interval is taken into account. * * @return The range./*from w w w . ja v a 2s. c o m*/ */ @Override public Range getDomainBounds(boolean includeInterval) { boolean interval = includeInterval || this.domainIsPointsInTime; Range result = null; Range temp = null; Iterator iterator = this.data.iterator(); while (iterator.hasNext()) { TimePeriodValues series = (TimePeriodValues) iterator.next(); int count = series.getItemCount(); if (count > 0) { TimePeriod start = series.getTimePeriod(series.getMinStartIndex()); TimePeriod end = series.getTimePeriod(series.getMaxEndIndex()); if (!interval) { if (this.xPosition == TimePeriodAnchor.START) { TimePeriod maxStart = series.getTimePeriod(series.getMaxStartIndex()); temp = new Range(start.getStart().getTime(), maxStart.getStart().getTime()); } else if (this.xPosition == TimePeriodAnchor.MIDDLE) { TimePeriod minMiddle = series.getTimePeriod(series.getMinMiddleIndex()); long s1 = minMiddle.getStart().getTime(); long e1 = minMiddle.getEnd().getTime(); TimePeriod maxMiddle = series.getTimePeriod(series.getMaxMiddleIndex()); long s2 = maxMiddle.getStart().getTime(); long e2 = maxMiddle.getEnd().getTime(); temp = new Range(s1 + (e1 - s1) / 2, s2 + (e2 - s2) / 2); } else if (this.xPosition == TimePeriodAnchor.END) { TimePeriod minEnd = series.getTimePeriod(series.getMinEndIndex()); temp = new Range(minEnd.getEnd().getTime(), end.getEnd().getTime()); } } else { temp = new Range(start.getStart().getTime(), end.getEnd().getTime()); } result = Range.combine(result, temp); } } return result; }
From source file:org.jfree.data.time.junit.TimePeriodValuesTest.java
/** * A test for bug report 1161329./*from w w w.ja v a 2 s . c o m*/ */ public void test1161329() { TimePeriodValues tpv = new TimePeriodValues("Test"); RegularTimePeriod t = new Day(); tpv.add(t, 1.0); t = t.next(); tpv.add(t, 2.0); tpv.delete(0, 1); assertEquals(0, tpv.getItemCount()); tpv.add(t, 2.0); assertEquals(1, tpv.getItemCount()); }
From source file:org.jfree.data.time.TimePeriodValues.java
/** * Tests the series for equality with another object. * * @param obj the object (<code>null</code> permitted). * * @return <code>true</code> or <code>false</code>. *//*from ww w.jav a 2 s . c o m*/ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TimePeriodValues)) { return false; } if (!super.equals(obj)) { return false; } TimePeriodValues that = (TimePeriodValues) obj; if (!ObjectUtilities.equal(this.getDomainDescription(), that.getDomainDescription())) { return false; } if (!ObjectUtilities.equal(this.getRangeDescription(), that.getRangeDescription())) { return false; } int count = getItemCount(); if (count != that.getItemCount()) { return false; } for (int i = 0; i < count; i++) { if (!getDataItem(i).equals(that.getDataItem(i))) { return false; } } return true; }
From source file:org.jfree.data.time.TimePeriodValues.java
/** * Tests the series for equality with another object. * * @param obj the object (<code>null</code> permitted). * * @return <code>true</code> or <code>false</code>. *///from w ww. ja va 2s .c o m @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TimePeriodValues)) { return false; } if (!super.equals(obj)) { return false; } TimePeriodValues that = (TimePeriodValues) obj; if (!ObjectUtilities.equal(this.getDomainDescription(), that.getDomainDescription())) { return false; } if (!ObjectUtilities.equal(this.getRangeDescription(), that.getRangeDescription())) { return false; } int count = getItemCount(); if (count != that.getItemCount()) { return false; } for (int i = 0; i < count; i++) { if (!getDataItem(i).equals(that.getDataItem(i))) { return false; } } return true; }