Package org.jfree.data.time

Examples of org.jfree.data.time.Millisecond


   
    public void update() {
      long time = cpu.cycles / 2;
      if (time > lastUpdate) {
        lastUpdate = time;
        timeSeries.add(new Millisecond(new Date(time)), dataSource.getValue());
      } else {
//        System.out.println("IGNORING TIME " + time);
      }
    }
View Full Code Here


     * Problem that a Day instance is equal to itself.
     *
     * SourceForge Bug ID: 558850.
     */
    public void testEqualsSelf() {
        final Millisecond millisecond = new Millisecond();
        assertTrue(millisecond.equals(millisecond));
    }
View Full Code Here

    public void testEquals() {
        final Day day1 = new Day(29, SerialDate.MARCH, 2002);
        final Hour hour1 = new Hour(15, day1);
        final Minute minute1 = new Minute(15, hour1);
        final Second second1 = new Second(34, minute1);
        final Millisecond milli1 = new Millisecond(999, second1);
        final Day day2 = new Day(29, SerialDate.MARCH, 2002);
        final Hour hour2 = new Hour(15, day2);
        final Minute minute2 = new Minute(15, hour2);
        final Second second2 = new Second(34, minute2);
        final Millisecond milli2 = new Millisecond(999, second2);
        assertTrue(milli1.equals(milli2));
    }
View Full Code Here

     * Use this to check the Second constructor.
     */
    public void testDateConstructor1() {

        final TimeZone zone = TimeZone.getTimeZone("GMT");
        final Millisecond m1 = new Millisecond(new Date(1016729759122L), zone);
        final Millisecond m2 = new Millisecond(new Date(1016729759123L), zone);

        assertEquals(122, m1.getMillisecond());
        assertEquals(1016729759122L, m1.getLastMillisecond(zone));

        assertEquals(123, m2.getMillisecond());
        assertEquals(1016729759123L, m2.getFirstMillisecond(zone));

    }
View Full Code Here

     * Use this to check the Second constructor.
     */
    public void testDateConstructor2() {

        final TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn");
        final Millisecond m1 = new Millisecond(new Date(1016722559122L), zone);
        final Millisecond m2 = new Millisecond(new Date(1016722559123L), zone);

        assertEquals(122, m1.getMillisecond());
        assertEquals(1016722559122L, m1.getLastMillisecond(zone));

        assertEquals(123, m2.getMillisecond());
        assertEquals(1016722559123L, m2.getFirstMillisecond(zone));

    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        final Millisecond m1 = new Millisecond();
        Millisecond m2 = null;

        try {
            final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            final ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(m1);
View Full Code Here

   
    /**
     * Two objects that are equal are required to return the same hashCode.
     */
    public void testHashcode() {
        final Millisecond m1 = new Millisecond(599, 23, 45, 7, 9, 10, 2007);
        final Millisecond m2 = new Millisecond(599, 23, 45, 7, 9, 10, 2007);
        assertTrue(m1.equals(m2));
        final int hash1 = m1.hashCode();
        final int hash2 = m2.hashCode();
        assertEquals(hash1, hash2);
    }
View Full Code Here

    /**
     * A test for bug report 943985 - the calculation for the middle millisecond is
     * incorrect for odd milliseconds.
     */
    public void test943985() {
        Millisecond ms = new Millisecond(new java.util.Date(4));
        assertEquals(ms.getFirstMillisecond(), ms.getMiddleMillisecond());
        assertEquals(ms.getMiddleMillisecond(), ms.getLastMillisecond());
        ms = new Millisecond(new java.util.Date(5));
        assertEquals(ms.getFirstMillisecond(), ms.getMiddleMillisecond());
        assertEquals(ms.getMiddleMillisecond(), ms.getLastMillisecond());
    }
View Full Code Here

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

    public void testEquals() {
        Day day1 = new Day(29, MonthConstants.MARCH, 2002);
        Hour hour1 = new Hour(15, day1);
        Minute minute1 = new Minute(15, hour1);
        Second second1 = new Second(34, minute1);
        Millisecond milli1 = new Millisecond(999, second1);
        Day day2 = new Day(29, MonthConstants.MARCH, 2002);
        Hour hour2 = new Hour(15, day2);
        Minute minute2 = new Minute(15, hour2);
        Second second2 = new Second(34, minute2);
        Millisecond milli2 = new Millisecond(999, second2);
        assertTrue(milli1.equals(milli2));
    }
View Full Code Here

TOP

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

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.