org.geotools.temporal.object
Class DefaultPeriodDuration

Object
  extended by DefaultDuration
      extended by DefaultPeriodDuration
All Implemented Interfaces:
Duration, PeriodDuration

public class DefaultPeriodDuration
extends DefaultDuration
implements PeriodDuration

Uses the format specified by ISO 8601 for exchanging information about the duration of a period.

Author:
Mehdi Sidhoum (Geomatys)

Constructor Summary
DefaultPeriodDuration(InternationalString years, InternationalString months, InternationalString week, InternationalString days, InternationalString hours, InternationalString minutes, InternationalString seconds)
          Creates a new instances of PeriodDuration.
DefaultPeriodDuration(long durationInMilliSeconds)
          Creates a new instance of PeriodDuration from a long value passed in parameter.
 
Method Summary
 boolean equals(Object object)
           
 InternationalString getDays()
          A positive integer, followed by the character "D", which indicated the number of days in the period.
 InternationalString getDesignator()
          A mandatory element which designates that the returned string represents the duration of a period.
 InternationalString getHours()
          A positive integer, followed by the character "H", which indicated the number of hours in the period.
 InternationalString getMinutes()
          A positive integer, followed by the character "M", which indicated the number of minutes in the period.
 InternationalString getMonths()
          A positive integer, followed by the character "M", which indicated the number of months in the period.
 InternationalString getSeconds()
          A positive integer, followed by the character "S", which indicated the number of seconds in the period.
 InternationalString getTimeIndicator()
          Included whenever the sequence includes values for units less than a day.
 long getTimeInMillis()
          Returns a duration in long. note there is no starting instant to accurate the returned value.
 InternationalString getWeek()
           
 InternationalString getYears()
          A positive integer, followed by the character "Y", which indicated the number of years in the period.
 int hashCode()
           
 void setDays(InternationalString days)
           
 void setHours(InternationalString hours)
           
 void setMinutes(InternationalString minutes)
           
 void setMonths(InternationalString months)
           
 void setSeconds(InternationalString seconds)
           
 void setWeek(InternationalString week)
           
 void setYears(InternationalString years)
           
 String toString()
           
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultPeriodDuration

public DefaultPeriodDuration(InternationalString years,
                             InternationalString months,
                             InternationalString week,
                             InternationalString days,
                             InternationalString hours,
                             InternationalString minutes,
                             InternationalString seconds)
Creates a new instances of PeriodDuration.

Parameters:
years -
months -
weeks -
days -
hours -
minutes -
seconds -

DefaultPeriodDuration

public DefaultPeriodDuration(long durationInMilliSeconds)
Creates a new instance of PeriodDuration from a long value passed in parameter. if the long contains milliseconds, this will be ignored because there is no MilliSeconds specified in the string format PnYnMnDTnHnMnS, see ISO 8601.

Parameters:
durationInMilliSeconds -
Method Detail

getDesignator

public InternationalString getDesignator()
A mandatory element which designates that the returned string represents the duration of a period.

Specified by:
getDesignator in interface PeriodDuration

getYears

public InternationalString getYears()
A positive integer, followed by the character "Y", which indicated the number of years in the period.

Specified by:
getYears in interface PeriodDuration

getMonths

public InternationalString getMonths()
A positive integer, followed by the character "M", which indicated the number of months in the period.

Specified by:
getMonths in interface PeriodDuration

getDays

public InternationalString getDays()
A positive integer, followed by the character "D", which indicated the number of days in the period.

Specified by:
getDays in interface PeriodDuration

getTimeIndicator

public InternationalString getTimeIndicator()
Included whenever the sequence includes values for units less than a day.

Specified by:
getTimeIndicator in interface PeriodDuration

getHours

public InternationalString getHours()
A positive integer, followed by the character "H", which indicated the number of hours in the period.

Specified by:
getHours in interface PeriodDuration

getMinutes

public InternationalString getMinutes()
A positive integer, followed by the character "M", which indicated the number of minutes in the period.

Specified by:
getMinutes in interface PeriodDuration

getSeconds

public InternationalString getSeconds()
A positive integer, followed by the character "S", which indicated the number of seconds in the period.

Specified by:
getSeconds in interface PeriodDuration

setYears

public void setYears(InternationalString years)

setMonths

public void setMonths(InternationalString months)

setDays

public void setDays(InternationalString days)

setHours

public void setHours(InternationalString hours)

setMinutes

public void setMinutes(InternationalString minutes)

setSeconds

public void setSeconds(InternationalString seconds)

getWeek

public InternationalString getWeek()

setWeek

public void setWeek(InternationalString week)

getTimeInMillis

public long getTimeInMillis()
Returns a duration in long. note there is no starting instant to accurate the returned value.

Specified by:
getTimeInMillis in class DefaultDuration
Returns:

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1996-2014 Geotools. All Rights Reserved.