Example usage for org.jfree.chart.date MonthConstants FEBRUARY

List of usage examples for org.jfree.chart.date MonthConstants FEBRUARY

Introduction

In this page you can find the example usage for org.jfree.chart.date MonthConstants FEBRUARY.

Prototype

int FEBRUARY

To view the source code for org.jfree.chart.date MonthConstants FEBRUARY.

Click Source Link

Document

Constant for February.

Usage

From source file:org.jfree.data.time.junit.MonthTest.java

/**
 * Common test setup.// w  ww.j a  va  2  s .c  om
 */
@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.DayTest.java

/**
 * In GMT, the end of 29 Feb 2004 is java.util.Date(1,078,099,199,999L).
 * Use this to check the day constructor.
 *//*w w  w .j  a v  a 2s  . co m*/
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.UK;
    Day d1 = new Day(new Date(1078099199999L), zone, locale);
    Day d2 = new Day(new Date(1078099200000L), zone, locale);

    assertEquals(MonthConstants.FEBRUARY, d1.getMonth());
    assertEquals(1078099199999L, d1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, d2.getMonth());
    assertEquals(1078099200000L, d2.getFirstMillisecond(c));
}

From source file:org.jfree.data.time.junit.MonthTest.java

/**
 * In GMT, the end of Feb 2000 is java.util.Date(951,868,799,999L).  Use
 * this to check the Month constructor./*from   w  ww. ja  v a 2 s .co  m*/
 */
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.UK;
    Month m1 = new Month(new Date(951868799999L), zone, locale);
    Month m2 = new Month(new Date(951868800000L), zone, locale);

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951868799999L, m1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951868800000L, m2.getFirstMillisecond(c));

}

From source file:org.jfree.data.time.junit.DayTest.java

/**
 * In Helsinki, the end of 29 Feb 2004 is
 * java.util.Date(1,078,091,999,999L).  Use this to check the Day
 * constructor.// ww w  .j a  va 2  s. c  om
 */
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Europe/Helsinki");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Day d1 = new Day(new Date(1078091999999L), zone, locale);
    Day d2 = new Day(new Date(1078092000000L), zone, locale);

    assertEquals(MonthConstants.FEBRUARY, d1.getMonth());
    assertEquals(1078091999999L, d1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, d2.getMonth());
    assertEquals(1078092000000L, d2.getFirstMillisecond(c));
}

From source file:org.jfree.data.time.junit.MonthTest.java

/**
 * In Auckland, the end of Feb 2000 is java.util.Date(951,821,999,999L).
 * Use this to check the Month constructor.
 *//*from   w  ww .j a v a 2s.  co m*/
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("Pacific/Auckland");
    Calendar c = new GregorianCalendar(zone);
    Month m1 = new Month(new Date(951821999999L), zone, Locale.UK);
    Month m2 = new Month(new Date(951822000000L), zone, Locale.UK);

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951821999999L, m1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951822000000L, m2.getFirstMillisecond(c));

}

From source file:org.jfree.data.time.junit.TimeSeriesTest.java

/**
 * Some tests to ensure that the createCopy(RegularTimePeriod,
 * RegularTimePeriod) method is functioning correctly.
 *///  www  .  j  a v a 2 s.c o  m
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./* ww  w  . j  a  v a2 s. c o  m*/
 */
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);
    }
}