Top Description Fields Constructors Methods
com.sun.msv.datatype.xsd.datetime

public Class BigDateTimeValueType

extends Object
implements IDateTimeValueType
Class Inheritance
All Implemented Interfaces
com.sun.msv.datatype.xsd.datetime.IDateTimeValueType, java.io.Serializable
Imports
com.sun.msv.datatype.xsd.Comparator, java.math.BigDecimal, .BigInteger, java.util.Calendar

DateTimeValueType object that can hold all lexically valid dateTime value. This class provides:
  1. Unlimited digits for year (e.g., "year 9999999999999999999999")
  2. Unlimited digits for fraction of second (e.g. 0.00000000000001 sec)
To provide methods that can change date/time values, normalize method should be modified too.
Author
Kohsuke KAWAGUCHI

Field Summary

Modifier and TypeField and Description
private Integer
day

day (always normalized, between 0-30) this variable is null if no year is specified

private Integer
hour

hour (always between 0 and 23) this variable is null if no year is specified

private Integer
minute

minute (always between 0 and 59) this variable is null if no year is specified

private Integer
month

month (always between 0 and 11) this variable is null if no year is specified

private IDateTimeValueType
normalizedValue

normalized DateTimeValue of this object.

private BigDecimal
second

second (always in [0,60) ) this variable is null if no year is specified

private static final long
private BigInteger
year

year value.

private TimeZone
zone

time zone specifier.

Constructor Summary

AccessConstructor and Description
public
BigDateTimeValueType(BigDateTimeValueType base, TimeZone newTimeZone)

creates an instance with the specified BigDateTimeValueType, with modified time zone.

public
BigDateTimeValueType(BigInteger year, int month, int day, int hour, int minute, BigDecimal second, TimeZone timeZone)

public
BigDateTimeValueType(BigInteger year, Integer month, Integer day, Integer hour, Integer minute, BigDecimal second, TimeZone timeZone)

public

Method Summary

Modifier and TypeMethod and Description
public IDateTimeValueType
add(ITimeDurationValueType _rhs)

Implements com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.add.

returns the result of addition of this object and TimeDuration.
public int
compare(IDateTimeValueType o)

Implements com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.compare.

compare two DateTimeValueType as defined in com.sun.msv.datatype/Comparator
protected static int
compare(BigDateTimeValueType lhs, BigDateTimeValueType rhs)

compares two BigDateTimeValueType and returns one of the constant defined in Comparator.

protected TimeZone

Returns:

a non-null valid object.
createJavaTimeZone
()

Deprecated use getTimeZone().
Creates the equivalent Java TimeZone object.
private static BigInteger[]
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public boolean
public boolean
public BigDateTimeValueType
public Integer
public Integer
public Integer
public Integer
public BigDecimal
public TimeZone
public BigInteger
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public IDateTimeValueType
normalize()

Implements com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.normalize.

gets the normalized IDateTimeValueType.
private static BigInteger
private static BigDecimal
private BigInteger
private BigDecimal
public Calendar
toCalendar()

Implements com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.toCalendar.

Approximates the value represented by this object into a Calendar object.
public String
toString()

Overrides java.lang.Object.toString.

gets a human-readable representation of this object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

dayback to summary
private Integer day

day (always normalized, between 0-30) this variable is null if no year is specified

hourback to summary
private Integer hour

hour (always between 0 and 23) this variable is null if no year is specified

minuteback to summary
private Integer minute

minute (always between 0 and 59) this variable is null if no year is specified

monthback to summary
private Integer month

month (always between 0 and 11) this variable is null if no year is specified

normalizedValueback to summary
private IDateTimeValueType normalizedValue

normalized DateTimeValue of this object. once when the normalized value is computed, the value is kept in this varible so that successive calls to normalize method need not have to compute it again. This approach assumes that modification to the date/time component will never be made.

secondback to summary
private BigDecimal second

second (always in [0,60) ) this variable is null if no year is specified

serialVersionUIDback to summary
private static final long serialVersionUID
yearback to summary
private BigInteger year

year value. this variable is null if no year is specified. Since there is no year 0, value 0 indicates year -1. -1 indicates -2, and so forth.

zoneback to summary
private TimeZone zone

time zone specifier. null if missing

Constructor Detail

BigDateTimeValueTypeback to summary
public BigDateTimeValueType(BigDateTimeValueType base, TimeZone newTimeZone)

creates an instance with the specified BigDateTimeValueType, with modified time zone. created object shares its date/time value component with the original one, so special care is necessary not to mutate those values.

BigDateTimeValueTypeback to summary
public BigDateTimeValueType(BigInteger year, int month, int day, int hour, int minute, BigDecimal second, TimeZone timeZone)
BigDateTimeValueTypeback to summary
public BigDateTimeValueType(BigInteger year, Integer month, Integer day, Integer hour, Integer minute, BigDecimal second, TimeZone timeZone)
BigDateTimeValueTypeback to summary
public BigDateTimeValueType()

Method Detail

addback to summary
public IDateTimeValueType add(ITimeDurationValueType _rhs)

Implements com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.add.

Doc from com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.add.

returns the result of addition of this object and TimeDuration. this object will not be mutated.

compareback to summary
public int compare(IDateTimeValueType o)

Implements com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.compare.

Doc from com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.compare.

compare two DateTimeValueType as defined in com.sun.msv.datatype/Comparator

compareback to summary
protected static int compare(BigDateTimeValueType lhs, BigDateTimeValueType rhs)

compares two BigDateTimeValueType and returns one of the constant defined in Comparator. Order-relation between two dateTime is defined in http://www.w3.org/TR/xmlschema-2/#dateTime

createJavaTimeZoneback to summary
protected TimeZone createJavaTimeZone()

Deprecated

use getTimeZone().

Creates the equivalent Java TimeZone object.

Returns:TimeZone

a non-null valid object.

divideAndRemainderback to summary
private static BigInteger[] divideAndRemainder(BigInteger x1, BigInteger x2)
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

equalsback to summary
public boolean equals(IDateTimeValueType rhs)
equalsback to summary
public boolean equals(BigDateTimeValueType lhs, BigDateTimeValueType rhs)
getBigValueback to summary
public BigDateTimeValueType getBigValue()

Implements com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.getBigValue.

getDayback to summary
public Integer getDay()
getHourback to summary
public Integer getHour()
getMinuteback to summary
public Integer getMinute()
getMonthback to summary
public Integer getMonth()
getSecondback to summary
public BigDecimal getSecond()
getTimeZoneback to summary
public TimeZone getTimeZone()
getYearback to summary
public BigInteger getYear()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

normalizeback to summary
public IDateTimeValueType normalize()

Implements com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.normalize.

Doc from com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.normalize.

gets the normalized IDateTimeValueType. normalized value always has GMT timezone or no timezone

nullAs0back to summary
private static BigInteger nullAs0(BigInteger o)
nullAs0back to summary
private static BigDecimal nullAs0(BigDecimal o)
signedback to summary
private BigInteger signed(BigTimeDurationValueType dur, BigInteger i)
signedback to summary
private BigDecimal signed(BigTimeDurationValueType dur, BigDecimal i)
toCalendarback to summary
public Calendar toCalendar()

Implements com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.toCalendar.

Doc from com.sun.msv.datatype.xsd.datetime.IDateTimeValueType.toCalendar.

Approximates the value represented by this object into a Calendar object. This conversion may lose accuracy.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

gets a human-readable representation of this object. return value is not intended to be compliant with the canonical representation of "dateTime" type.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.