Package org.jfree.data.time

Examples of org.jfree.data.time.Quarter


   
    /**
     * Some checks for the getSerialIndex() method.
     */
    public void testGetSerialIndex() {
        Quarter q = new Quarter(1, 2000);
        assertEquals(8001L, q.getSerialIndex());
        q = new Quarter(1, 1900);
        assertEquals(7601L, q.getSerialIndex());
    }
View Full Code Here


   
    /**
     * Some checks for the testNext() method.
     */
    public void testNext() {
        Quarter q = new Quarter(1, 2000);
        q = (Quarter) q.next();
        assertEquals(new Year(2000), q.getYear());
        assertEquals(2, q.getQuarter());
        q = new Quarter(4, 9999);
        assertNull(q.next());
    }
View Full Code Here

        Locale saved = Locale.getDefault();
        Locale.setDefault(Locale.ITALY);
        Calendar cal = Calendar.getInstance(Locale.ITALY);
        cal.set(2006, Calendar.JULY, 1, 0, 0, 0);
        cal.set(Calendar.MILLISECOND, 0);
        Quarter q = new Quarter(3, 2006);
        assertEquals(cal.getTime(), q.getStart());
        Locale.setDefault(saved);       
    }
View Full Code Here

        Locale saved = Locale.getDefault();
        Locale.setDefault(Locale.ITALY);
        Calendar cal = Calendar.getInstance(Locale.ITALY);
        cal.set(2006, Calendar.MARCH, 31, 23, 59, 59);
        cal.set(Calendar.MILLISECOND, 999);
        Quarter q = new Quarter(1, 2006);
        assertEquals(cal.getTime(), q.getEnd());
        Locale.setDefault(saved);               
    }
View Full Code Here

            setAtDayEnd(calendarTo);
            return new Calendar[] {calendarFrom, calendarTo};
        }

        public static Calendar[] getThisQuarter(Calendar referenceCalendar) {
            Quarter quarter = new Quarter(referenceCalendar.getTime());
            Calendar startCal = getInstance();
            Calendar endCal = getInstance();
            long start = quarter.getFirstMillisecond(getInstance());
            long end = quarter.getLastMillisecond(getInstance());
            startCal.setTimeInMillis(start);
            endCal.setTimeInMillis(end);
            return new Calendar[] {startCal, endCal};
        }
View Full Code Here

            endCal.setTimeInMillis(end);
            return new Calendar[] {startCal, endCal};
        }

        public static Calendar[] getLastQuarter(Calendar referenceCalendar) {
            Quarter quarter = new Quarter(referenceCalendar.getTime());
            Calendar startCal = getInstance();
            Calendar endCal = getInstance();
            long start = quarter.previous().getFirstMillisecond(getInstance());
            long end = quarter.previous().getLastMillisecond(getInstance());
            startCal.setTimeInMillis(start);
            endCal.setTimeInMillis(end);
            return new Calendar[] {startCal, endCal};
        }
View Full Code Here

    /**
     * Common test setup.
     */
    protected void setUp() {
        this.q1Y1900 = new Quarter(1, 1900);
        this.q2Y1900 = new Quarter(2, 1900);
        this.q3Y9999 = new Quarter(3, 9999);
        this.q4Y9999 = new Quarter(4, 9999);
    }
View Full Code Here

     * Check that a Quarter instance is equal to itself.
     *
     * SourceForge Bug ID: 558850.
     */
    public void testEqualsSelf() {
        Quarter quarter = new Quarter();
        assertTrue(quarter.equals(quarter));
    }
View Full Code Here

    /**
     * Tests the equals method.
     */
    public void testEquals() {
        Quarter q1 = new Quarter(2, 2002);
        Quarter q2 = new Quarter(2, 2002);
        assertTrue(q1.equals(q2));
    }
View Full Code Here

     * to check the quarter constructor.
     */
    public void testDateConstructor1() {

        TimeZone zone = TimeZone.getTimeZone("GMT");
        Quarter q1 = new Quarter(new Date(1017619199999L), zone);
        Quarter q2 = new Quarter(new Date(1017619200000L), zone);

        assertEquals(1, q1.getQuarter());
        assertEquals(1017619199999L, q1.getLastMillisecond(zone));

        assertEquals(2, q2.getQuarter());
        assertEquals(1017619200000L, q2.getFirstMillisecond(zone));

    }
View Full Code Here

TOP

Related Classes of org.jfree.data.time.Quarter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.