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