add methods for squeak compatibility
authorpenk
Fri, 07 Feb 2003 10:52:28 +0100
changeset 7011 4d7910fcaa7e
parent 7010 13fcdfdc95b1
child 7012 31e8a29097f1
add methods for squeak compatibility
Collection.st
Time.st
--- a/Collection.st	Fri Feb 07 10:49:59 2003 +0100
+++ b/Collection.st	Fri Feb 07 10:52:28 2003 +0100
@@ -272,6 +272,14 @@
 
 !Collection methodsFor:'Compatibility - Squeak'!
 
+addIfNotPresent: anObject
+    "Include anObject as one of the receiver's elements, but only if there
+    is no such element already. Anwser anObject."
+
+    (self includes: anObject) ifFalse: [self add: anObject].
+    ^ anObject
+!
+
 anyOne
     "return any element from the collection, or nil if there is none.
      Same as #anElement - for Squeak compatibility"
@@ -2476,7 +2484,7 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.133 2003-01-26 14:13:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.134 2003-02-07 09:51:37 penk Exp $'
 ! !
 
 Collection initialize!
--- a/Time.st	Fri Feb 07 10:49:59 2003 +0100
+++ b/Time.st	Fri Feb 07 10:52:28 2003 +0100
@@ -69,32 +69,6 @@
 
 !Time class methodsFor:'instance creation'!
 
-fromSeconds:secondsSinceMidnight
-    "return a new Time, which represents the number of seconds since midNight.
-     Be careful, time wraps - if the number of seconds exceeds the number of seconds
-     in a day, a time relative to another days midnight is returned.
-     (i.e. (Time fromSeconds:0) = (Time fromSeconds:24*3600)"
-
-    |s|
-
-    s := secondsSinceMidnight \\ (3600 * 24).
-    ^ self
-        hours:(s // 3600)
-        minutes:((s \\ 3600) // 60)
-        seconds:((s \\ 3600) \\ 60)
-
-    "
-     Time fromSeconds:0     
-     Time fromSeconds:3675     
-     Time fromSeconds:36000     
-     Time fromSeconds:72000     
-     Time fromSeconds:96000      
-     Time fromSeconds:360000      
-    "
-
-    "Modified: 8.10.1996 / 19:32:11 / cg"
-!
-
 hour:h minutes:m seconds:s
     "return an instance of Time representing the given time.
      See also Time now / Date today / AbsoluteTime now.
@@ -235,7 +209,6 @@
     ^ '%h:%m:%s'
 ! !
 
-
 !Time methodsFor:'Compatibility - Squeak'!
 
 intervalString
@@ -626,7 +599,7 @@
 
 setSeconds:secs
     "set my time given seconds since midnight.
-     Notice the modulu opeartions here - there c annot be a time behond 24hours
+     Notice the modulu operations here - there cannot be a time behond 24hours
      (use TimeDuration, if you need that)."
 
     secs < 0 ifTrue:[
@@ -639,6 +612,8 @@
     ]
 
     "
+     Time basicNew setSeconds:0 
+     Time fromSeconds:3601  
      Time now seconds
      Time now timeEncoding
      (Time now addDays:5) seconds     
@@ -660,9 +635,8 @@
     timeEncoding := encoding
 ! !
 
-
 !Time class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.59 2002-11-26 13:52:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.60 2003-02-07 09:52:28 penk Exp $'
 ! !