|
@@ -1890,284 +1890,7 @@ messageSends: ["addAll:", "new", "yourself"]
|
|
|
$globals.Collection.a$cls);
|
|
|
|
|
|
|
|
|
-$core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
|
|
|
-
|
|
|
-$globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "at:",
|
|
|
-protocol: "accessing",
|
|
|
-fn: function (anIndex){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return $self._at_ifAbsent_(anIndex,(function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return $self._errorNotFound();
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["anIndex"],
|
|
|
-source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["at:ifAbsent:", "errorNotFound"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "at:ifAbsent:",
|
|
|
-protocol: "accessing",
|
|
|
-fn: function (anIndex,aBlock){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-$self._subclassResponsibility();
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["anIndex", "aBlock"],
|
|
|
-source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["subclassResponsibility"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "at:ifAbsentPut:",
|
|
|
-protocol: "accessing",
|
|
|
-fn: function (aKey,aBlock){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return $self._at_ifAbsent_(aKey,(function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return $self._at_put_(aKey,$recv(aBlock)._value());
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["aKey", "aBlock"],
|
|
|
-source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["at:ifAbsent:", "at:put:", "value"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "at:ifPresent:",
|
|
|
-protocol: "accessing",
|
|
|
-fn: function (anIndex,aBlock){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
|
|
|
-return nil;
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["anIndex", "aBlock"],
|
|
|
-source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["at:ifPresent:ifAbsent:"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "at:ifPresent:ifAbsent:",
|
|
|
-protocol: "accessing",
|
|
|
-fn: function (anIndex,aBlock,anotherBlock){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-$self._subclassResponsibility();
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["anIndex", "aBlock", "anotherBlock"],
|
|
|
-source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["subclassResponsibility"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "at:put:",
|
|
|
-protocol: "accessing",
|
|
|
-fn: function (anIndex,anObject){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-$self._subclassResponsibility();
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["anIndex", "anObject"],
|
|
|
-source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["subclassResponsibility"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "indexOf:",
|
|
|
-protocol: "accessing",
|
|
|
-fn: function (anObject){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return $self._indexOf_ifAbsent_(anObject,(function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return $self._errorNotFound();
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["anObject"],
|
|
|
-source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "indexOf:ifAbsent:",
|
|
|
-protocol: "accessing",
|
|
|
-fn: function (anObject,aBlock){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-$self._subclassResponsibility();
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["anObject", "aBlock"],
|
|
|
-source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["subclassResponsibility"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "with:do:",
|
|
|
-protocol: "enumerating",
|
|
|
-fn: function (anotherCollection,aBlock){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-$self._withIndexDo_((function(each,index){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["anotherCollection", "aBlock"],
|
|
|
-source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["withIndexDo:", "value:value:", "at:"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "withIndexDo:",
|
|
|
-protocol: "enumerating",
|
|
|
-fn: function (aBlock){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-$self._subclassResponsibility();
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["aBlock"],
|
|
|
-source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["subclassResponsibility"]
|
|
|
-}),
|
|
|
-$globals.IndexableCollection);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-$core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
|
|
|
+$core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
|
|
|
|
|
|
$globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
|
|
|
|
|
@@ -3845,7 +3568,7 @@ $globals.HashedCollection);
|
|
|
|
|
|
|
|
|
|
|
|
-$core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
|
|
|
+$core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
|
|
|
|
|
|
$globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
|
|
|
|
|
@@ -9911,6 +9634,279 @@ messageSends: []
|
|
|
$globals.RegularExpression.a$cls);
|
|
|
|
|
|
|
|
|
+$core.addTrait("TKeyValueCollection", "Kernel-Collections");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "at:",
|
|
|
+protocol: "accessing",
|
|
|
+fn: function (anIndex){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return $self._at_ifAbsent_(anIndex,(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._errorNotFound();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["anIndex"],
|
|
|
+source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["at:ifAbsent:", "errorNotFound"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "at:ifAbsent:",
|
|
|
+protocol: "accessing",
|
|
|
+fn: function (anIndex,aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._subclassResponsibility();
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["anIndex", "aBlock"],
|
|
|
+source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "at:ifAbsentPut:",
|
|
|
+protocol: "accessing",
|
|
|
+fn: function (aKey,aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return $self._at_ifAbsent_(aKey,(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._at_put_(aKey,$recv(aBlock)._value());
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aKey", "aBlock"],
|
|
|
+source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["at:ifAbsent:", "at:put:", "value"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "at:ifPresent:",
|
|
|
+protocol: "accessing",
|
|
|
+fn: function (anIndex,aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
|
|
|
+return nil;
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["anIndex", "aBlock"],
|
|
|
+source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["at:ifPresent:ifAbsent:"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "at:ifPresent:ifAbsent:",
|
|
|
+protocol: "accessing",
|
|
|
+fn: function (anIndex,aBlock,anotherBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._subclassResponsibility();
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["anIndex", "aBlock", "anotherBlock"],
|
|
|
+source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "at:put:",
|
|
|
+protocol: "accessing",
|
|
|
+fn: function (anIndex,anObject){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._subclassResponsibility();
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["anIndex", "anObject"],
|
|
|
+source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "indexOf:",
|
|
|
+protocol: "accessing",
|
|
|
+fn: function (anObject){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return $self._indexOf_ifAbsent_(anObject,(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._errorNotFound();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["anObject"],
|
|
|
+source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "indexOf:ifAbsent:",
|
|
|
+protocol: "accessing",
|
|
|
+fn: function (anObject,aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._subclassResponsibility();
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["anObject", "aBlock"],
|
|
|
+source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "with:do:",
|
|
|
+protocol: "enumerating",
|
|
|
+fn: function (anotherCollection,aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._withIndexDo_((function(each,index){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["anotherCollection", "aBlock"],
|
|
|
+source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["withIndexDo:", "value:value:", "at:"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "withIndexDo:",
|
|
|
+protocol: "enumerating",
|
|
|
+fn: function (aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._subclassResponsibility();
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aBlock"],
|
|
|
+source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
+}),
|
|
|
+$globals.TKeyValueCollection);
|
|
|
+
|
|
|
+
|
|
|
$core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -10111,6 +10107,8 @@ messageSends: []
|
|
|
}),
|
|
|
$globals.TNativeZeroBasedCollection);
|
|
|
|
|
|
+$core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
|
|
|
+$core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
|
|
|
$core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
|
|
|
$core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
|
|
|
|