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

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

Introduction

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

Prototype

public Millisecond() 

Source Link

Document

Constructs a millisecond based on the current system time.

Usage

From source file:DynamicDataDemo.java

/**
 * Handles a click on the button by adding new (random) data.
 *
 * @param e  the action event.//from   www . j a  v  a  2s  .com
 */
public void actionPerformed(final ActionEvent e) {
    if (e.getActionCommand().equals("ADD_DATA")) {
        final double factor = 0.90 + 0.2 * Math.random();
        this.lastValue = this.lastValue * factor;
        final Millisecond now = new Millisecond();
        System.out.println("Now = " + now.toString());
        this.series.add(new Millisecond(), this.lastValue);
    }
}

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);//www  .  ja v  a 2 s  . 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:DynamicDataDemo.java

@Override
public void run() {
    // TODO Auto-generated method stub
    while (true) {
        final Millisecond now = new Millisecond();
        // System.out.println("Now = " + now.toString());
        this.series.add(new Millisecond(), this.lastValue);
        try {/*from w  w w .ja v  a  2  s.co  m*/
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:uk.co.petertribble.jkstat.gui.KstatSetAreaChart.java

@Override
public void updateAccessory() {
    for (Kstat ks : kss.getKstats()) {
        readOne(ks, new Millisecond());
    }
}

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

/**
 * Serialize an instance, restore it, and check for equality.
 *///from w  w  w  . j av a 2  s.c  om
@Test
public void testSerialization() {
    Millisecond m1 = new Millisecond();
    Millisecond m2 = (Millisecond) TestUtilities.serialised(m1);
    assertEquals(m1, m2);
}

From source file:openqcm.ChartDynamicData.java

public void addFrequencyData(double frequency) {
    datasetFrequency.getSeries(0).add(new Millisecond(), frequency);
}

From source file:com.okmich.twitanalysis.gui.ApplicationFrame.java

@Override
public void executeAction(final Map<String, Integer> data) {
    executorService.submit(new Runnable() {
        @Override/*ww w  .  ja  va  2s.  com*/
        public void run() {
            int val = 0;
            if (data.containsKey(POSITIVE)) {
                val = data.get(POSITIVE);
                postiveSeries.add(new Millisecond(), val);
                tweetsCount += val;
            }
            if (data.containsKey(NEGATIVE)) {
                val = data.get(NEGATIVE);
                negativeSeries.add(new Millisecond(), val);
                tweetsCount += val;
            }
            if (data.containsKey(NEUTRAL)) {
                val = data.get(NEUTRAL);
                neutralSeries.add(new Millisecond(), val);
                tweetsCount += val;
            }
            setTweetCountLabel();
        }
    });
}

From source file:openqcm.ChartDynamicData.java

public void addTemperatureData(double temperature) {
    datasetTemperature.getSeries(0).add(new Millisecond(), temperature);
}

From source file:com.experiments.DynamicDataDemo.java

/**
 * Handles a click on the button by adding new (random) data.
 * //from  w  w w. j av a2 s .c om
 * @param e
 *            the action event.
 */
public void actionPerformed(final ActionEvent e) {
    if (e.getActionCommand().equals("ADD_DATA")) {
        final double factor = 0.90 + 0.2 * Math.random();
        this.lastValue = this.lastValue * factor;
        final Millisecond now = new Millisecond();
        System.out.println("Now = " + now.toString());
        this.series.add(new Millisecond(), this.lastValue);
    } else if (e.getActionCommand().equals("START_ADDING")) {
        if (timer == null) {
            timer = new Timer(interval, new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    final double factor = 0.90 + 0.2 * Math.random();
                    DynamicDataDemo.this.lastValue = DynamicDataDemo.this.lastValue * factor;
                    final Millisecond now = new Millisecond();
                    System.out.println("Now = " + now.toString());
                    DynamicDataDemo.this.series.add(new Millisecond(), DynamicDataDemo.this.lastValue);
                }

            });
            timer.start();
        }
    } else if (e.getActionCommand().equals("STOP_ADDING")) {
        if (timer != null) {
            timer.stop();
        }
        timer = null;
    }
}

From source file:jfreeechart.DynamicDataDemo.java

public void addPoint(Millisecond time_, double lastValue_) {
    this.lastValue = lastValue_;
    this.series.add(new Millisecond(), this.lastValue);
}