XBinder C# Runtime Library  2.7
Public Member Functions | Static Public Member Functions | Properties | List of all members
com.objsys.xbinder.runtime.XBDuration Class Reference

This class implements some of the functionality of the Java javax.xml.datatype.Duration class. Only the functionality needed by the XBinder C# runtime is implemented. Normalization of all fields is done with the exception of days to months or days to years. For example, an instance specifying 1 minute and 65 seconds will be normalized to 2 minutes and 5 seconds. But an instance specifying 1 month and any number of days higher than 27 will not be normalized, since the result of the normalization would depend on the starting point in time of the duration, which we don't know. More...

Public Member Functions

 XBDuration (bool isPositive, uint years, uint months, uint days, uint hours, uint minutes, double seconds)
 Constructs an instance of XBDuration with the specified values. More...
 
 XBDuration (string textDuration)
 Constructs an instance of XBDuration using a text duration specification. This constructor does only limited sanity checking of the duration specification; that's not its purpose. Consequently, the behavior is undefined if an invalid duration specification is passed. More...
 
override bool Equals (object obj)
 Override of the Object.Equals method. This override implements value equality checking, not reference equality checking. More...
 
override int GetHashCode ()
 Override of the Object.GetHashCode method. More...
 
override string ToString ()
 Returns a string representation of the duration. If the duration was constructed using a text duration specification, then all items specified in the input text duration will also be specified in this output text duration, even if they have 0 as the value. More...
 

Static Public Member Functions

static bool operator== (XBDuration duration1, XBDuration duration2)
 
static bool operator> (XBDuration duration1, XBDuration duration2)
 
static bool operator< (XBDuration duration1, XBDuration duration2)
 
static bool operator>= (XBDuration duration1, XBDuration duration2)
 
static bool operator<= (XBDuration duration1, XBDuration duration2)
 
static bool operator!= (XBDuration duration1, XBDuration duration2)
 

Properties

uint Years [get, set]
 The number of years defined in the duration. More...
 
uint Months [get, set]
 The number of months defined in the duration. More...
 
uint Days [get, set]
 The number of days defined in the duration. More...
 
uint Hours [get, set]
 The number of hours defined in the duration. More...
 
uint Minutes [get, set]
 The number of minutes defined in the duration. More...
 
double Seconds [get, set]
 The quantity of seconds defined in the duration. More...
 
int Sign [get, set]
 The sign of the duration (-1 means a negative duration, 0 means the duration is 0, 1 means a positive duration) More...
 

Detailed Description

This class implements some of the functionality of the Java javax.xml.datatype.Duration class. Only the functionality needed by the XBinder C# runtime is implemented. Normalization of all fields is done with the exception of days to months or days to years. For example, an instance specifying 1 minute and 65 seconds will be normalized to 2 minutes and 5 seconds. But an instance specifying 1 month and any number of days higher than 27 will not be normalized, since the result of the normalization would depend on the starting point in time of the duration, which we don't know.

Constructor & Destructor Documentation

◆ XBDuration() [1/2]

com.objsys.xbinder.runtime.XBDuration.XBDuration ( bool  isPositive,
uint  years,
uint  months,
uint  days,
uint  hours,
uint  minutes,
double  seconds 
)

Constructs an instance of XBDuration with the specified values.

Parameters
isPositiveIf true, sign is positive; otherwise, sign is negative
yearsNumber of years for the duration
monthsNumber of months for the duration
daysNumber of days for the duration
hoursNumber of hours for the duration
minutesNumber of minutes for the duration
secondsQuantity of seconds for the duration

◆ XBDuration() [2/2]

com.objsys.xbinder.runtime.XBDuration.XBDuration ( string  textDuration)

Constructs an instance of XBDuration using a text duration specification. This constructor does only limited sanity checking of the duration specification; that's not its purpose. Consequently, the behavior is undefined if an invalid duration specification is passed.

If the ToString() method is subsquetly used to build a new text representation of this duration, then all items specified in this input text duration will also be specified in the output text duration, even if they have 0 as a value.

Parameters
textDurationDuration specification that follows the XML Schema duration syntax ([-]PnYnMnDTnHnMnS).

Member Function Documentation

◆ Equals()

override bool com.objsys.xbinder.runtime.XBDuration.Equals ( object  obj)

Override of the Object.Equals method. This override implements value equality checking, not reference equality checking.

Parameters
objThe object to compare with the current object.
Returns
True if the specified object is equal to the current object, false otherwise.

◆ GetHashCode()

override int com.objsys.xbinder.runtime.XBDuration.GetHashCode ( )

Override of the Object.GetHashCode method.

Returns
Hash code

◆ ToString()

override string com.objsys.xbinder.runtime.XBDuration.ToString ( )

Returns a string representation of the duration. If the duration was constructed using a text duration specification, then all items specified in the input text duration will also be specified in this output text duration, even if they have 0 as the value.

Returns

Property Documentation

◆ Days

uint com.objsys.xbinder.runtime.XBDuration.Days
getset

The number of days defined in the duration.

◆ Hours

uint com.objsys.xbinder.runtime.XBDuration.Hours
getset

The number of hours defined in the duration.

◆ Minutes

uint com.objsys.xbinder.runtime.XBDuration.Minutes
getset

The number of minutes defined in the duration.

◆ Months

uint com.objsys.xbinder.runtime.XBDuration.Months
getset

The number of months defined in the duration.

◆ Seconds

double com.objsys.xbinder.runtime.XBDuration.Seconds
getset

The quantity of seconds defined in the duration.

◆ Sign

int com.objsys.xbinder.runtime.XBDuration.Sign
getset

The sign of the duration (-1 means a negative duration, 0 means the duration is 0, 1 means a positive duration)

◆ Years

uint com.objsys.xbinder.runtime.XBDuration.Years
getset

The number of years defined in the duration.