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


Java Duration.getSign方法代码示例

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


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

示例1: durationAssertEquals

import javax.xml.datatype.Duration; //导入方法依赖的package包/类
private void durationAssertEquals(Duration duration, QName xmlSchemaType, boolean isPositive, int years, int months, int days, int hours, int minutes,
        int seconds, long milliseconds, String lexical) {

    final TimeZone GMT = TimeZone.getTimeZone("GMT");
    final GregorianCalendar EPOCH = new GregorianCalendar(GMT);
    EPOCH.clear();

    if (DEBUG) {
        System.out.println("Testing Duration: " + duration.toString());
    }

    // sign
    if (DEBUG) {
        boolean actual = (duration.getSign() == 1) ? true : false;
        System.out.println("sign:");
        System.out.println("    expected: \"" + isPositive + "\"");
        System.out.println("    actual:   \"" + actual + "\"");
    }

    if (DEBUG) {
        System.out.println("years:");
        System.out.println("    expected: \"" + years + "\"");
        System.out.println("    actual:   \"" + duration.getYears() + "\"");
    }

    if (DEBUG) {
        System.out.println("months:");
        System.out.println("    expected: \"" + months + "\"");
        System.out.println("    actual:   \"" + duration.getMonths() + "\"");
    }

    if (DEBUG) {
        System.out.println("days:");
        System.out.println("    expected: \"" + days + "\"");
        System.out.println("    actual:   \"" + duration.getDays() + "\"");
    }

    if (DEBUG) {
        System.out.println("hours:");
        System.out.println("    expected: \"" + hours + "\"");
        System.out.println("    actual:   \"" + duration.getHours() + "\"");
    }

    if (DEBUG) {
        System.out.println("minutes:");
        System.out.println("    expected: \"" + minutes + "\"");
        System.out.println("    actual:   \"" + duration.getMinutes() + "\"");
    }

    if (DEBUG) {
        System.out.println("seconds:");
        System.out.println("    expected: \"" + seconds + "\"");
        System.out.println("    actual:   \"" + duration.getSeconds() + "\"");
    }

    if (DEBUG) {
        System.out.println("milliseconds:");
        System.out.println("    expected: \"" + milliseconds + "\"");
        System.out.println("    actual:   \"" + duration.getTimeInMillis(EPOCH) + "\"");
    }

    if (DEBUG) {
        System.out.println("lexical:");
        System.out.println("    expected: \"" + lexical + "\"");
        System.out.println("    actual:   \"" + duration.toString() + "\"");
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:69,代码来源:DurationTest.java


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