<div dir="ltr">Congratulations Don Maxi ;).<br><br>Good news indeed.<br><br><div class="gmail_quote">On Tue, Aug 26, 2008 at 5:20 PM, Maximiliano Taborda <span dir="ltr"><<a href="mailto:mtaborda@gmail.com">mtaborda@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi.<br>
<br>
We uploaded to SqueakSource (for Squeak) and to the Cincom Public<br>
Repository (for Visualworks) a new release of the project called<br>
"Chalten" (2.0) that is our implementation of the Time Domain (not<br>
only of the Gregorian Calendar now).<br>
<br>
This model was born as a representation of the Gregorian Calendar,<br>
and, in this last version, the model support the Gregorian, Julian,<br>
Islamic an Hebrew Calendars.<br>
Many refactorings was done from the original model to get this last<br>
version wich reifyes many concepts of the Time Domain that<br>
Smalltalk-80 does not; for example: day, day of month, month of year,<br>
month, year, calendars, time zones, filters over the timeline, etc..<br>
<br>
The main objective of this model is to easily, and in a "SDL way",<br>
solve problems of the Time Domain that are not easy (or impossible) to<br>
do with the Smalltalk-80 abstractions.<br>
t provides also some concepts that are useful for financial<br>
application, among others, like relative dates and time line filters.<br>
<br>
This model also uses the units models (Aconcagua). Because it uses the<br>
units model, there are some concepts that are not useful anymore, like<br>
Duration, because a Duration is a Measure of time.<br>
The model covers many concepts of the Time Domain, but lacks of some<br>
abstractions; for example, the representation of the leap second.<br>
<br>
It comes with more than 1600 tests (all green).<br>
<br>
Here are some examples:<br>
<br>
"Create some time entities"<br>
August twentieth, 2008 --> Creates an instance of<br>
the gregorian Date for 20/08/2008<br>
August twentieth --> Creates an instance of<br>
the gregorian DayOfMonth for 20/08<br>
August, 2008 --> Creates an instance of<br>
the gregorian MonthOfYear for August of 2008<br>
<br>
"But, not only gregorian entities"<br>
Shaban seventeenth, 1429 --> Creates an instance of<br>
the islamic Date for 17/08/1429<br>
Shaban seventeenth --> Creates an instance of<br>
the islamic DayOfMonth for 17/08<br>
Shaban, 1429 --> Creates an instance of<br>
the islamic MonthOfYear for Shaban of 1429<br>
<br>
JulianAugust seventh, 2008 --> Creates an instance of<br>
the julian Date for 07/08/2008<br>
JulianAugust seventh --> Creates an instance of<br>
the julian DayOfMonth for 07/08<br>
JulianAugust, 2008 --> Creates an instance of<br>
the julian MonthOfYear for August of 2008<br>
<br>
Av nineteenth, 5768 --> Creates an instance of<br>
the hebrew Date for 19/05/2008<br>
Av nineteenth --> Creates an instance of<br>
the hebrew DayOfMonth for 19/05<br>
Av, 5768 --> Creates an instance of<br>
the hebrew MonthOfYear for Av of 5768<br>
<br>
"Converting dates between diferents calendars"<br>
(August twentieth, 2008) asIslamic --> Return Sha'ban 17, 1429<br>
(August twentieth, 2008) asHebrew --> Return Av 19, 5768<br>
(August twentieth, 2008) asJulian --> August 7, 2008 (julian)<br>
<br>
(Shaban seventeenth, 1429) asHebrew --> Return Av 19, 5768<br>
(JulianAugust seventh, 2008) asIslamic --> Return Sha'ban 17, 1429<br>
(Av nineteenth, 5768) asGregorian --> August 20, 2008<br>
(gregorian)<br>
<br>
"Measuring distances"<br>
August twentieth, 2008 distanceTo: December thirtieth, 2008<br>
--> Return an instance of Measure <132 days><br>
Shaban seventeenth, 1429 distanceTo: Muharram second, 1430<br>
--> Return an instance of Measure <132 days><br>
Av nineteenth, 5768 distanceTo: Tevet third, 5769<br>
--> Return an instance of Measure <132 days><br>
<br>
"Also, measuring distance expressed in diferents way (calendars)"<br>
August twentieth, 2008 distanceTo: Tevet third, 5769<br>
--> Return an instance of Measure <132 days><br>
Shaban seventeenth, 1429 distanceTo: December thirtieth, 2008<br>
--> Return an instance of Measure <132 days><br>
Av nineteenth, 5768 distanceTo: Muharram second, 1430<br>
--> Return an instance of Measure <132 days><br>
<br>
"Collect some entities"<br>
(ChaltenYear number: 2008 calendar: GregorianCalendar) months<br>
collect: [:monthOfYear | monthOfYear lastDate] --> Returns all<br>
the last dates of the 2008 months.<br>
(ChaltenYear number: 2008 calendar: GregorianCalendar) dates select:<br>
[:date | date is: Monday] --> Returns all Mondays of 2008<br>
(ChaltenYear number: 5768 calendar: HebrewCalendar) dates select:<br>
[:date | date is: YomShabbat] --> Returns all yom shabbats of 5768<br>
<br>
"Let's create a filter for all dates..."<br>
nonWorkingDays := TimeLineFilter named: 'Non Working Days'<br>
<br>
"Now, we want Saturdays to be on that filter"<br>
nonWorkingDays addDayRule: Saturday<br>
<br>
"Now we want Sundays from January 1st of year 1000 to the end of time..."<br>
nonWorkingDays<br>
addRule: (nonWorkingDays dayRule: Sunday)<br>
from: (January first, 1000)<br>
to: TheEndOfTime<br>
<br>
"Now we want all July 9th since 1816 because is the Independence Day<br>
in Argentina".<br>
nonWorkingDays<br>
addRule: (nonWorkingDays dayOfMonthRule: July ninth)<br>
from: (July ninth, 1816)<br>
to: TheEndOfTime<br>
<br>
"Testing some dates..."<br>
nonWorkingDays includes: (July ninth, 2008) --> Returns true<br>
nonWorkingDays includes: (July eighth, 2008) --> Returns false<br>
nonWorkingDays includes: (July twelfth, 2008) --> Returns<br>
true, it is Saturday<br>
<br>
"But, how about to filter some like the hebrew new year day"<br>
nonWorkingDays addDayOfMonthRule: Tishri first<br>
nonWorkingDays includes: (Tishri first, 5769) --><br>
Return true, it is the next hebrew new year<br>
nonWorkingDays includes: (September thirtieth, 2008) --><br>
Return true, it is the next hebrew new year (in gregorian)<br>
<br>
"21/08/2008 is a Thursday"<br>
timespan := TimeSpan from: (August twentyfirst, 2008) duration:<br>
(48 * TimeUnits hour)<br>
settleDate := RelativeDate timespan: timespan using:<br>
nonWorkingDays negated<br>
<br>
nonWorkingDays includes: (August twentyfifth, 2008) --><br>
Returns false because 25/08/2008, a Monday, is a working day<br>
settleDate absoluteDate --><br>
Returns 25/08/2008<br>
<br>
"Now a new non working day is added to the filter"<br>
nonWorkingDays addDateRule: (August twentyfifth, 2008)<br>
<br>
nonWorkingDays includes: (August twentyfifth, 2008) --> Return true.<br>
"Now 25/08/2008, is a not working day"<br>
settleDate absoluteDate --> Now it returns 26/08/2008 because<br>
the filter has changed<br>
<br>
"Working with time zones"<br>
buenosAiresDateTime := TimeZonedDateTime<br>
dateTime: (DateTime<br>
date: August twentieth, 2008<br>
timeOfDay: (TimeOfDay hours: 19 minutes: 35))<br>
zone: TimeZones buenosAires<br>
<br>
greenwichDateTime := TimeZonedDateTime<br>
dateTime: (DateTime<br>
date: August twentieth, 2008<br>
timeOfDay: (TimeOfDay hours: 22 minutes: 35))<br>
zone: TimeZones greenwich<br>
<br>
buenosAiresDateTime = greenwichDateTime --> Return true,<br>
it is the same instant but measure in diferent zone<br>
buenosAiresDateTime distanceTo: greenwichDateTime --><br>
Return a measure <0 days>, because it is the same instant<br>
<br>
buenosAiresDateTime := buenosAiresDateTime next: (TimeUnits hour * 3)<br>
<br>
buenosAiresDateTime = greenwichDateTime --> Return false,<br>
the hour is the same but the zone is different<br>
(buenosAiresDateTime distanceTo: greenwichDateTime)<br>
convertTo: TimeUnits hour --> Return a measure <-3 hours>,<br>
just the offset between zones<br>
<br>
<br>
<br>
Regards.-<br>
<font color="#888888">Maximiliano<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Mariano.<br><a href="http://www.egola.com.ar">www.egola.com.ar</a><br>
</div>