[ANN] Chalten - A Point based model of the Gregorian Calendar

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ANN] Chalten - A Point based model of the Gregorian Calendar

Hernan Wilkinson
Hi,
    we uploaded to SqueakSource a new project called "Chalten" that is the Squeak implementation of the Gregorian Calendar we presented last year at ESUG.
    This model reifyes many concepts of the Gregorian Calendar that Smalltalk-80 does not (like day or day of month, etc).
    This model was born one year and a half ago but we just be able to open it.
    The main objective of this model is to easily solve problems of the Gregorian Calendar that are not so easy to do with the Smalltalk-80 classes. It provides also some concepts that are useful for financial applications like TimeLineFilter and RelativeGregorianDate.
    This model also uses the units models (Aconcagua) we uploaded last week. Because it uses the units model, there are some concepts that are not useful anymore, like Duration, because a Duration is a Measure of time.
    Anyway, you can read about the model at the SqueakSource wiki (we wrote a faq with some examples), the ESUG presentation from http://prog2.vub.ac.be/~cderoove/esugtalks/Wilkinson.pdf and the paper from http://www.iam.unibe.ch/publikationen/techreports/2005/iam-05-001/file/at_download

    It comes with almost 600 tests and you can read in the paper how it compares to Chronology.
    Here are some examples I hope you will like:

    January first, 2006     --> Creates an instance of GregorianDate for 01/01/2006
    January first              --> Creates an instance of GregorianDayOfMonth for 01/01
    January, 2006           --> Creates an instance of GregorianMonthOfYear for January 2006

    January first, 2006 distanceTo: July first, 2006  --> Returns an instance of Measure  "181 days"

    (GregorianYear number: 2006) months collect: [ :aMonthOfYear | aMonthOfYear lastDate ] -->Returns all the last dates of the 2006 months.
    (GregorianYear number: 2006) dates collect: [ :aDate | aDate isMonday ] -->Returns all Mondays of 2006

    “Let’s create a filter for all dates...”
     nonWorkingDays := TimelineFilter universe: (TheBeginningOfTime to: TheEndOfTime).
     “Now, we want Saturdays to be on that filter”
    nonWorkingDays addDayRule: Saturday.
    “Now we want Sundays from January 1st of year 1000 to the end of time...”
    nonWorkingDays addDayRule: Sunday from: (January first, 1000) to: TheEndOfTime.
    “Now we want all July 9th since 1816 because is the Independence Day in Argentina”.
    nonWorkingDays addDayOfMonthRule: July ninth from: (July ninth, 1816) to: TheEndOfTime.
    nonWorkingDays includes: (July ninth, 2005) “Returns true”
    nonWorkingDays includes: (July eighth, 2005) “Returns false”
    nonWorkingDays includes: (July sixteenth, 2005) “Returns true, it is Saturday”

    “06/01/2005 is a Thursday”
    aTimespan := GregorianTimespan from: (January sixth, 2005) duration: 48 hours.
    aSettleDate := RelativeGregorianDate timespan: aTimespan calendar: nonWorkingDays negated.
    “Returns false because 10/01/2005, a Monday, is a working day”
    nonWorkingDays includes: (January tenth, 2005).
    “Returns 10/01/2005”
    aSettleDate absoluteDate.
    ”Now a new non working day is added to the filter”
    nonWorkingDays addDateRuleFor: (January tenth, 2005).
    “Return true. Now 10/01/2005, is a not working day”
    nonWorkingDays includes: (January tenth, 2005).
    “Now it returns 11/01/2005 because the filter has changed”
    aSettleDate absoluteDate.

    Hernan.
-- 
______________________________
Lic. Hernán A. Wilkinson
Gerente de Desarrollo y Tecnología
Mercap S.R.L.
Tacuari 202 - 7mo Piso - Tel: 54-11-4878-1118
Buenos Aires - Argentina
http://www.mercapsoftware.com
--------------------------------------------------------------------- 
Este mensaje es confidencial. Puede contener informacion amparada 
por el secreto profesional. Si usted ha recibido este e-mail por error, 
por favor comuniquenoslo inmediatamente via e-mail y tenga la 
amabilidad de eliminarlo de su sistema; no debera copiar el mensaje 
ni divulgar su contenido a ninguna persona. Muchas gracias. 
 
This message is confidential. It may also contain information that is 
privileged or otherwise legally exempt from disclosure. If you have 
received it by mistake please let us know by e-mail immediately and 
delete it from your system; you should also not copy the message nor 
disclose its contents to anyone. Thanks. 
 ---------------------------------------------------------------------