Interval.st
changeset 7823 4a31fa10c6eb
parent 7821 a8fd1f2b07dd
child 8374 a5d76d47cc70
--- a/Interval.st	Wed Jan 07 13:50:57 2004 +0100
+++ b/Interval.st	Wed Jan 07 13:51:18 2004 +0100
@@ -371,6 +371,77 @@
 
 !Interval methodsFor:'queries'!
 
+max
+    "return the maximum value in the receiver collection,
+     redefined, since this can be easily computed.
+     Raises an error, if the receiver is empty."
+
+    step == 1 ifTrue:[stop >= start ifTrue:[^ stop]].
+    step < 0 ifTrue:[stop <= start ifTrue:[^ start]].
+    ^ super max
+
+    "
+     (0 to:15) max           
+     (0 to:15 by:2) max      
+     (0 to:15 by:8) max      
+     (15 to:0) max           -> error
+     (15 to:0 by:4) max      -> error      
+     (-1 to:-15 by:-1) max    
+     (-1 to:-15 by:-4) max    
+     (-1 to:15 by:-1) max    -> error  
+    "
+!
+
+min
+    "return the minimum value in the receiver collection,
+     redefined, since this can be easily computed.
+     Raises an error, if the receiver is empty."
+
+    step == -1 ifTrue:[stop <= start ifTrue:[^ stop]].
+    step > 0 ifTrue:[stop >= start ifTrue:[^ start]].
+    ^ super min
+
+    "
+     (0 to:15) min           
+     (0 to:15 by:2) min      
+     (0 to:15 by:8) min      
+     (15 to:0) min          -> error
+     (15 to:0 by:4) min     -> error     
+     (-1 to:-15 by:-1) min    
+     (-1 to:-15 by:-4) min    
+     (-1 to:15 by:-1) min   -> error   
+    "
+!
+
+minMax
+    "return the minimum and maximum values in the receiver collection
+     as a two element array.
+     Raises an error, if the receiver is empty."
+
+    step == -1 ifTrue:[
+        stop <= start ifTrue:[
+            ^ Array with:stop with:start
+        ]
+    ].
+    step == 1 ifTrue:[
+        stop >= start ifTrue:[
+            ^ Array with:start with:stop
+        ]
+    ].
+    ^ super minMax
+
+    "
+     (0 to:15) minMax           
+     (0 to:15 by:2) minMax      
+     (0 to:15 by:8) minMax      
+     (15 to:0) minMax          -> error
+     (15 to:0 by:4) minMax     -> error     
+     (-1 to:-15 by:-1) minMax    
+     (-1 to:-15 by:-4) minMax    
+     (-1 to:15 by:-1) minMax   -> error   
+    "
+!
+
 size
     "return the number of elements in the collection"
 
@@ -440,81 +511,10 @@
      (-10 to:-20 by:-2) includes:-24   
 
     "
-!
-
-max
-    "return the maximum value in the receiver collection,
-     redefined, since this can be easily computed.
-     Raises an error, if the receiver is empty."
-
-    step == 1 ifTrue:[stop >= start ifTrue:[^ stop]].
-    step < 0 ifTrue:[stop <= start ifTrue:[^ start]].
-    ^ super max
-
-    "
-     (0 to:15) max           
-     (0 to:15 by:2) max      
-     (0 to:15 by:8) max      
-     (15 to:0) max           -> error
-     (15 to:0 by:4) max      -> error      
-     (-1 to:-15 by:-1) max    
-     (-1 to:-15 by:-4) max    
-     (-1 to:15 by:-1) max    -> error  
-    "
-!
-
-min
-    "return the minimum value in the receiver collection,
-     redefined, since this can be easily computed.
-     Raises an error, if the receiver is empty."
-
-    step == -1 ifTrue:[stop <= start ifTrue:[^ stop]].
-    step > 0 ifTrue:[stop >= start ifTrue:[^ start]].
-    ^ super min
-
-    "
-     (0 to:15) min           
-     (0 to:15 by:2) min      
-     (0 to:15 by:8) min      
-     (15 to:0) min          -> error
-     (15 to:0 by:4) min     -> error     
-     (-1 to:-15 by:-1) min    
-     (-1 to:-15 by:-4) min    
-     (-1 to:15 by:-1) min   -> error   
-    "
-!
-
-minMax
-    "return the minimum and maximum values in the receiver collection
-     as a two element array.
-     Raises an error, if the receiver is empty."
-
-    step == -1 ifTrue:[
-        stop <= start ifTrue:[
-            ^ Array with:stop with:start
-        ]
-    ].
-    step == 1 ifTrue:[
-        stop >= start ifTrue:[
-            ^ Array with:start with:stop
-        ]
-    ].
-    ^ super minMax
-
-    "
-     (0 to:15) minMax           
-     (0 to:15 by:2) minMax      
-     (0 to:15 by:8) minMax      
-     (15 to:0) minMax          -> error
-     (15 to:0 by:4) minMax     -> error     
-     (-1 to:-15 by:-1) minMax    
-     (-1 to:-15 by:-4) minMax    
-     (-1 to:15 by:-1) minMax   -> error   
-    "
 ! !
 
 !Interval class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Interval.st,v 1.38 2004-01-07 12:50:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Interval.st,v 1.39 2004-01-07 12:51:18 cg Exp $'
 ! !