Set.st
branchjv
changeset 17928 8e8dad2e6269
parent 17911 a99f15c5efa5
child 17966 8b5df02e171f
equal deleted inserted replaced
17927:ae1c64e8ade2 17928:8e8dad2e6269
   220     "
   220     "
   221      #(1 2 3 4 5 6 7) asSet copyWithout:5
   221      #(1 2 3 4 5 6 7) asSet copyWithout:5
   222     "
   222     "
   223 !
   223 !
   224 
   224 
   225 copyWithoutAll:aCollection
   225 copyWithoutAll:elementsToSkip
   226     ^ self select:[:each | (aCollection includes:each)]
   226     "return a new collection consisting of a copy of the receiver, with
       
   227      ALL elements equal to elementToSkip are left out.
       
   228      No error is reported, if elementsToSkip is not in the collection."
       
   229 
       
   230     elementsToSkip size * self size > 10000 ifTrue:[
       
   231         "speed up everything"
       
   232         ^ self \ (elementsToSkip asSet).
       
   233     ].
       
   234     ^ self \ elementsToSkip
   227 
   235 
   228     "
   236     "
   229      #(1 2 3 4 5 6 7) asSet copyWithoutAll:#(3 5 7 9)
   237      #(1 2 3 4 5 6 7) asSet copyWithoutAll:#(3 5 7 9)
       
   238      #(a b c d e f) asIdentitySet copyWithoutAll:#(d e f)
       
   239      #('a' 'b' 'c' 'd' 'e' 'f') asIdentitySet copyWithoutAll:#('d' 'e' 'f')
       
   240      #('a' 'b' 'c' 'd' 'e' 'f') asSet copyWithoutAll:#('d' 'e' 'f')
   230     "
   241     "
   231 !
   242 !
   232 
   243 
   233 like:anObject
   244 like:anObject
   234     "Answer an object in the receiver that is equal to anObject,
   245     "Answer an object in the receiver that is equal to anObject,
   518     ^ true.
   529     ^ true.
   519 
   530 
   520     "Modified: 30.1.1997 / 14:58:08 / cg"
   531     "Modified: 30.1.1997 / 14:58:08 / cg"
   521 ! !
   532 ! !
   522 
   533 
       
   534 !Set methodsFor:'binary storage'!
       
   535 
       
   536 readBinaryContentsFrom: stream manager: manager
       
   537     "must rehash after reload"
       
   538 
       
   539     super readBinaryContentsFrom: stream manager: manager.
       
   540     self rehash
       
   541 ! !
   523 
   542 
   524 !Set methodsFor:'comparing'!
   543 !Set methodsFor:'comparing'!
   525 
   544 
   526 = aCollection
   545 = aCollection
   527     "return true, if the argument is a Set containing the same elements
   546     "return true, if the argument is a Set containing the same elements
   657     ]
   676     ]
   658 
   677 
   659     "Modified: 1.3.1996 / 21:41:13 / cg"
   678     "Modified: 1.3.1996 / 21:41:13 / cg"
   660 ! !
   679 ! !
   661 
   680 
       
   681 !Set methodsFor:'inspecting'!
       
   682 
       
   683 inspectorClass
       
   684     "redefined to use SetInspector
       
   685      (instead of the default Inspector)."
       
   686 
       
   687     ^ SetInspectorView
       
   688 ! !
   662 
   689 
   663 !Set methodsFor:'obsolete set operations'!
   690 !Set methodsFor:'obsolete set operations'!
   664 
   691 
   665 + aCollection
   692 + aCollection
   666     "Kept for backward compatibility. 
   693     "Kept for backward compatibility. 
  1073     "return the number of set elements"
  1100     "return the number of set elements"
  1074 
  1101 
  1075     ^ tally
  1102     ^ tally
  1076 ! !
  1103 ! !
  1077 
  1104 
  1078 
       
  1079 !Set methodsFor:'testing'!
  1105 !Set methodsFor:'testing'!
  1080 
  1106 
  1081 capacity 
  1107 capacity 
  1082     "return the number of elements, that the receiver is
  1108     "return the number of elements, that the receiver is
  1083      prepared to take.
  1109      prepared to take.
  1175 ! !
  1201 ! !
  1176 
  1202 
  1177 !Set class methodsFor:'documentation'!
  1203 !Set class methodsFor:'documentation'!
  1178 
  1204 
  1179 version
  1205 version
  1180     ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.108 2011/02/28 12:27:23 cg Exp $'
  1206     ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.110 2012/02/22 12:55:54 stefan Exp $'
  1181 !
  1207 !
  1182 
  1208 
  1183 version_CVS
  1209 version_CVS
  1184     ^ '§Header: /cvs/stx/stx/libbasic/Set.st,v 1.108 2011/02/28 12:27:23 cg Exp §'
  1210     ^ '§Header: /cvs/stx/stx/libbasic/Set.st,v 1.110 2012/02/22 12:55:54 stefan Exp §'
  1185 !
  1211 !
  1186 
  1212 
  1187 version_SVN
  1213 version_SVN
  1188     ^ '$Id: Set.st 10761 2012-01-19 11:46:00Z vranyj1 $'
  1214     ^ '$Id: Set.st 10792 2012-03-21 17:45:38Z vranyj1 $'
  1189 ! !
  1215 ! !
  1190 
  1216 
  1191 Set initialize!
  1217 Set initialize!
  1192 
  1218 
  1193 
  1219