'From Squeak3.3alpha of 15 February 2002 [latest update: #4840] on 24 April 2002 at 11:39:50 am'!
"Change Set: Cls-Comments-MM
Date: 24 April 2002
Author: Maarten Maartensz (and Ted Kaehler)
Much better class comments for Magnitudes and others."!
!Magnitude commentStamp: 'tk 4/24/2002 11:19' prior: 0!
Magnitude has methods for dealing with linearly ordered collections.
Subclasses represent dates, times, and numbers.
Example for interval-testing (answers a Boolean):
7 between: 5 and: 10
No instance-variables.
!
!Date commentStamp: 'tk 4/24/2002 11:17' prior: 0!
Date provides methods for dealing with calendar dates in different formats.
It uses Julian Day Numbers internally. Julian Day Numbers are the number of days which have elapsed since 24 November -4713 Gregorian.
The algorithm was published in the Communications of the ACM, volume 11, Number 10, October 1968.
See also:
http://www.magnet.ch/serendipity/hermetic/cal_stud/jdn.htm
http://www.cs.ubc.ca/spider/flinn/docs/scham/primitives/time.html
Instance Variables: julianDayNumber
Class Variables: 'DaysInMonth FirstDayOfMonth MonthNames SecondsInDay WeekDayNames '
Examples (use Cmd-p):
Nicely formatted today's date and time.
Date dateAndTimeNow.
The date 18025 days after 1.1.1901. Works also with negative numbers.
Date fromDays: 18025.
!
]style[(323 58 1 65 305)f1,f1Rhttp://www.magnet.ch/serendipity/hermetic/cal_stud/jdn.htm;,f1,f1Rhttp://www.cs.ubc.ca/spider/flinn/docs/scham/primitives/time.html;,f1!
!Fraction commentStamp: 'tk 4/24/2002 11:37' prior: 0!
Fraction provides methods for dealing with fractions like 1/3 as fractions (not as 0.33333...). All public arithmetic operations answer reduced fractions (see examples).
instance variables: 'numerator denominator '
Examples: (note the parentheses required to get the right answers in Smalltalk and Squeak):
(2/3) + (2/3)
(2/3) + (1/2) "answers shows the reduced fraction"
(2/3) raisedToInteger: 5 "fractions also can have exponents"
!
!Time commentStamp: 'tk 4/24/2002 11:21' prior: 0!
Time contains methods for dealing with the time in one 24 hour period.
Time stores the number of seconds since midnight in its instance variable.
Instance variable: 'seconds'
Examples:
Time now.
Time dateAndTimeNow.
!
!Week commentStamp: 'tk 4/24/2002 11:35' prior: 0!
Week gives methods for dealing with the days of the week.
Weekdays begin on #Monday and end on #Sunday.
Class variable: 'StartMonday'.
[If you want Weeks to start on Sunday, the execute (Week toggleStartMonday). Beware that other programs in your system may be wrong if they assume weeks start on Monday.]
Example: Find which week in the month a date occurs in (first week, second week, etc.)
('24 Apr 2002' asDate week) index
What date is the start of the week containing a date?
('1 Jan 2002' asDate week) firstDate !