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(Date time, TimeZone zone, Locale locale) 

Source Link

Document

Creates a millisecond.

Usage

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

/**
 * In GMT, the 4.55:59.123pm on 21 Mar 2002 is
 * java.util.Date(1016729759123L).  Use this to check the Millisecond
 * constructor.//from   w w  w . j  av a  2  s  .co m
 */
@Test
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Millisecond m1 = new Millisecond(new Date(1016729759122L), zone, locale);
    Millisecond m2 = new Millisecond(new Date(1016729759123L), zone, locale);

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

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

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

/**
 * In Tallinn, the 4.55:59.123pm on 21 Mar 2002 is
 * java.util.Date(1016722559123L).  Use this to check the Millisecond
 * constructor.//from w w  w.java 2s. c  o  m
 */
@Test
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Millisecond m1 = new Millisecond(new Date(1016722559122L), zone, locale);
    Millisecond m2 = new Millisecond(new Date(1016722559123L), zone, locale);

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

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

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

/**
 * In GMT, the 4.55:59.123pm on 21 Mar 2002 is
 * java.util.Date(1016729759123L).  Use this to check the Millisecond
 * constructor./*from ww  w  . j a  va  2 s  .  co  m*/
 */
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Calendar c = new GregorianCalendar(zone);
    Millisecond m1 = new Millisecond(new Date(1016729759122L), zone, locale);
    Millisecond m2 = new Millisecond(new Date(1016729759123L), zone, locale);

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

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

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

/**
 * In Tallinn, the 4.55:59.123pm on 21 Mar 2002 is
 * java.util.Date(1016722559123L).  Use this to check the Millisecond
 * constructor.//from   w w w .ja  va2s . c o  m
 */
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Calendar c = new GregorianCalendar(zone);
    Millisecond m1 = new Millisecond(new Date(1016722559122L), zone, locale);
    Millisecond m2 = new Millisecond(new Date(1016722559123L), zone, locale);

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

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

From source file:org.esa.beam.timeseries.ui.graph.TimeSeriesGraphModel.java

void updateAnnotation(RasterDataNode raster) {
    removeAnnotation();/*www .j a  v a 2s . c o  m*/

    final AbstractTimeSeries timeSeries = getTimeSeries();
    TimeCoding timeCoding = timeSeries.getRasterTimeMap().get(raster);
    if (timeCoding != null) {
        final ProductData.UTC startTime = timeCoding.getStartTime();
        final Millisecond timePeriod = new Millisecond(startTime.getAsDate(), ProductData.UTC.UTC_TIME_ZONE,
                Locale.getDefault());

        double millisecond = timePeriod.getFirstMillisecond();
        Range valueRange = null;
        for (int i = 0; i < timeSeriesPlot.getRangeAxisCount(); i++) {
            valueRange = Range.combine(valueRange, timeSeriesPlot.getRangeAxis(i).getRange());
        }
        if (valueRange != null) {
            XYAnnotation annotation = new XYLineAnnotation(millisecond, valueRange.getLowerBound(), millisecond,
                    valueRange.getUpperBound());
            timeSeriesPlot.addAnnotation(annotation, true);
        }
    }
}

From source file:edu.fullerton.ldvservlet.SrcList.java

private TimeSeries getTimeSeries(double[][] data, String legend) {
    TimeSeries ts;/*from  ww w  .jav a  2 s  .com*/
    ts = new TimeSeries(legend);
    SimpleTimeZone utctz = new SimpleTimeZone(0, "UTC");
    for (double[] data1 : data) {
        long gps = Math.round(data1[0]);
        long utcms = TimeAndDate.gps2utc(gps) * 1000;
        Date t = new Date(utcms);
        ts.addOrUpdate(new Millisecond(t, utctz, Locale.US), data1[1]);
    }
    return ts;
}