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


Java Month类代码示例

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


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

示例1: testGetFirstMillisecondWithTimeZone

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Month m = new Month(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-628444800000L, 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,代码来源:MonthTests.java

示例2: testGetFirstMillisecondWithCalendar

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Month m = new Month(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(978307200000L, 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,代码来源:MonthTests.java

示例3: testGetLastMillisecondWithTimeZone

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Month m = new Month(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-626025600001L, m.getLastMillisecond(zone));
    
    // try null calendar
    boolean pass = false;
    try {
        m.getLastMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:MonthTests.java

示例4: testGetLastMillisecondWithCalendar

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Month m = new Month(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(986079599999L, m.getLastMillisecond(calendar));
    
    // try null calendar
    boolean pass = false;
    try {
        m.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:MonthTests.java

示例5: testGetIndex

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Some checks for the getIndex() method.
 */
public void testGetIndex() {
    TimeSeries series = new TimeSeries("Series", Month.class);
    assertEquals(-1, series.getIndex(new Month(1, 2003)));
    
    series.add(new Month(1, 2003), 45.0);
    assertEquals(0, series.getIndex(new Month(1, 2003)));
    assertEquals(-1, series.getIndex(new Month(12, 2002)));
    assertEquals(-2, series.getIndex(new Month(2, 2003)));
    
    series.add(new Month(3, 2003), 55.0);
    assertEquals(-1, series.getIndex(new Month(12, 2002)));
    assertEquals(0, series.getIndex(new Month(1, 2003)));
    assertEquals(-2, series.getIndex(new Month(2, 2003)));
    assertEquals(1, series.getIndex(new Month(3, 2003)));
    assertEquals(-3, series.getIndex(new Month(4, 2003)));   
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:TimeSeriesTests.java

示例6: PeriodAxis

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Creates a new axis.
 * 
 * @param label  the axis label (<code>null</code> permitted).
 * @param first  the first time period in the axis range 
 *               (<code>null</code> not permitted).
 * @param last  the last time period in the axis range 
 *              (<code>null</code> not permitted).
 * @param timeZone  the time zone (<code>null</code> not permitted).
 */
public PeriodAxis(String label, 
                  RegularTimePeriod first, RegularTimePeriod last, 
                  TimeZone timeZone) {
    
    super(label, null);
    this.first = first;
    this.last = last;
    this.timeZone = timeZone;
    this.calendar = Calendar.getInstance(timeZone);
    this.autoRangeTimePeriodClass = first.getClass();
    this.majorTickTimePeriodClass = first.getClass();
    this.minorTickMarksVisible = false;
    this.minorTickTimePeriodClass = RegularTimePeriod.downsize(
            this.majorTickTimePeriodClass);
    setAutoRange(true);
    this.labelInfo = new PeriodAxisLabelInfo[2];
    this.labelInfo[0] = new PeriodAxisLabelInfo(Month.class, 
            new SimpleDateFormat("MMM"));
    this.labelInfo[1] = new PeriodAxisLabelInfo(Year.class, 
            new SimpleDateFormat("yyyy"));
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:PeriodAxis.java

示例7: correctTickDateForPosition

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Corrects the given tick date for the position setting.
 *
 * @param time  the tick date/time.
 * @param unit  the tick unit.
 * @param position  the tick position.
 *
 * @return The adjusted time.
 */
private Date correctTickDateForPosition(Date time, DateTickUnit unit,
        DateTickMarkPosition position) {
    Date result = time;
    switch (unit.getUnit()) {
        case DateTickUnit.MILLISECOND :
        case DateTickUnit.SECOND :
        case DateTickUnit.MINUTE :
        case DateTickUnit.HOUR :
        case DateTickUnit.DAY :
            break;
        case DateTickUnit.MONTH :
            result = calculateDateForPosition(new Month(time,
                    this.timeZone, this.locale), position);
            break;
        case DateTickUnit.YEAR :
            result = calculateDateForPosition(new Year(time,
                    this.timeZone, this.locale), position);
            break;

        default: break;
    }
    return result;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:33,代码来源:DateAxis.java

示例8: PeriodAxis

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Creates a new axis.
 *
 * @param label  the axis label (<code>null</code> permitted).
 * @param first  the first time period in the axis range
 *               (<code>null</code> not permitted).
 * @param last  the last time period in the axis range
 *              (<code>null</code> not permitted).
 * @param timeZone  the time zone (<code>null</code> not permitted).
 */
public PeriodAxis(String label,
                  RegularTimePeriod first, RegularTimePeriod last,
                  TimeZone timeZone) {

    super(label, null);
    this.first = first;
    this.last = last;
    this.timeZone = timeZone;
    // FIXME: this calendar may need a locale as well
    this.calendar = Calendar.getInstance(timeZone);
    this.autoRangeTimePeriodClass = first.getClass();
    this.majorTickTimePeriodClass = first.getClass();
    this.minorTickMarksVisible = false;
    this.minorTickTimePeriodClass = RegularTimePeriod.downsize(
            this.majorTickTimePeriodClass);
    setAutoRange(true);
    this.labelInfo = new PeriodAxisLabelInfo[2];
    this.labelInfo[0] = new PeriodAxisLabelInfo(Month.class,
            new SimpleDateFormat("MMM"));
    this.labelInfo[1] = new PeriodAxisLabelInfo(Year.class,
            new SimpleDateFormat("yyyy"));

}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:34,代码来源:PeriodAxis.java

示例9: correctTickDateForPosition

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Corrects the given tick date for the position setting.
 *
 * @param time  the tick date/time.
 * @param unit  the tick unit.
 * @param position  the tick position.
 *
 * @return The adjusted time.
 */
private Date correctTickDateForPosition(Date time, DateTickUnit unit,
        DateTickMarkPosition position) {
    Date result = time;
    switch (unit.getUnit()) {
        case (DateTickUnit.MILLISECOND) :
        case (DateTickUnit.SECOND) :
        case (DateTickUnit.MINUTE) :
        case (DateTickUnit.HOUR) :
        case (DateTickUnit.DAY) :
            break;
        case (DateTickUnit.MONTH) :
            result = calculateDateForPosition(new Month(time,
                    this.timeZone, this.locale), position);
            break;
        case(DateTickUnit.YEAR) :
            result = calculateDateForPosition(new Year(time,
                    this.timeZone, this.locale), position);
            break;

        default: break;
    }
    return result;
}
 
开发者ID:lulab,项目名称:PI,代码行数:33,代码来源:DateAxis.java

示例10: testDateConstructor1

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * In GMT, the end of Feb 2000 is java.util.Date(951,868,799,999L).  Use
 * this to check the Month constructor.
 */
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Calendar c = new GregorianCalendar(zone);
    Month m1 = new Month(new Date(951868799999L), zone, 
    		Locale.getDefault());
    Month m2 = new Month(new Date(951868800000L), zone, 
    		Locale.getDefault());

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951868799999L, m1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951868800000L, m2.getFirstMillisecond(c));

}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:MonthTests.java

示例11: testDateConstructor2

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * In Auckland, the end of Feb 2000 is java.util.Date(951,821,999,999L).
 * Use this to check the Month constructor.
 */
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("Pacific/Auckland");
    Calendar c = new GregorianCalendar(zone);
    Month m1 = new Month(new Date(951821999999L), zone, 
    		Locale.getDefault());
    Month m2 = new Month(new Date(951822000000L), zone, 
    		Locale.getDefault());

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951821999999L, m1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951822000000L, m2.getFirstMillisecond(c));

}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:MonthTests.java

示例12: testGetFirstMillisecondWithTimeZone

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Month m = new Month(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-628444800000L, 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,代码来源:MonthTests.java

示例13: testGetFirstMillisecondWithCalendar

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Month m = new Month(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(978307200000L, 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,代码来源:MonthTests.java

示例14: testGetLastMillisecondWithTimeZone

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Month m = new Month(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-626025600001L, m.getLastMillisecond(c));

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

示例15: testGetLastMillisecondWithCalendar

import org.jfree.data.time.Month; //导入依赖的package包/类
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Month m = new Month(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(986083199999L, m.getLastMillisecond(calendar));

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


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