Class Timespan

Description

Timespan represents a duration starting at a specific DateAndTime.

To create new Timespan instances, use one of the static instance-creation methods, NOT 'new Timespan':

    Located in /harmoni/core/Primitives/Chronology/Timespan.class.php (line 40)

    SObject
       |
       --Magnitude
          |
          --Timespan
    Direct descendents
    Class Description
    Date Instances of Date are Timespans with duration of 1 day.
    Month I am a timespan that represents a month.
    Schedule I represent a powerful class for implementing recurring schedules.
    Week I am a Timespan that represents a Week.
    Year I am a Timespan that represents a Year.
    Variable Summary
    Method Summary
    obect asDate ()
    obect asDateAndTime ()
    obect asDuration ()
    obect asMonth ()
    obect asTime ()
    obect asTimeStamp ()
    obect asWeek ()
    obect asYear ()
    object Timespan current ([optional $class = 'Timespan'])
    array dates ()
    integer day ()
    integer dayOfMonth ()
    integer dayOfWeek ()
    integer dayOfWeekName ()
    integer dayOfYear ()
    ingteger daysInMonth ()
    ingteger daysInYear ()
    ingteger daysLeftInYear ()
    object Timespan epoch ([optional $class = 'Timespan'])
    array every (mixed $aDuration)
    integer firstDayOfMonth ()
    boolean includes (object DateAndTime $aDateAndTime)
    boolean includesAllOf (array $anArray)
    boolean includesAnyOf (array $anArray)
    mixed intersection (object Timespan $aTimespan)
    boolean isEqualTo (object Timespan $aTimespan)
    integer isLeapYear ()
    boolean isLessThan (object $aComparand)
    integer julianDayNumber ()
    object Timespan minus (object $operand)
    array months ()
    string printableString ()
    void setDuration (object Duration $aDuration)
    void setStart (object DateAndTime $aDateAndTime)
    object Timespan starting (object DateAndTime $aDateAndTime, [optional $class = 'Timespan'])
    object Timespan startingDuration (object DateAndTime $aDateAndTime, object Duration $aDuration, [optional $class = 'Timespan'])
    object Timespan startingEnding (object DateAndTime $startDateAndTime, object DateAndTime $endDateAndTime, [optional $class = 'Timespan'])
    integer startMonth ()
    integer startMonthIndex ()
    integer startMonthName ()
    integer startYear ()
    object Timespan to (object $anEnd)
    mixed union (object Timespan $aTimespan)
    array weeks ()
    array years ()
    Variables
    object Duration $duration (line 56)
    • var: The duration of this time-span.
    • since: 5/11/05
    • access: private
    object DateAndTime $start (line 49)
    • var: The starting point of this time-span
    • since: 5/11/05
    • access: private
    Methods
    Constructor Timespan (line 186)

    Do not use this constructor for building objects, please use the class-methods Timespan::new(), Timespan::starting(), etcetera, instead.

    • since: 5/2/05
    • access: private
    object Timespan Timespan ()
    asDate (line 764)

    Answer this instance converted.

    • return: Date
    • since: 5/13/05
    • access: public
    obect asDate ()

    Redefined in descendants as:
    asDateAndTime (line 776)

    Answer this instance converted.

    • return: DateAndTime
    • since: 5/13/05
    • access: public
    obect asDateAndTime ()
    asDuration (line 787)

    Answer this instance converted.

    • return: Duration
    • since: 5/13/05
    • access: public
    obect asDuration ()
    asMonth (line 798)

    Answer this instance converted.

    • return: Month
    • since: 5/13/05
    • access: public
    obect asMonth ()

    Redefined in descendants as:
    asTime (line 810)

    Answer this instance converted.

    • return: Time
    • since: 5/13/05
    • access: public
    obect asTime ()
    asTimeStamp (line 822)

    Answer this instance converted.

    • return: TimeStamp
    • since: 5/13/05
    • access: public
    obect asTimeStamp ()
    asWeek (line 834)

    Answer this instance converted.

    • return: Week
    • since: 5/13/05
    • access: public
    obect asWeek ()

    Redefined in descendants as:
    asYear (line 846)

    Answer this instance converted.

    • return: Year
    • since: 5/13/05
    • access: public
    obect asYear ()

    Redefined in descendants as:
    current (line 80)

    Answer a new object that represents now.

    • static:
    • since: 5/5/05
    • access: public
    object Timespan current ([optional $class = 'Timespan'])
    • optional $class: string $class DO NOT USE OUTSIDE OF PACKAGE. This parameter is used to get around the limitations of not being able to find the class of the object that recieved the initial method call.

    Redefined in descendants as:
    dates (line 676)

    Return an array of the dates in the reciever.

    • since: 5/13/05
    • access: public
    array dates ()
    day (line 427)

    Answer the day

    • since: 5/13/05
    • access: public
    integer day ()
    dayOfMonth (line 438)

    Answer the day of the month represented by the receiver.

    • since: 5/11/05
    • access: public
    integer dayOfMonth ()
    dayOfWeek (line 449)

    Answer the day of the week represented by the receiver.

    • since: 5/11/05
    • access: public
    integer dayOfWeek ()
    dayOfWeekName (line 460)

    Answer the day of the week represented by the receiver.

    • since: 5/11/05
    • access: public
    integer dayOfWeekName ()
    dayOfYear (line 471)

    Answer the day of the year represented by the receiver.

    • since: 5/11/05
    • access: public
    integer dayOfYear ()
    daysInMonth (line 482)

    Answer the number of days in the month represented by the receiver.

    • since: 5/13/05
    • access: public
    ingteger daysInMonth ()

    Redefined in descendants as:
    daysInYear (line 493)

    Answer the number of days in the year represented by the receiver.

    • since: 5/13/05
    • access: public
    ingteger daysInYear ()

    Redefined in descendants as:
    daysLeftInYear (line 504)

    Answer the number of days in the year after the date of the receiver.

    • since: 5/13/05
    • access: public
    ingteger daysLeftInYear ()
    duration (line 516)

    Answer the Duration of this timespan

    • since: 5/11/05
    • access: public
    object Duration duration ()
    end (line 527)

    Answer the end of this timespan

    • since: 5/11/05
    • access: public
    epoch (line 98)

    Answer a Timespan starting on the Squeak epoch: 1 January 1901

    • static:
    • since: 5/5/05
    • access: public
    object Timespan epoch ([optional $class = 'Timespan'])
    • optional $class: string $class DO NOT USE OUTSIDE OF PACKAGE. This parameter is used to get around the limitations of not being able to find the class of the object that recieved the initial method call.

    Redefined in descendants as:
    • Date::epoch() : Answer a Date starting on the Squeak epoch: 1 January 1901
    • Month::epoch() : Answer a Month starting on the Squeak epoch: 1 January 1901
    • Schedule::epoch() : Answer a Month starting on the Squeak epoch: 1 January 1901
    • Week::epoch() : Answer a Month starting on the Squeak epoch: 1 January 1901
    • Year::epoch() : Answer a Year starting on the Squeak epoch: 1 January 1901
    every (line 655)

    Return an array of the DateAndTimes that occur every $aDuration in the reciever.

    • since: 5/13/05
    • access: public
    array every (mixed $aDuration)
    firstDayOfMonth (line 541)

    Answer the day-in-the-year of the first day of our month

    • since: 5/13/05
    • access: public
    integer firstDayOfMonth ()
    includes (line 251)

    Answer TRUE if the argument is within the timespan covered by the reciever.

    • since: 5/13/05
    • access: public
    boolean includes (object DateAndTime $aDateAndTime)
    includesAllOf (line 275)

    Answer whether all the elements of anArray are in the receiver.

    • since: 5/13/05
    • access: public
    boolean includesAllOf (array $anArray)
    • array $anArray: An array of Timespans or DateAndTimes.
    includesAnyOf (line 292)

    Answer whether any the elements of anArray are in the receiver.

    • since: 5/13/05
    • access: public
    boolean includesAnyOf (array $anArray)
    • array $anArray: An array of Timespans or DateAndTimes.
    intersection (line 313)

    Return the Timespan both have in common, or null

    • return: object Timespan OR null
    • since: 5/13/05
    • access: public
    mixed intersection (object Timespan $aTimespan)
    isEqualTo (line 226)

    Test if this Timespan is equal to a Timespan.

    • since: 5/3/05
    • access: public
    boolean isEqualTo (object Timespan $aTimespan)

    Redefinition of:
    Magnitude::isEqualTo()
    Test if this is equal to aMagnitude.
    isLeapYear (line 552)

    Answer TRUE if the year represented by the receiver is a leap year.

    • since: 5/11/05
    • access: public
    integer isLeapYear ()

    Redefined in descendants as:
    isLessThan (line 239)

    Test if this Timespan is less than a comparand.

    • since: 5/3/05
    • access: public
    boolean isLessThan (object $aComparand)
    • object $aComparand

    Redefinition of:
    Magnitude::isLessThan()
    Test if this is less than aMagnitude.
    julianDayNumber (line 563)

    Answer the Julian day number represented by the reciever.

    • since: 5/11/05
    • access: public
    integer julianDayNumber ()
    minus (line 337)

    Subtract a Duration or DateAndTime.

    • return: (if operand is a Duration) OR Duration (if operand is a DateAndTime).
    • since: 5/3/05
    • access: public
    object Timespan minus (object $operand)
    • object $operand
    months (line 697)

    Return an array of the Months in the reciever.

    • since: 5/13/05
    • access: public
    array months ()
    next (line 361)

    Answer the next object of our duration.

    • since: 5/10/05
    • access: public
    object Timespan next ()
    plus (line 374)

    Add a Duration.

    • return: The result.
    • since: 5/3/05
    • access: public
    object Timespan plus (object Duration $aDuration)
    previous (line 389)

    Answer the previous object of our duration.

    • since: 5/10/05
    • access: public
    object Timespan previous ()

    Redefined in descendants as:
    printableString (line 574)

    Return a printable string

    • since: 5/13/05
    • access: public
    string printableString ()

    Redefinition of:
    SObject::printableString()
    Answer a String whose characters are a description of the receiver.

    Redefined in descendants as:
    setDuration (line 210)

    Set the Duration of this timespan

    • since: 5/4/05
    • access: private
    void setDuration (object Duration $aDuration)
    setStart (line 198)

    Store the start DateAndTime of this timespan

    • since: 5/4/05
    • access: private
    void setStart (object DateAndTime $aDateAndTime)
    start (line 629)

    Answer the start DateAndTime of this timespan

    • since: 5/11/05
    • access: public
    starting (line 117)

    Create a new object starting now, with zero duration

    • static:
    • since: 5/5/05
    • access: public
    object Timespan starting (object DateAndTime $aDateAndTime, [optional $class = 'Timespan'])
    • object DateAndTime $aDateAndTime
    • optional $class: string $class DO NOT USE OUTSIDE OF PACKAGE. This parameter is used to get around the limitations of not being able to find the class of the object that recieved the initial method call.

    Redefined in descendants as:
    startingDuration (line 137)

    Create a new object

    • static:
    • since: 5/5/05
    • access: public
    object Timespan startingDuration (object DateAndTime $aDateAndTime, object Duration $aDuration, [optional $class = 'Timespan'])
    • object DateAndTime $aDateAndTime
    • object Duration $aDuration
    • optional $class: string $class DO NOT USE OUTSIDE OF PACKAGE. This parameter is used to get around the limitations of not being able to find the class of the object that recieved the initial method call.

    Redefined in descendants as:
    startingEnding (line 166)

    Create a new object with given start and end DateAndTimes

    • since: 5/11/05
    • access: public
    object Timespan startingEnding (object DateAndTime $startDateAndTime, object DateAndTime $endDateAndTime, [optional $class = 'Timespan'])
    • object DateAndTime $startDateAndTime
    • object DateAndTime $endDateAndTime
    • optional $class: string $class DO NOT USE OUTSIDE OF PACKAGE. This parameter is used to get around the limitations of not being able to find the class of the object that recieved the initial method call.

    Redefined in descendants as:
    startMonth (line 585)

    Answer the month represented by the receiver.

    • since: 5/11/05
    • access: public
    integer startMonth ()
    startMonthAbbreviation (line 596)

    Answer the month represented by the receiver.

    • since: 5/11/05
    • access: public
    integer startMonthAbbreviation ()
    startMonthIndex (line 607)

    Answer the month represented by the receiver.

    • since: 5/11/05
    • access: public
    integer startMonthIndex ()
    startMonthName (line 618)

    Answer the month represented by the receiver.

    • since: 5/11/05
    • access: public
    integer startMonthName ()
    startYear (line 640)

    Answer the year represented by the receiver.

    • since: 5/11/05
    • access: public
    integer startYear ()
    to (line 859)

    Answer an Timespan. anEnd must be aDateAndTime or a Timespan

    • since: 5/13/05
    • access: public
    object Timespan to (object $anEnd)
    • object $anEnd: Must be a DateAndTime or a Timespan
    union (line 402)

    Return the Timespan spanned by both

    • return: object Timespan OR null
    • since: 5/13/05
    • access: public
    mixed union (object Timespan $aTimespan)
    weeks (line 718)

    Return an array of the weeks in the reciever.

    • since: 5/13/05
    • access: public
    array weeks ()
    years (line 739)

    Return an array of the years in the reciever.

    • since: 5/13/05
    • access: public
    array years ()

    Inherited Methods

    Inherited From Magnitude

    Magnitude::isBetween()
    Magnitude::isEqualTo()
    Magnitude::isGreaterThan()
    Magnitude::isGreaterThanOrEqualTo()
    Magnitude::isLessThan()
    Magnitude::isLessThanOrEqualTo()
    Magnitude::max()
    Magnitude::min()

    Inherited From SObject

    SObject::asA()
    SObject::asString()
    SObject::copy()
    SObject::copySameFrom()
    SObject::copyTwoLevel()
    SObject::deepCopy()
    SObject::isEqual()
    SObject::isEqualTo()
    SObject::isNotEqualTo()
    SObject::isNotReferenceTo()
    SObject::isReferenceTo()
    SObject::newFrom()
    SObject::postCopy()
    SObject::printableString()
    SObject::shallowCopy()
    SObject::_deepCopyArray()

    Documentation generated on Wed, 19 Sep 2007 10:27:26 -0400 by phpDocumentor 1.3.0RC3