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


Java GregorianCalendar.getMinimum方法代码示例

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


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

示例1: dowTest

import java.util.GregorianCalendar; //导入方法依赖的package包/类
void dowTest(boolean lenient) {
    GregorianCalendar cal = new GregorianCalendar();
    cal.set(1997, AUGUST, 12); // Wednesday
    cal.getTime(); // Force update
    cal.setLenient(lenient);
    cal.set(1996, DECEMBER, 1); // Set the date to be December 1, 1996
    int dow = cal.get(DAY_OF_WEEK);
    int min = cal.getMinimum(DAY_OF_WEEK);
    int max = cal.getMaximum(DAY_OF_WEEK);
    if (dow < min || dow > max) {
        errln("FAIL: Day of week " + dow + " out of range");
    }
    if (dow != SUNDAY) {
        errln("FAIL2: Day of week should be SUNDAY; is " + dow + ": " + cal.getTime());
    }
    if (min != SUNDAY || max != SATURDAY) {
        errln("FAIL: Min/max bad");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:CalendarTest.java

示例2: dowTest

import java.util.GregorianCalendar; //导入方法依赖的package包/类
void dowTest(boolean lenient) {
    GregorianCalendar cal = new GregorianCalendar();
    cal.set(1997, AUGUST, 12); // Wednesday
    // cal.getTime(); // Force update
    cal.setLenient(lenient);
    cal.set(1996, DECEMBER, 1); // Set the date to be December 1, 1996
    int dow = cal.get(DAY_OF_WEEK);
    int min = cal.getMinimum(DAY_OF_WEEK);
    int max = cal.getMaximum(DAY_OF_WEEK);
    logln(cal.getTime().toString());
    if (min != SUNDAY || max != SATURDAY) {
        errln("FAIL: Min/max bad");
    }
    if (dow < min || dow > max) {
        errln("FAIL: Day of week " + dow + " out of range");
    }
    if (dow != SUNDAY) {
        errln("FAIL: Day of week should be SUNDAY Got " + dow);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:CalendarRegression.java

示例3: Test5006864

import java.util.GregorianCalendar; //导入方法依赖的package包/类
/**
 * 5006864: Define the minimum value of DAY_OF_WEEK_IN_MONTH as 1
 */
public void Test5006864() {
    GregorianCalendar cal = new GregorianCalendar();
    int min = cal.getMinimum(DAY_OF_WEEK_IN_MONTH);
    if (min != 1) {
        errln("GregorianCalendar.getMinimum(DAY_OF_WEEK_IN_MONTH) returned "
                + min + ", expected 1.");
    }
    min = cal.getGreatestMinimum(DAY_OF_WEEK_IN_MONTH);
    if (min != 1) {
        errln("GregorianCalendar.getGreatestMinimum(DAY_OF_WEEK_IN_MONTH) returned "
                + min + ", expected 1.");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:CalendarRegression.java


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