Example usage for org.jfree.data.time Millisecond next

List of usage examples for org.jfree.data.time Millisecond next

Introduction

In this page you can find the example usage for org.jfree.data.time Millisecond next.

Prototype

@Override
public RegularTimePeriod next() 

Source Link

Document

Returns the millisecond following this one.

Usage

From source file:org.jfree.chart.demo.PerformanceTest1.java

@SuppressWarnings({ "rawtypes", "unchecked" })
public static void main3(String as[]) {
    ArrayList arraylist = new ArrayList();
    Millisecond millisecond = new Millisecond();
    for (int i = 0; i < 200; i++) {
        millisecond = (Millisecond) millisecond.next();
        arraylist.add(millisecond);/* w w  w  .  jav  a  2s. c om*/
    }

    for (int j = 0; j < 2000; j++) {
        long l = System.currentTimeMillis();
        Collections.binarySearch(arraylist, new Millisecond());
        long l1 = System.currentTimeMillis();
        System.out.println(j + " --> " + (l1 - l) + " (" + Runtime.getRuntime().freeMemory() + " / "
                + Runtime.getRuntime().totalMemory() + ")");
    }

}

From source file:org.jfree.chart.demo.PerformanceTest1.java

public static void main2(String as[]) {
    PerformanceTest1 performancetest1 = new PerformanceTest1("Performance Test 1");
    performancetest1.pack();// w  w w  . j  ava 2 s . c o  m
    RefineryUtilities.centerFrameOnScreen(performancetest1);
    performancetest1.setVisible(true);
    TimeSeries timeseries = new TimeSeries("Test");
    timeseries.setMaximumItemAge(200L);
    do {
        Millisecond millisecond = new Millisecond();
        long l = System.currentTimeMillis();
        for (int i = 0; i < 200; i++) {
            millisecond = (Millisecond) millisecond.next();
            timeseries.addOrUpdate(millisecond, 1.0D);
        }

        long l1 = System.currentTimeMillis();
        performancetest1.addObservation(l1 - l);
    } while (true);
}

From source file:org.jfree.data.time.MillisecondTest.java

/**
 * Some checks for the testNext() method.
 *///from ww  w  .  j  a va 2  s. c o  m
@Test
public void testNext() {
    Millisecond m = new Millisecond(555, 55, 30, 1, 12, 12, 2000);
    m = (Millisecond) m.next();
    assertEquals(2000, m.getSecond().getMinute().getHour().getYear());
    assertEquals(12, m.getSecond().getMinute().getHour().getMonth());
    assertEquals(12, m.getSecond().getMinute().getHour().getDayOfMonth());
    assertEquals(1, m.getSecond().getMinute().getHour().getHour());
    assertEquals(30, m.getSecond().getMinute().getMinute());
    assertEquals(55, m.getSecond().getSecond());
    assertEquals(556, m.getMillisecond());
    m = new Millisecond(999, 59, 59, 23, 31, 12, 9999);
    assertNull(m.next());
}

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

/**
 * Some checks for the testNext() method.
 *///from w ww .  j  av  a 2 s.  c om
public void testNext() {
    Millisecond m = new Millisecond(555, 55, 30, 1, 12, 12, 2000);
    m = (Millisecond) m.next();
    assertEquals(2000, m.getSecond().getMinute().getHour().getYear());
    assertEquals(12, m.getSecond().getMinute().getHour().getMonth());
    assertEquals(12, m.getSecond().getMinute().getHour().getDayOfMonth());
    assertEquals(1, m.getSecond().getMinute().getHour().getHour());
    assertEquals(30, m.getSecond().getMinute().getMinute());
    assertEquals(55, m.getSecond().getSecond());
    assertEquals(556, m.getMillisecond());
    m = new Millisecond(999, 59, 59, 23, 31, 12, 9999);
    assertNull(m.next());
}