本文整理汇总了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() + "\"");
}
}