List of usage examples for org.jfree.chart.date MonthConstants DECEMBER
int DECEMBER
To view the source code for org.jfree.chart.date MonthConstants DECEMBER.
Click Source Link
From source file:org.jfree.data.time.junit.MonthTest.java
/** * Common test setup./*from www. j ava2 s .co m*/ */ @Override protected void setUp() { this.jan1900 = new Month(MonthConstants.JANUARY, 1900); this.feb1900 = new Month(MonthConstants.FEBRUARY, 1900); this.nov9999 = new Month(MonthConstants.NOVEMBER, 9999); this.dec9999 = new Month(MonthConstants.DECEMBER, 9999); }
From source file:org.jfree.data.time.junit.HourTest.java
/** * Set up an hour equal to hour zero, 1 January 1900. Request the previous * hour, it should be null.//from w w w.jav a 2s . c om */ public void testLastHourPrevious() { Hour last = new Hour(23, new Day(31, MonthConstants.DECEMBER, 9999)); Hour previous = (Hour) last.previous(); assertEquals(22, previous.getHour()); assertEquals(9999, previous.getYear()); }
From source file:org.jfree.data.time.junit.DayTest.java
/** * Set up a day equal to 31 December 9999. Request the previous day, it * should be 30 December 9999.//from w ww.j av a 2 s . c o m */ public void test31Dec9999Previous() { Day dec31st9999 = new Day(31, MonthConstants.DECEMBER, 9999); Day previous = (Day) dec31st9999.previous(); assertEquals(30, previous.getDayOfMonth()); }
From source file:org.jfree.data.time.junit.HourTest.java
/** * Set up an hour equal to hour zero, 1 January 1900. Request the next * hour, it should be null.//w w w.j a va 2s . c o m */ public void testLastHourNext() { Hour last = new Hour(23, new Day(31, MonthConstants.DECEMBER, 9999)); Hour next = (Hour) last.next(); assertNull(next); }
From source file:org.jfree.data.time.junit.DayTest.java
/** * Set up a day equal to 31 December 9999. Request the next day, it should * be null./*from w w w.j a va2 s . c om*/ */ public void test31Dec9999Next() { Day dec31st9999 = new Day(31, MonthConstants.DECEMBER, 9999); Day next = (Day) dec31st9999.next(); assertNull(next); }
From source file:org.jfree.data.time.Month.java
/** * Returns the month preceding this one. Note that the returned * {@link Month} is "pegged" using the default time-zone, irrespective of * the time-zone used to peg of the current month (which is not recorded * anywhere). See the {@link #peg(Calendar)} method. * * @return The month preceding this one. */// w w w. ja va 2s .c om @Override public RegularTimePeriod previous() { Month result; if (this.month != MonthConstants.JANUARY) { result = new Month(this.month - 1, this.year); } else { if (this.year > 1900) { result = new Month(MonthConstants.DECEMBER, this.year - 1); } else { result = null; } } return result; }
From source file:org.jfree.data.time.Month.java
/** * Returns the month following this one. Note that the returned * {@link Month} is "pegged" using the default time-zone, irrespective of * the time-zone used to peg of the current month (which is not recorded * anywhere). See the {@link #peg(Calendar)} method. * * @return The month following this one. *///from ww w . java 2 s . c o m @Override public RegularTimePeriod next() { Month result; if (this.month != MonthConstants.DECEMBER) { result = new Month(this.month + 1, this.year); } else { if (this.year < 9999) { result = new Month(MonthConstants.JANUARY, this.year + 1); } else { result = null; } } return result; }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Some tests to ensure that the createCopy(RegularTimePeriod, * RegularTimePeriod) method is functioning correctly. */// w w w . j a va 2s.c om public void testCreateCopy1() { TimeSeries series = new TimeSeries("Series"); series.add(new Month(MonthConstants.JANUARY, 2003), 45.0); series.add(new Month(MonthConstants.FEBRUARY, 2003), 55.0); series.add(new Month(MonthConstants.JUNE, 2003), 35.0); series.add(new Month(MonthConstants.NOVEMBER, 2003), 85.0); series.add(new Month(MonthConstants.DECEMBER, 2003), 75.0); try { // copy a range before the start of the series data... TimeSeries result1 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.DECEMBER, 2002)); assertEquals(0, result1.getItemCount()); // copy a range that includes only the first item in the series... TimeSeries result2 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.JANUARY, 2003)); assertEquals(1, result2.getItemCount()); // copy a range that begins before and ends in the middle of the // series... TimeSeries result3 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.APRIL, 2003)); assertEquals(2, result3.getItemCount()); TimeSeries result4 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.DECEMBER, 2003)); assertEquals(5, result4.getItemCount()); TimeSeries result5 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.MARCH, 2004)); assertEquals(5, result5.getItemCount()); TimeSeries result6 = series.createCopy(new Month(MonthConstants.JANUARY, 2003), new Month(MonthConstants.JANUARY, 2003)); assertEquals(1, result6.getItemCount()); TimeSeries result7 = series.createCopy(new Month(MonthConstants.JANUARY, 2003), new Month(MonthConstants.APRIL, 2003)); assertEquals(2, result7.getItemCount()); TimeSeries result8 = series.createCopy(new Month(MonthConstants.JANUARY, 2003), new Month(MonthConstants.DECEMBER, 2003)); assertEquals(5, result8.getItemCount()); TimeSeries result9 = series.createCopy(new Month(MonthConstants.JANUARY, 2003), new Month(MonthConstants.MARCH, 2004)); assertEquals(5, result9.getItemCount()); TimeSeries result10 = series.createCopy(new Month(MonthConstants.MAY, 2003), new Month(MonthConstants.DECEMBER, 2003)); assertEquals(3, result10.getItemCount()); TimeSeries result11 = series.createCopy(new Month(MonthConstants.MAY, 2003), new Month(MonthConstants.MARCH, 2004)); assertEquals(3, result11.getItemCount()); TimeSeries result12 = series.createCopy(new Month(MonthConstants.DECEMBER, 2003), new Month(MonthConstants.DECEMBER, 2003)); assertEquals(1, result12.getItemCount()); TimeSeries result13 = series.createCopy(new Month(MonthConstants.DECEMBER, 2003), new Month(MonthConstants.MARCH, 2004)); assertEquals(1, result13.getItemCount()); TimeSeries result14 = series.createCopy(new Month(MonthConstants.JANUARY, 2004), new Month(MonthConstants.MARCH, 2004)); assertEquals(0, result14.getItemCount()); } catch (CloneNotSupportedException e) { assertTrue(false); } }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Some tests to ensure that the createCopy(int, int) method is * functioning correctly./*from w w w . ja v a2s. c om*/ */ public void testCreateCopy2() { TimeSeries series = new TimeSeries("Series"); series.add(new Month(MonthConstants.JANUARY, 2003), 45.0); series.add(new Month(MonthConstants.FEBRUARY, 2003), 55.0); series.add(new Month(MonthConstants.JUNE, 2003), 35.0); series.add(new Month(MonthConstants.NOVEMBER, 2003), 85.0); series.add(new Month(MonthConstants.DECEMBER, 2003), 75.0); try { // copy just the first item... TimeSeries result1 = series.createCopy(0, 0); assertEquals(new Month(1, 2003), result1.getTimePeriod(0)); // copy the first two items... result1 = series.createCopy(0, 1); assertEquals(new Month(2, 2003), result1.getTimePeriod(1)); // copy the middle three items... result1 = series.createCopy(1, 3); assertEquals(new Month(2, 2003), result1.getTimePeriod(0)); assertEquals(new Month(11, 2003), result1.getTimePeriod(2)); // copy the last two items... result1 = series.createCopy(3, 4); assertEquals(new Month(11, 2003), result1.getTimePeriod(0)); assertEquals(new Month(12, 2003), result1.getTimePeriod(1)); // copy the last item... result1 = series.createCopy(4, 4); assertEquals(new Month(12, 2003), result1.getTimePeriod(0)); } catch (CloneNotSupportedException e) { assertTrue(false); } // check negative first argument boolean pass = false; try { /* TimeSeries result = */ series.createCopy(-1, 1); } catch (IllegalArgumentException e) { pass = true; } catch (CloneNotSupportedException e) { pass = false; } assertTrue(pass); // check second argument less than first argument pass = false; try { /* TimeSeries result = */ series.createCopy(1, 0); } catch (IllegalArgumentException e) { pass = true; } catch (CloneNotSupportedException e) { pass = false; } assertTrue(pass); TimeSeries series2 = new TimeSeries("Series 2"); try { TimeSeries series3 = series2.createCopy(99, 999); assertEquals(0, series3.getItemCount()); } catch (CloneNotSupportedException e) { assertTrue(false); } }