1 3 9 10 package javax.xml.datatype; 11 12 import javax.xml.namespace.QName ; 13 import java.math.BigDecimal ; 14 import java.math.BigInteger ; 15 import java.util.TimeZone ; 16 import java.util.GregorianCalendar ; 17 18 167 168 public abstract class XMLGregorianCalendar 169 implements Cloneable { 170 171 177 public abstract void clear(); 178 179 231 public abstract void reset(); 232 233 244 public abstract void setYear(BigInteger year); 245 246 259 public abstract void setYear(int year); 260 261 272 public abstract void setMonth(int month); 273 274 285 public abstract void setDay(int day); 286 287 299 public abstract void setTimezone(int offset); 300 301 317 public void setTime(int hour, int minute, int second) { 318 319 setTime( 320 hour, 321 minute, 322 second, 323 null ); 325 } 326 327 337 public abstract void setHour(int hour); 338 339 349 public abstract void setMinute(int minute); 350 351 361 public abstract void setSecond(int second); 362 363 374 public abstract void setMillisecond(int millisecond); 375 376 387 public abstract void setFractionalSecond(BigDecimal fractional); 388 389 390 407 public void setTime( 408 int hour, 409 int minute, 410 int second, 411 BigDecimal fractional) { 412 413 setHour(hour); 414 setMinute(minute); 415 setSecond(second); 416 setFractionalSecond(fractional); 417 } 418 419 420 436 public void setTime(int hour, int minute, int second, int millisecond) { 437 438 setHour(hour); 439 setMinute(minute); 440 setSecond(second); 441 setMillisecond(millisecond); 442 } 443 444 457 public abstract BigInteger getEon(); 458 459 471 public abstract int getYear(); 472 473 488 public abstract BigInteger getEonAndYear(); 489 490 499 public abstract int getMonth(); 500 501 509 public abstract int getDay(); 510 511 520 public abstract int getTimezone(); 521 522 530 public abstract int getHour(); 531 532 540 public abstract int getMinute(); 541 542 560 public abstract int getSecond(); 561 562 581 public int getMillisecond() { 582 583 BigDecimal fractionalSeconds = getFractionalSecond(); 584 585 if (fractionalSeconds == null) { 587 return DatatypeConstants.FIELD_UNDEFINED; 588 } 589 590 return getFractionalSecond().movePointRight(3).intValue(); 591 } 592 593 610 public abstract BigDecimal getFractionalSecond(); 611 612 634 public abstract int compare(XMLGregorianCalendar xmlGregorianCalendar); 635 636 644 public abstract XMLGregorianCalendar normalize(); 645 646 656 public boolean equals(Object obj) { 657 658 if (obj == null) { 659 throw new NullPointerException ("Cannot test null for equality with this XMLGregorianCalendar"); 660 } 661 662 boolean result = false; 663 664 if (obj instanceof XMLGregorianCalendar ) { 665 result = compare((XMLGregorianCalendar ) obj) == DatatypeConstants.EQUAL; 666 } 667 return result; 668 } 669 670 675 public int hashCode() { 676 677 int timezone = getTimezone(); 683 if (timezone == DatatypeConstants.FIELD_UNDEFINED) { 684 timezone = 0; 685 } 686 XMLGregorianCalendar gc = this; 687 if (timezone != 0) { 688 gc = this.normalize(); 689 } 690 return gc.getYear() 691 + gc.getMonth() 692 + gc.getDay() 693 + gc.getHour() 694 + gc.getMinute() 695 + gc.getSecond(); 696 } 697 698 712 public abstract String toXMLFormat(); 713 714 825 public abstract QName getXMLSchemaType(); 826 827 839 public String toString() { 840 841 return toXMLFormat(); 842 } 843 844 848 public abstract boolean isValid(); 849 850 864 public abstract void add(Duration duration); 865 866 954 public abstract GregorianCalendar toGregorianCalendar(); 955 956 1006 public abstract GregorianCalendar toGregorianCalendar( 1007 java.util.TimeZone timezone, 1008 java.util.Locale aLocale, 1009 XMLGregorianCalendar defaults); 1010 1011 1027 public abstract TimeZone getTimeZone(int defaultZoneoffset); 1028 1029 1030 1031 1036 public abstract Object clone(); 1037} 1038 | Popular Tags |