org.exolab.castor.types

Class RecurringDurationBase

public abstract class RecurringDurationBase extends Object implements Serializable

The base class for recurring Duration types.

This base class contains all the time fields (including the time zone ones) and also the facets period and duration

The validation of the time fields is done in the set methods and follows the ISO8601 Date and Time Format

Author: Arnaud Blandin

See Also: RecurringDuration Time TimeInstant TimePeriod

Constructor Summary
protected RecurringDurationBase()
protected RecurringDurationBase(TimeDuration duration, TimeDuration period)
returns a recurringDurationBase with the facets duration and period set up
protected RecurringDurationBase(String duration, String period)
returns a recurringDurationBase with the facets duration and period set up
protected RecurringDurationBase(String duration, String period, short[] values)
returns a recurringDurationBase with the facets duration and period set up but also the fields
Method Summary
booleanequal(RecurringDurationBase reccD)

Returns true if the present instance of Recurring Duration Base is equal to the parameter.

booleanequals(Object object)
Override the java.lang.equals method
TimeDurationgetDuration()
shortgetHour()
shortgetMilli()
shortgetMinute()
TimeDurationgetPeriod()
shortgetSeconds()
short[]getValues()
returns an array of short with all the fields which describe a RecurringDurationBase
shortgetZoneHour()
shortgetZoneMinute()
booleanisGreater(RecurringDurationBase reccD)

Returns true if the present instance of RecurringDurationBase is greater than the parameter

Note : the order relation follows the W3C XML Schema draft i.e rd1 < rd2 iff rd2-rd1>0

booleanisNegative()
booleanisUTC()
return true if this recurring Duration type is UTC i.e if there is no time zone.
booleanisZoneNegative()
voidsetDuration(TimeDuration duration)
set the duration facet for this recurringDuration
voidsetDuration(String duration)
set the duration facet for this recurringDuration
voidsetHour(short hour)
set the hour field for this recurringDuration
voidsetMinute(short minute)
set the minute field for this recurringDuration
voidsetNegative()
set the negative field to true
voidsetPeriod(TimeDuration period)
set the period facet for this recurringDuration
voidsetPeriod(String period)
set the period facet for this recurringDuration
voidsetSecond(short second, short millsecond)
set the second field for this recurringDuration
voidsetUTC()
set the UTC field to true
voidsetValues(short[] values)
set all the fields by reading the values in an array
voidsetZone(short hour, short minute)
set the time zone fields for this recurringDuration
voidsetZoneNegative()
set the time zone negative field to true

Constructor Detail

RecurringDurationBase

protected RecurringDurationBase()

RecurringDurationBase

protected RecurringDurationBase(TimeDuration duration, TimeDuration period)
returns a recurringDurationBase with the facets duration and period set up

Parameters: duration the TimeDuration representing the duration facet period the TimeDuration reprensenting the period facet

Returns: a recurringDurationBase with the facets duration and period set up

RecurringDurationBase

protected RecurringDurationBase(String duration, String period)
returns a recurringDurationBase with the facets duration and period set up

Parameters: duration the String representing the duration facet period the String reprensenting the period facet

Returns: a recurringDurationBase with the facets duration and period set up

Throws: IllegalArgumentException this exception is thrown when the parameter strings are not corresponding to valid TimeDuration

RecurringDurationBase

protected RecurringDurationBase(String duration, String period, short[] values)
returns a recurringDurationBase with the facets duration and period set up but also the fields

Parameters: duration the String representing the duration facet period the String reprensenting the period facet values an array of shorts which contains the values of the fields

Returns: a recurringDurationBase with the facets duration and period set up

Throws: IllegalArgumentException this exception is thrown when the values array is not of length 6.

See Also: RecurringDurationBase

Method Detail

equal

public boolean equal(RecurringDurationBase reccD)

Returns true if the present instance of Recurring Duration Base is equal to the parameter.

The equals relation is the following : rd1 equals rd2 iff each field of rd1 is equal to the corresponding field of rd2

Parameters: reccD the recurring duration to compare with the present instance

Returns: true if the present instance is equal to the parameter false if not

equals

public boolean equals(Object object)
Override the java.lang.equals method

See Also: RecurringDurationBase

getDuration

public TimeDuration getDuration()

getHour

public short getHour()

getMilli

public short getMilli()

getMinute

public short getMinute()

getPeriod

public TimeDuration getPeriod()

getSeconds

public short getSeconds()

getValues

public short[] getValues()
returns an array of short with all the fields which describe a RecurringDurationBase

Returns: an array of short with all the fields which describe a RecurringDurationBase

getZoneHour

public short getZoneHour()

getZoneMinute

public short getZoneMinute()

isGreater

public boolean isGreater(RecurringDurationBase reccD)

Returns true if the present instance of RecurringDurationBase is greater than the parameter

Note : the order relation follows the W3C XML Schema draft i.e rd1 < rd2 iff rd2-rd1>0

Parameters: reccD the recurring duration base to compare with the present instance

Returns: true if the present instance is the greatest, false if not

isNegative

public boolean isNegative()

isUTC

public boolean isUTC()
return true if this recurring Duration type is UTC i.e if there is no time zone.

UNKNOWN: true if this recurringDuration type is UTC else false

isZoneNegative

public boolean isZoneNegative()

setDuration

public void setDuration(TimeDuration duration)
set the duration facet for this recurringDuration

Parameters: duration the period to set

Throws: OperationNotSupportedException this exception is thrown when changing the value of the duration facet is not allowed

setDuration

public void setDuration(String duration)
set the duration facet for this recurringDuration

Parameters: duration the period to set

Throws: OperationNotSupportedException this exception is thrown when changing the value of the duration facet is not allowed

setHour

public void setHour(short hour)
set the hour field for this recurringDuration

Parameters: hour the hour to set

Throws: OperationNotSupportedException this exception is thrown when changing the value of the hour field is not allowed

setMinute

public void setMinute(short minute)
set the minute field for this recurringDuration

Parameters: minute the minute to set

Throws: OperationNotSupportedException this exception is thrown when changing the value of the minute field is not allowed

setNegative

public void setNegative()
set the negative field to true

setPeriod

public void setPeriod(TimeDuration period)
set the period facet for this recurringDuration

Parameters: period the period to set

Throws: OperationNotSupportedException this exception is thrown when changing the value of the period facet is not allowed

setPeriod

public void setPeriod(String period)
set the period facet for this recurringDuration

Parameters: period the period to set

Throws: OperationNotSupportedException this exception is thrown when changing the value of the period facet is not allowed

setSecond

public void setSecond(short second, short millsecond)
set the second field for this recurringDuration

Parameters: second the second to set millsecond the millisecond to set

Throws: OperationNotSupportedException this exception is thrown when changing the value of the second field is not allowed

setUTC

public void setUTC()
set the UTC field to true

setValues

public void setValues(short[] values)
set all the fields by reading the values in an array

Parameters: values an array of shorts with the values the array is supposed to be of length 6 and ordered like that:

Throws: OperationNotSupportedException this exception is thrown when changing the value of a time related field is not allowed

setZone

public void setZone(short hour, short minute)
set the time zone fields for this recurringDuration

Parameters: hour the time zone hour to set minute the time zone minute to set

Throws: OperationNotSupportedException this exception is thrown when changing the value of the time zone fields is not allowed

setZoneNegative

public void setZoneNegative()
set the time zone negative field to true

Throws: OperationNotSupportedException this exception is thrown when changing the time zone fields is not allowed

Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com