Collection.st
changeset 16001 bfcae2d9da7f
parent 15999 b318442bdc23
child 16007 fcc49f75d8de
equal deleted inserted replaced
16000:74d0c38d1834 16001:bfcae2d9da7f
   774     self isEmpty ifTrue:[^ exceptionValue value].
   774     self isEmpty ifTrue:[^ exceptionValue value].
   775     ^ self last
   775     ^ self last
   776 
   776 
   777     "Modified: 6.2.1996 / 15:27:17 / cg"
   777     "Modified: 6.2.1996 / 15:27:17 / cg"
   778     "Created: 6.2.1996 / 15:27:49 / cg"
   778     "Created: 6.2.1996 / 15:27:49 / cg"
   779 !
       
   780 
       
   781 median
       
   782     "Return the middle element, or as close as we can get."
       
   783 
       
   784     ^ self asSortedCollection median
       
   785 
       
   786     "
       
   787      #(10 35 20 45 30 5) median
       
   788     "
       
   789 !
   779 !
   790 
   780 
   791 nth:n
   781 nth:n
   792     "return the nth element of the collection.
   782     "return the nth element of the collection.
   793      For unordered collections, this simply returns the nth
   783      For unordered collections, this simply returns the nth
  5006     "
  4996     "
  5007 
  4997 
  5008     "Created: / 13-04-2011 / 16:53:44 / cg"
  4998     "Created: / 13-04-2011 / 16:53:44 / cg"
  5009 !
  4999 !
  5010 
  5000 
       
  5001 median
       
  5002     "Return the middle element, or as close as we can get."
       
  5003 
       
  5004     ^ self asSortedCollection median
       
  5005 
       
  5006     "
       
  5007      #(10 35 20 45 30 5) median
       
  5008     "
       
  5009 !
       
  5010 
  5011 standardDeviation
  5011 standardDeviation
  5012     "standard deviation value of all elements in the collection,
  5012     "standard deviation value of all elements in the collection,
  5013      which is the complete set and not a sample."
  5013      which is the complete set and not a sample."
  5014 
  5014 
  5015     ^ self variance sqrt
  5015     ^ self variance sqrt
  5372 ! !
  5372 ! !
  5373 
  5373 
  5374 !Collection class methodsFor:'documentation'!
  5374 !Collection class methodsFor:'documentation'!
  5375 
  5375 
  5376 version
  5376 version
  5377     ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.322 2014-02-12 14:33:29 cg Exp $'
  5377     ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.323 2014-02-12 14:35:02 cg Exp $'
  5378 !
  5378 !
  5379 
  5379 
  5380 version_CVS
  5380 version_CVS
  5381     ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.322 2014-02-12 14:33:29 cg Exp $'
  5381     ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.323 2014-02-12 14:35:02 cg Exp $'
  5382 ! !
  5382 ! !
  5383 
  5383 
  5384 
  5384 
  5385 Collection initialize!
  5385 Collection initialize!