当前位置: 首页>>代码示例>>Java>>正文


Java Millisecond.getFirstMillisecond方法代码示例

本文整理汇总了Java中org.jfree.data.time.Millisecond.getFirstMillisecond方法的典型用法代码示例。如果您正苦于以下问题:Java Millisecond.getFirstMillisecond方法的具体用法?Java Millisecond.getFirstMillisecond怎么用?Java Millisecond.getFirstMillisecond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.data.time.Millisecond的用法示例。


在下文中一共展示了Millisecond.getFirstMillisecond方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetFirstMillisecondWithTimeZone

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Millisecond m = new Millisecond(500, 50, 59, 15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-623289609500L, m.getFirstMillisecond(zone));
    
    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:MillisecondTests.java

示例2: testGetFirstMillisecondWithCalendar

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Millisecond m = new Millisecond(500, 55, 40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(955762855500L, m.getFirstMillisecond(calendar));
    
    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:MillisecondTests.java

示例3: testGetFirstMillisecondWithTimeZone

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Millisecond m = new Millisecond(500, 50, 59, 15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-623289609500L, m.getFirstMillisecond(c));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:MillisecondTests.java

示例4: testGetFirstMillisecondWithCalendar

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Millisecond m = new Millisecond(500, 55, 40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766455500L, m.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:MillisecondTests.java

示例5: updateAnnotation

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
void updateAnnotation(RasterDataNode raster) {
    removeAnnotation();

    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);
        }
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:24,代码来源:TimeSeriesGraphModel.java

示例6: testPreviousStandardDateMillisecondA

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * A basic check for the testPreviousStandardDate() method when the
 * tick unit is 1 millisecond.
 */
@Test
public void testPreviousStandardDateMillisecondA() {
    MyDateAxis axis = new MyDateAxis("Millisecond");
    Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007);
    Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007);

    Date d0 = new Date(m0.getFirstMillisecond());
    Date end = new Date(m1.getLastMillisecond());

    DateTickUnit unit = new DateTickUnit(DateTickUnit.MILLISECOND, 1);
    axis.setTickUnit(unit);

    // START: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.START);

    axis.setRange(d0, end);
    Date psd = axis.previousStandardDate(d0, unit);
    Date nsd = unit.addToDate(psd);
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // MIDDLE: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd);
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // END: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.END);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd);
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:44,代码来源:DateAxisTest.java

示例7: testPreviousStandardDateMillisecondB

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * A basic check for the testPreviousStandardDate() method when the
 * tick unit is 10 milliseconds (just for the sake of having a multiple).
 */
@Test
public void testPreviousStandardDateMillisecondB() {
    MyDateAxis axis = new MyDateAxis("Millisecond");
    Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007);
    Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007);

    Date d0 = new Date(m0.getFirstMillisecond());
    Date end = new Date(m1.getLastMillisecond());

    DateTickUnit unit = new DateTickUnit(DateTickUnit.MILLISECOND, 10);
    axis.setTickUnit(unit);

    // START: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.START);

    axis.setRange(d0, end);
    Date psd = axis.previousStandardDate(d0, unit);
    Date nsd = unit.addToDate(psd);
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // MIDDLE: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd);
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // END: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.END);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd);
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:44,代码来源:DateAxisTest.java

示例8: testPreviousStandardDateMillisecondA

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * A basic check for the testPreviousStandardDate() method when the
 * tick unit is 1 millisecond.
 */
@Test
public void testPreviousStandardDateMillisecondA() {
    MyDateAxis axis = new MyDateAxis("Millisecond");
    Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007);
    Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007);

    Date d0 = new Date(m0.getFirstMillisecond());
    Date end = new Date(m1.getLastMillisecond());

    DateTickUnit unit = new DateTickUnit(DateTickUnitType.MILLISECOND, 1);
    axis.setTickUnit(unit);

    // START: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.START);

    axis.setRange(d0, end);
    Date psd = axis.previousStandardDate(d0, unit);
    Date nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // MIDDLE: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // END: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.END);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:44,代码来源:DateAxisTest.java

示例9: testPreviousStandardDateMillisecondB

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * A basic check for the testPreviousStandardDate() method when the
 * tick unit is 10 milliseconds (just for the sake of having a multiple).
 */
@Test
public void testPreviousStandardDateMillisecondB() {
    MyDateAxis axis = new MyDateAxis("Millisecond");
    Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007);
    Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007);

    Date d0 = new Date(m0.getFirstMillisecond());
    Date end = new Date(m1.getLastMillisecond());

    DateTickUnit unit = new DateTickUnit(DateTickUnitType.MILLISECOND, 10);
    axis.setTickUnit(unit);

    // START: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.START);

    axis.setRange(d0, end);
    Date psd = axis.previousStandardDate(d0, unit);
    Date nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // MIDDLE: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // END: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.END);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:44,代码来源:DateAxisTest.java

示例10: testPreviousStandardDateMillisecondA

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * A basic check for the testPreviousStandardDate() method when the
 * tick unit is 1 millisecond.
 */
public void testPreviousStandardDateMillisecondA() {
    MyDateAxis axis = new MyDateAxis("Millisecond");
    Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007);
    Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007);

    Date d0 = new Date(m0.getFirstMillisecond());
    Date end = new Date(m1.getLastMillisecond());

    DateTickUnit unit = new DateTickUnit(DateTickUnitType.MILLISECOND, 1);
    axis.setTickUnit(unit);

    // START: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.START);

    axis.setRange(d0, end);
    Date psd = axis.previousStandardDate(d0, unit);
    Date nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // MIDDLE: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // END: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.END);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:43,代码来源:DateAxisTests.java

示例11: testPreviousStandardDateMillisecondB

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * A basic check for the testPreviousStandardDate() method when the
 * tick unit is 10 milliseconds (just for the sake of having a multiple).
 */
public void testPreviousStandardDateMillisecondB() {
    MyDateAxis axis = new MyDateAxis("Millisecond");
    Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007);
    Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007);

    Date d0 = new Date(m0.getFirstMillisecond());
    Date end = new Date(m1.getLastMillisecond());

    DateTickUnit unit = new DateTickUnit(DateTickUnitType.MILLISECOND, 10);
    axis.setTickUnit(unit);

    // START: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.START);

    axis.setRange(d0, end);
    Date psd = axis.previousStandardDate(d0, unit);
    Date nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // MIDDLE: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());

    // END: check d0
    axis.setTickMarkPosition(DateTickMarkPosition.END);

    axis.setRange(d0, end);
    psd = axis.previousStandardDate(d0, unit);
    nsd = unit.addToDate(psd, TimeZone.getDefault());
    assertTrue(psd.getTime() < d0.getTime());
    assertTrue(nsd.getTime() >= d0.getTime());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:43,代码来源:DateAxisTests.java

示例12: testBug25

import org.jfree.data.time.Millisecond; //导入方法依赖的package包/类
/**
 * Test for bug #25 at Github.
 * 
 * https://github.com/jfree/jfreechart/issues/25
 * 
 */
@Test
public void testBug25() {
    TimeZone tz = TimeZone.getTimeZone("GMT");
    GregorianCalendar cal = new GregorianCalendar(tz, Locale.UK);
    
    MyDateAxis axis = new MyDateAxis("25");
    axis.setTimeZone(tz);
    
    // YEAR
    DateTickUnit ydtu = new DateTickUnit(DateTickUnitType.YEAR, 5);
    Year y = new Year(2015);
    long ymillis = y.getFirstMillisecond(cal); // 1420070400000L
    Date yprev = axis.previousStandardDate(new Date(ymillis), ydtu);
    assertEquals(new Year(2010).getFirstMillisecond(cal), yprev.getTime());
    
    // MONTH 
    DateTickUnit mdtu = new DateTickUnit(DateTickUnitType.MONTH, 3);
    Month m = new Month(12, 2016);
    long mmillis = m.getFirstMillisecond(cal); 
    Date mprev = axis.previousStandardDate(new Date(mmillis), mdtu);
    assertEquals(new Month(9, 2016).getFirstMillisecond(cal), 
            mprev.getTime());
    
    // DAY
    DateTickUnit ddtu = new DateTickUnit(DateTickUnitType.DAY, 7);
    Day d = new Day(14, 1, 2016);
    long dmillis = d.getFirstMillisecond(cal); 
    Date dprev = axis.previousStandardDate(new Date(dmillis), ddtu);
    assertEquals(new Day(7, 1, 2016).getFirstMillisecond(cal), 
            dprev.getTime());
    
    // HOUR
    DateTickUnit hdtu = new DateTickUnit(DateTickUnitType.HOUR, 6);
    Hour h = new Hour(18, 24, 8, 2016);
    long hmillis = h.getFirstMillisecond(cal); 
    Date hprev = axis.previousStandardDate(new Date(hmillis), hdtu);
    assertEquals(new Hour(12, 24, 8, 2016).getFirstMillisecond(cal), 
            hprev.getTime());
    
    // MINUTE
    DateTickUnit mindtu = new DateTickUnit(DateTickUnitType.MINUTE, 5);
    Minute min = new Minute(10, 12, 24, 8, 2016);
    long minmillis = min.getFirstMillisecond(cal); // 1472040600000L GMT
    Date minprev = axis.previousStandardDate(new Date(minmillis), mindtu);
    assertEquals(1472040600000L - 5 * 60 * 1000L, minprev.getTime());
    
    // SECOND 
    DateTickUnit sdtu = new DateTickUnit(DateTickUnitType.SECOND, 10);
    Second s = new Second(50, 30, 18, 24, 8, 2016);
    long smillis = s.getFirstMillisecond(cal); 
    Date sprev = axis.previousStandardDate(new Date(smillis), sdtu);
    assertEquals(new Second(40, 30, 18, 24, 8, 2016)
            .getFirstMillisecond(cal), sprev.getTime());
    
    // MILLISECOND
    DateTickUnit msdtu = new DateTickUnit(DateTickUnitType.MILLISECOND, 10);
    Millisecond ms = new Millisecond(500, 50, 30, 18, 24, 8, 2016);
    long msmillis = ms.getFirstMillisecond(cal); 
    Date msprev = axis.previousStandardDate(new Date(msmillis), msdtu);
    assertEquals(new Millisecond(490, 50, 30, 18, 24, 8, 2016)
            .getFirstMillisecond(cal), msprev.getTime());
    
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:70,代码来源:DateAxisTest.java


注:本文中的org.jfree.data.time.Millisecond.getFirstMillisecond方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。