<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">&lt;<a href="mailto:mtaborda@gmail.com">mtaborda@gmail.com</a>&gt;</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>
&quot;Chalten&quot; (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 &quot;SDL way&quot;,<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>
&quot;Create some time entities&quot;<br>
 &nbsp; &nbsp; &nbsp; August twentieth, 2008 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the gregorian Date for 20/08/2008<br>
 &nbsp; &nbsp; &nbsp; August twentieth &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the gregorian DayOfMonth for 20/08<br>
 &nbsp; &nbsp; &nbsp; August, 2008 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the gregorian MonthOfYear for August of 2008<br>
<br>
&quot;But, not only gregorian entities&quot;<br>
 &nbsp; &nbsp; &nbsp; Shaban seventeenth, 1429 &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the islamic Date for 17/08/1429<br>
 &nbsp; &nbsp; &nbsp; Shaban seventeenth &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the islamic DayOfMonth for 17/08<br>
 &nbsp; &nbsp; &nbsp; Shaban, 1429 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the islamic MonthOfYear for Shaban of 1429<br>
<br>
 &nbsp; &nbsp; &nbsp; JulianAugust seventh, 2008 &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the julian Date for 07/08/2008<br>
 &nbsp; &nbsp; &nbsp; JulianAugust seventh &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the julian DayOfMonth for 07/08<br>
 &nbsp; &nbsp; &nbsp; JulianAugust, 2008 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the julian MonthOfYear for August of 2008<br>
<br>
 &nbsp; &nbsp; &nbsp; Av nineteenth, 5768 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&gt; &nbsp; &nbsp; Creates an instance of<br>
the hebrew Date for 19/05/2008<br>
 &nbsp; &nbsp; &nbsp; Av nineteenth &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&gt; &nbsp; &nbsp; Creates an instance of<br>
the hebrew DayOfMonth for 19/05<br>
 &nbsp; &nbsp; &nbsp; Av, 5768 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Creates an instance of<br>
the hebrew MonthOfYear for Av of 5768<br>
<br>
&quot;Converting dates between diferents calendars&quot;<br>
 &nbsp; &nbsp; &nbsp; (August twentieth, 2008) asIslamic &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Return Sha&#39;ban 17, 1429<br>
 &nbsp; &nbsp; &nbsp; (August twentieth, 2008) asHebrew &nbsp; &nbsp; &nbsp; --&gt; &nbsp; &nbsp; Return Av 19, 5768<br>
 &nbsp; &nbsp; &nbsp; (August twentieth, 2008) asJulian &nbsp; &nbsp; &nbsp; --&gt; &nbsp; &nbsp; August 7, 2008 (julian)<br>
<br>
 &nbsp; &nbsp; &nbsp; (Shaban seventeenth, 1429) asHebrew &nbsp; &nbsp; --&gt; &nbsp; &nbsp; Return Av 19, 5768<br>
 &nbsp; &nbsp; &nbsp; (JulianAugust seventh, 2008) asIslamic &nbsp;--&gt; &nbsp; &nbsp; Return Sha&#39;ban 17, 1429<br>
 &nbsp; &nbsp; &nbsp; (Av nineteenth, 5768) asGregorian &nbsp; &nbsp; &nbsp; --&gt; &nbsp; &nbsp; August 20, 2008<br>
(gregorian)<br>
<br>
&quot;Measuring distances&quot;<br>
 &nbsp; &nbsp; &nbsp; August twentieth, 2008 distanceTo: December thirtieth, 2008<br>
--&gt; &nbsp; &nbsp; Return an instance of Measure &lt;132 days&gt;<br>
 &nbsp; &nbsp; &nbsp; Shaban seventeenth, 1429 distanceTo: Muharram second, 1430<br>
--&gt; &nbsp; &nbsp; Return an instance of Measure &lt;132 days&gt;<br>
 &nbsp; &nbsp; &nbsp; Av nineteenth, 5768 distanceTo: Tevet third, 5769<br>
--&gt; &nbsp; &nbsp; Return an instance of Measure &lt;132 days&gt;<br>
<br>
&quot;Also, measuring distance expressed in diferents way (calendars)&quot;<br>
 &nbsp; &nbsp; &nbsp; August twentieth, 2008 distanceTo: Tevet third, 5769<br>
--&gt; &nbsp; &nbsp; Return an instance of Measure &lt;132 days&gt;<br>
 &nbsp; &nbsp; &nbsp; Shaban seventeenth, 1429 distanceTo: December thirtieth, 2008<br>
&nbsp;--&gt; &nbsp; &nbsp; Return an instance of Measure &lt;132 days&gt;<br>
 &nbsp; &nbsp; &nbsp; Av nineteenth, 5768 distanceTo: Muharram second, 1430<br>
--&gt; &nbsp; &nbsp; Return an instance of Measure &lt;132 days&gt;<br>
<br>
&quot;Collect some entities&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;(ChaltenYear number: 2008 calendar: GregorianCalendar) months<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;collect: [:monthOfYear | monthOfYear lastDate] &nbsp;--&gt; &nbsp; &nbsp; Returns all<br>
the last dates of the 2008 months.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;(ChaltenYear number: 2008 calendar: GregorianCalendar) dates select:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[:date | date is: Monday] &nbsp; &nbsp; &nbsp; --&gt; &nbsp; &nbsp; Returns all Mondays of 2008<br>
 &nbsp; &nbsp; &nbsp; &nbsp;(ChaltenYear number: 5768 calendar: HebrewCalendar) dates select:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[:date | date is: YomShabbat] &nbsp; --&gt; &nbsp; &nbsp; Returns all yom shabbats of 5768<br>
<br>
&quot;Let&#39;s create a filter for all dates...&quot;<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays := TimeLineFilter named: &#39;Non Working Days&#39;<br>
<br>
&quot;Now, we want Saturdays to be on that filter&quot;<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays addDayRule: Saturday<br>
<br>
&quot;Now we want Sundays from January 1st of year 1000 to the end of time...&quot;<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addRule: (nonWorkingDays dayRule: Sunday)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from: (January first, 1000)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to: TheEndOfTime<br>
<br>
&quot;Now we want all July 9th since 1816 because is the Independence Day<br>
in Argentina&quot;.<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addRule: (nonWorkingDays dayOfMonthRule: July ninth)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from: (July ninth, 1816)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to: TheEndOfTime<br>
<br>
&quot;Testing some dates...&quot;<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays includes: (July ninth, 2008) &nbsp; &nbsp; --&gt; &nbsp; &nbsp; Returns true<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays includes: (July eighth, 2008) &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Returns false<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays includes: (July twelfth, 2008) &nbsp; --&gt; &nbsp; &nbsp; Returns<br>
true, it is Saturday<br>
<br>
&quot;But, how about to filter some like the hebrew new year day&quot;<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays addDayOfMonthRule: Tishri first<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays includes: (Tishri first, 5769) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&gt;<br>
Return true, it is the next hebrew new year<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays includes: (September thirtieth, 2008) &nbsp; &nbsp;--&gt;<br>
Return true, it is the next hebrew new year (in gregorian)<br>
<br>
&quot;21/08/2008 is a Thursday&quot;<br>
 &nbsp; &nbsp; &nbsp; timespan := TimeSpan from: (August twentyfirst, 2008) duration:<br>
(48 * TimeUnits hour)<br>
 &nbsp; &nbsp; &nbsp; settleDate := RelativeDate timespan: timespan using:<br>
nonWorkingDays negated<br>
<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays includes: (August twentyfifth, 2008) &nbsp; &nbsp; --&gt;<br>
Returns false because 25/08/2008, a Monday, is a working day<br>
 &nbsp; &nbsp; &nbsp; settleDate absoluteDate &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&gt;<br>
Returns 25/08/2008<br>
<br>
&quot;Now a new non working day is added to the filter&quot;<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays addDateRule: (August twentyfifth, 2008)<br>
<br>
 &nbsp; &nbsp; &nbsp; nonWorkingDays includes: (August twentyfifth, 2008) &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Return true.<br>
&quot;Now 25/08/2008, is a not working day&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;settleDate absoluteDate &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&gt; &nbsp; &nbsp; Now it returns 26/08/2008 because<br>
the filter has changed<br>
<br>
&quot;Working with time zones&quot;<br>
 &nbsp; &nbsp; &nbsp; buenosAiresDateTime := TimeZonedDateTime<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dateTime: (DateTime<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; date: August twentieth, 2008<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timeOfDay: (TimeOfDay hours: 19 minutes: 35))<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zone: TimeZones buenosAires<br>
<br>
 &nbsp; &nbsp; &nbsp; greenwichDateTime := TimeZonedDateTime<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dateTime: (DateTime<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; date: August twentieth, 2008<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timeOfDay: (TimeOfDay hours: 22 minutes: 35))<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zone: TimeZones greenwich<br>
<br>
 &nbsp; &nbsp; &nbsp; buenosAiresDateTime = greenwichDateTime &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Return true,<br>
it is the same instant but measure in diferent zone<br>
 &nbsp; &nbsp; &nbsp; buenosAiresDateTime distanceTo: greenwichDateTime &nbsp; &nbsp; &nbsp; &nbsp;--&gt;<br>
Return a measure &lt;0 days&gt;, because it is the same instant<br>
<br>
 &nbsp; &nbsp; &nbsp; buenosAiresDateTime &nbsp;:= buenosAiresDateTime next: (TimeUnits hour * 3)<br>
<br>
 &nbsp; &nbsp; &nbsp; buenosAiresDateTime = greenwichDateTime &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; &nbsp; &nbsp; Return false,<br>
the hour is the same but the zone is different<br>
 &nbsp; &nbsp; &nbsp; (buenosAiresDateTime distanceTo: greenwichDateTime)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;convertTo: TimeUnits hour &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&gt; &nbsp; &nbsp; Return a measure &lt;-3 hours&gt;,<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>