smalltalk.addPackage('Kernel-Collections', {}); smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections'); smalltalk.addMethod( "__eq", smalltalk.method({ selector: "=", fn: function (anAssociation){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(_st(self)._class()).__eq(_st(anAssociation)._class()))._and_((function(){ return _st(_st(_st(self)._key()).__eq(_st(anAssociation)._key()))._and_((function(){ return _st(_st(self)._value()).__eq(_st(anAssociation)._value()); })); })); return $1; }, self, "=", [anAssociation], smalltalk.Association)} }), smalltalk.Association); smalltalk.addMethod( "_key", smalltalk.method({ selector: "key", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self["@key"]; }, self, "key", [], smalltalk.Association)} }), smalltalk.Association); smalltalk.addMethod( "_key_", smalltalk.method({ selector: "key:", fn: function (aKey){ var self=this; return smalltalk.withContext(function($ctx) { self["@key"]=aKey; return self}, self, "key:", [aKey], smalltalk.Association)} }), smalltalk.Association); smalltalk.addMethod( "_printString", smalltalk.method({ selector: "printString", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.String || String))._streamContents_((function(aStream){ return _st(self)._storeOn_(aStream); })); return $1; }, self, "printString", [], smalltalk.Association)} }), smalltalk.Association); smalltalk.addMethod( "_storeOn_", smalltalk.method({ selector: "storeOn:", fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx) { _st(self["@key"])._storeOn_(aStream); _st(aStream)._nextPutAll_("->"); _st(self["@value"])._storeOn_(aStream); return self}, self, "storeOn:", [aStream], smalltalk.Association)} }), smalltalk.Association); smalltalk.addMethod( "_value", smalltalk.method({ selector: "value", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self["@value"]; }, self, "value", [], smalltalk.Association)} }), smalltalk.Association); smalltalk.addMethod( "_value_", smalltalk.method({ selector: "value:", fn: function (aValue){ var self=this; return smalltalk.withContext(function($ctx) { self["@value"]=aValue; return self}, self, "value:", [aValue], smalltalk.Association)} }), smalltalk.Association); smalltalk.addMethod( "_key_value_", smalltalk.method({ selector: "key:value:", fn: function (aKey,aValue){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._key_(aKey); _st($2)._value_(aValue); $3=_st($2)._yourself(); $1=$3; return $1; }, self, "key:value:", [aKey,aValue], smalltalk.Association.klass)} }), smalltalk.Association.klass); smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections'); smalltalk.addMethod( "__comma", smalltalk.method({ selector: ",", fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; $2=_st(self)._copy(); _st($2)._addAll_(aCollection); $3=_st($2)._yourself(); $1=$3; return $1; }, self, ",", [aCollection], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_add_", smalltalk.method({ selector: "add:", fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._subclassResponsibility(); return self}, self, "add:", [anObject], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_addAll_", smalltalk.method({ selector: "addAll:", fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx) { _st(aCollection)._do_((function(each){ return _st(self)._add_(each); })); return aCollection; }, self, "addAll:", [aCollection], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_asArray", smalltalk.method({ selector: "asArray", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.Array || Array))._withAll_(self); return $1; }, self, "asArray", [], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_asJSON", smalltalk.method({ selector: "asJSON", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._asArray())._collect_((function(each){ return _st(each)._asJSON(); })); return $1; }, self, "asJSON", [], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_asOrderedCollection", smalltalk.method({ selector: "asOrderedCollection", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._asArray(); return $1; }, self, "asOrderedCollection", [], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_asSet", smalltalk.method({ selector: "asSet", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.Set || Set))._withAll_(self); return $1; }, self, "asSet", [], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_collect_", smalltalk.method({ selector: "collect:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { var $1; var stream; stream=_st(_st(_st(self)._class())._new())._writeStream(); _st(self)._do_((function(each){ return _st(stream)._nextPut_(_st(aBlock)._value_(each)); })); $1=_st(stream)._contents(); return $1; }, self, "collect:", [aBlock], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_copyWith_", smalltalk.method({ selector: "copyWith:", fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; $2=_st(self)._copy(); _st($2)._add_(anObject); $3=_st($2)._yourself(); $1=$3; return $1; }, self, "copyWith:", [anObject], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_copyWithAll_", smalltalk.method({ selector: "copyWithAll:", fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; $2=_st(self)._copy(); _st($2)._addAll_(aCollection); $3=_st($2)._yourself(); $1=$3; return $1; }, self, "copyWithAll:", [aCollection], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_copyWithoutAll_", smalltalk.method({ selector: "copyWithoutAll:", fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._reject_((function(each){ return _st(aCollection)._includes_(each); })); return $1; }, self, "copyWithoutAll:", [aCollection], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_detect_", smalltalk.method({ selector: "detect:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._detect_ifNone_(aBlock,(function(){ return _st(self)._errorNotFound(); })); return $1; }, self, "detect:", [aBlock], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_detect_ifNone_", smalltalk.method({ selector: "detect:ifNone:", fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx) { for(var i = 0; i < self.length; i++) if(aBlock(self[i])) return self[i]; return anotherBlock(); ; ; return self}, self, "detect:ifNone:", [aBlock,anotherBlock], smalltalk.Collection)} }), smalltalk.Collection); smalltalk.addMethod( "_do_", smalltalk.method({ selector: "do:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { for(var i=0;i", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { return String(self) > aString._asString(); ; return self}, self, ">", [aString], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "__gt_eq", smalltalk.method({ selector: ">=", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { return String(self) >= aString._asString(); ; return self}, self, ">=", [aString], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asJSON", smalltalk.method({ selector: "asJSON", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self; }, self, "asJSON", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asJavaScriptSelector", smalltalk.method({ selector: "asJavaScriptSelector", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(_st(self)._asSelector())._replace_with_("^_",""))._replace_with_("_.*",""); return $1; }, self, "asJavaScriptSelector", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asJavascript", smalltalk.method({ selector: "asJavascript", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1) return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\""; else return "\"" + self + "\""; ; ; return self}, self, "asJavascript", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asLowercase", smalltalk.method({ selector: "asLowercase", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self.toLowerCase(); ; return self}, self, "asLowercase", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asNumber", smalltalk.method({ selector: "asNumber", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return Number(self); ; return self}, self, "asNumber", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asSelector", smalltalk.method({ selector: "asSelector", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return smalltalk.selector(self); ; return self}, self, "asSelector", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asString", smalltalk.method({ selector: "asString", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self; }, self, "asString", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asSymbol", smalltalk.method({ selector: "asSymbol", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.Symbol || Symbol))._lookup_(self); return $1; }, self, "asSymbol", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asUppercase", smalltalk.method({ selector: "asUppercase", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self.toUpperCase(); ; return self}, self, "asUppercase", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_asciiValue", smalltalk.method({ selector: "asciiValue", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self.charCodeAt(0);; ; return self}, self, "asciiValue", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_at_ifAbsent_", smalltalk.method({ selector: "at:ifAbsent:", fn: function (anIndex,aBlock){ var self=this; return smalltalk.withContext(function($ctx) { return String(self).charAt(anIndex - 1) || aBlock(); ; return self}, self, "at:ifAbsent:", [anIndex,aBlock], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_copyFrom_to_", smalltalk.method({ selector: "copyFrom:to:", fn: function (anIndex,anotherIndex){ var self=this; return smalltalk.withContext(function($ctx) { return self.substring(anIndex - 1, anotherIndex); ; return self}, self, "copyFrom:to:", [anIndex,anotherIndex], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_deepCopy", smalltalk.method({ selector: "deepCopy", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._shallowCopy(); return $1; }, self, "deepCopy", [], smalltalk.String)} }), smalltalk.String); smalltalk.addMethod( "_do_", smalltalk.method({ selector: "do:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { for(var i=0;i", fn: function (aSymbol){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._asString()).__gt(_st(aSymbol)._asString()); return $1; }, self, ">", [aSymbol], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "__gt_eq", smalltalk.method({ selector: ">=", fn: function (aSymbol){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._asString()).__gt_eq(_st(aSymbol)._asString()); return $1; }, self, ">=", [aSymbol], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_asJSON", smalltalk.method({ selector: "asJSON", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._asString())._asJSON(); return $1; }, self, "asJSON", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_asJavascript", smalltalk.method({ selector: "asJavascript", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st("smalltalk.symbolFor(\x22").__comma(_st(self)._asString())).__comma("\x22)"); return $1; }, self, "asJavascript", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_asSelector", smalltalk.method({ selector: "asSelector", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._asString())._asSelector(); return $1; }, self, "asSelector", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_asString", smalltalk.method({ selector: "asString", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self.value; ; return self}, self, "asString", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_asSuperSelector", smalltalk.method({ selector: "asSuperSelector", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._asString())._asSuperSelector(); return $1; }, self, "asSuperSelector", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_asSymbol", smalltalk.method({ selector: "asSymbol", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self; }, self, "asSymbol", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_at_ifAbsent_", smalltalk.method({ selector: "at:ifAbsent:", fn: function (anIndex,aBlock){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._asString())._at_ifAbsent_(anIndex,aBlock); return $1; }, self, "at:ifAbsent:", [anIndex,aBlock], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_collect_", smalltalk.method({ selector: "collect:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(_st(self)._asString())._collect_(aBlock))._asSymbol(); return $1; }, self, "collect:", [aBlock], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_copyFrom_to_", smalltalk.method({ selector: "copyFrom:to:", fn: function (anIndex,anotherIndex){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._copyFrom_to_(anIndex,anotherIndex)); return $1; }, self, "copyFrom:to:", [anIndex,anotherIndex], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_deepCopy", smalltalk.method({ selector: "deepCopy", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self; }, self, "deepCopy", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_detect_", smalltalk.method({ selector: "detect:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._asString())._detect_(aBlock); return $1; }, self, "detect:", [aBlock], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_do_", smalltalk.method({ selector: "do:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(self)._asString())._do_(aBlock); return self}, self, "do:", [aBlock], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_isSymbol", smalltalk.method({ selector: "isSymbol", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return true; }, self, "isSymbol", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_printString", smalltalk.method({ selector: "printString", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st("#").__comma(_st(self)._asString()); return $1; }, self, "printString", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_select_", smalltalk.method({ selector: "select:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(_st(self)._asString())._select_(aBlock))._asSymbol(); return $1; }, self, "select:", [aBlock], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_shallowCopy", smalltalk.method({ selector: "shallowCopy", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self; }, self, "shallowCopy", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_size", smalltalk.method({ selector: "size", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._asString())._size(); return $1; }, self, "size", [], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_value_", smalltalk.method({ selector: "value:", fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(anObject)._perform_(self); return $1; }, self, "value:", [anObject], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_withIndexDo_", smalltalk.method({ selector: "withIndexDo:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(self)._asString())._withIndexDo_(aBlock); return self}, self, "withIndexDo:", [aBlock], smalltalk.Symbol)} }), smalltalk.Symbol); smalltalk.addMethod( "_basicNew", smalltalk.method({ selector: "basicNew", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._shouldNotImplement(); return self}, self, "basicNew", [], smalltalk.Symbol.klass)} }), smalltalk.Symbol.klass); smalltalk.addMethod( "_fromString_", smalltalk.method({ selector: "fromString:", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._lookup_(aString); return $1; }, self, "fromString:", [aString], smalltalk.Symbol.klass)} }), smalltalk.Symbol.klass); smalltalk.addMethod( "_lookup_", smalltalk.method({ selector: "lookup:", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { return smalltalk.symbolFor(aString);; ; return self}, self, "lookup:", [aString], smalltalk.Symbol.klass)} }), smalltalk.Symbol.klass); smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections'); smalltalk.addMethod( "__eq", smalltalk.method({ selector: "=", fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){ return _st(self["@elements"]).__eq(_st(aCollection)._asArray()); })); return $1; }, self, "=", [aCollection], smalltalk.Set)} }), smalltalk.Set); smalltalk.addMethod( "_add_", smalltalk.method({ selector: "add:", fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx) { var found; for(var i=0; i < self['@elements'].length; i++) { if(anObject == self['@elements'][i]) { found = true; break; } } if(!found) {self['@elements'].push(anObject)} ; ; return self}, self, "add:", [anObject], smalltalk.Set)} }), smalltalk.Set); smalltalk.addMethod( "_asArray", smalltalk.method({ selector: "asArray", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self["@elements"])._copy(); return $1; }, self, "asArray", [], smalltalk.Set)} }), smalltalk.Set); smalltalk.addMethod( "_detect_ifNone_", smalltalk.method({ selector: "detect:ifNone:", fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock); return $1; }, self, "detect:ifNone:", [aBlock,anotherBlock], smalltalk.Set)} }), smalltalk.Set); smalltalk.addMethod( "_do_", smalltalk.method({ selector: "do:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { _st(self["@elements"])._do_(aBlock); return self}, self, "do:", [aBlock], smalltalk.Set)} }), smalltalk.Set); smalltalk.addMethod( "_includes_", smalltalk.method({ selector: "includes:", fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self["@elements"])._includes_(anObject); return $1; }, self, "includes:", [anObject], smalltalk.Set)} }), smalltalk.Set); smalltalk.addMethod( "_initialize", smalltalk.method({ selector: "initialize", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []); self["@elements"]=[]; return self}, self, "initialize", [], smalltalk.Set)} }), smalltalk.Set); smalltalk.addMethod( "_remove_", smalltalk.method({ selector: "remove:", fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx) { _st(self["@elements"])._remove_(anObject); return self}, self, "remove:", [anObject], smalltalk.Set)} }), smalltalk.Set); smalltalk.addMethod( "_select_", smalltalk.method({ selector: "select:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { var $1; var collection; collection=_st(_st(self)._class())._new(); _st(self)._do_((function(each){ $1=_st(aBlock)._value_(each); if(smalltalk.assert($1)){ return _st(collection)._add_(each); }; })); return collection; }, self, "select:", [aBlock], smalltalk.Set)} }), smalltalk.Set); smalltalk.addMethod( "_size", smalltalk.method({ selector: "size", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self["@elements"])._size(); return $1; }, self, "size", [], smalltalk.Set)} }), smalltalk.Set); smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections'); smalltalk.addMethod( "_compile_", smalltalk.method({ selector: "compile:", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { return self.compile(aString); ; return self}, self, "compile:", [aString], smalltalk.RegularExpression)} }), smalltalk.RegularExpression); smalltalk.addMethod( "_exec_", smalltalk.method({ selector: "exec:", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { return self.exec(aString) || nil; ; return self}, self, "exec:", [aString], smalltalk.RegularExpression)} }), smalltalk.RegularExpression); smalltalk.addMethod( "_test_", smalltalk.method({ selector: "test:", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { return self.test(aString); ; return self}, self, "test:", [aString], smalltalk.RegularExpression)} }), smalltalk.RegularExpression); smalltalk.addMethod( "_fromString_", smalltalk.method({ selector: "fromString:", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._fromString_flag_(aString,""); return $1; }, self, "fromString:", [aString], smalltalk.RegularExpression.klass)} }), smalltalk.RegularExpression.klass); smalltalk.addMethod( "_fromString_flag_", smalltalk.method({ selector: "fromString:flag:", fn: function (aString,anotherString){ var self=this; return smalltalk.withContext(function($ctx) { return new RegExp(aString, anotherString); ; return self}, self, "fromString:flag:", [aString,anotherString], smalltalk.RegularExpression.klass)} }), smalltalk.RegularExpression.klass); smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections'); smalltalk.addMethod( "_atEnd", smalltalk.method({ selector: "atEnd", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._position()).__eq(_st(self)._size()); return $1; }, self, "atEnd", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_atStart", smalltalk.method({ selector: "atStart", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._position()).__eq((0)); return $1; }, self, "atStart", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_close", smalltalk.method({ selector: "close", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self}, self, "close", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_collection", smalltalk.method({ selector: "collection", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self["@collection"]; }, self, "collection", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_contents", smalltalk.method({ selector: "contents", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize()); return $1; }, self, "contents", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_do_", smalltalk.method({ selector: "do:", fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx) { _st((function(){ return _st(self)._atEnd(); }))._whileFalse_((function(){ return _st(aBlock)._value_(_st(self)._next()); })); return self}, self, "do:", [aBlock], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_flush", smalltalk.method({ selector: "flush", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self}, self, "flush", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_isEmpty", smalltalk.method({ selector: "isEmpty", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(self)._size()).__eq((0)); return $1; }, self, "isEmpty", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_next", smalltalk.method({ selector: "next", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$1; $2=_st(self)._atEnd(); if(smalltalk.assert($2)){ $1=nil; } else { _st(self)._position_(_st(_st(self)._position()).__plus((1))); $1=_st(self["@collection"])._at_(_st(self)._position()); }; return $1; }, self, "next", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_next_", smalltalk.method({ selector: "next:", fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx) { var $1; var tempCollection; tempCollection=_st(_st(_st(self)._collection())._class())._new(); _st(anInteger)._timesRepeat_((function(){ $1=_st(self)._atEnd(); if(! smalltalk.assert($1)){ return _st(tempCollection)._add_(_st(self)._next()); }; })); return tempCollection; }, self, "next:", [anInteger], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_nextPut_", smalltalk.method({ selector: "nextPut:", fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._position_(_st(_st(self)._position()).__plus((1))); _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject); _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position())); return self}, self, "nextPut:", [anObject], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_nextPutAll_", smalltalk.method({ selector: "nextPutAll:", fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx) { _st(aCollection)._do_((function(each){ return _st(self)._nextPut_(each); })); return self}, self, "nextPutAll:", [aCollection], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_peek", smalltalk.method({ selector: "peek", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$1; $2=_st(self)._atEnd(); if(! smalltalk.assert($2)){ $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1))); }; return $1; }, self, "peek", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_position", smalltalk.method({ selector: "position", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; if(($receiver = self["@position"]) == nil || $receiver == undefined){ self["@position"]=(0); $1=self["@position"]; } else { $1=self["@position"]; }; return $1; }, self, "position", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_position_", smalltalk.method({ selector: "position:", fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx) { self["@position"]=anInteger; return self}, self, "position:", [anInteger], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_reset", smalltalk.method({ selector: "reset", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._position_((0)); return self}, self, "reset", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_resetContents", smalltalk.method({ selector: "resetContents", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._reset(); _st(self)._setStreamSize_((0)); return self}, self, "resetContents", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_setCollection_", smalltalk.method({ selector: "setCollection:", fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx) { self["@collection"]=aCollection; return self}, self, "setCollection:", [aCollection], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_setStreamSize_", smalltalk.method({ selector: "setStreamSize:", fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx) { self["@streamSize"]=anInteger; return self}, self, "setStreamSize:", [anInteger], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_setToEnd", smalltalk.method({ selector: "setToEnd", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._position_(_st(self)._size()); return self}, self, "setToEnd", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_size", smalltalk.method({ selector: "size", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._streamSize(); return $1; }, self, "size", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_skip_", smalltalk.method({ selector: "skip:", fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0))); return self}, self, "skip:", [anInteger], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_streamSize", smalltalk.method({ selector: "streamSize", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self["@streamSize"]; }, self, "streamSize", [], smalltalk.Stream)} }), smalltalk.Stream); smalltalk.addMethod( "_on_", smalltalk.method({ selector: "on:", fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._setCollection_(aCollection); _st($2)._setStreamSize_(_st(aCollection)._size()); $3=_st($2)._yourself(); $1=$3; return $1; }, self, "on:", [aCollection], smalltalk.Stream.klass)} }), smalltalk.Stream.klass); smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections'); smalltalk.addMethod( "_cr", smalltalk.method({ selector: "cr", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._cr()); return $1; }, self, "cr", [], smalltalk.StringStream)} }), smalltalk.StringStream); smalltalk.addMethod( "_crlf", smalltalk.method({ selector: "crlf", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._crlf()); return $1; }, self, "crlf", [], smalltalk.StringStream)} }), smalltalk.StringStream); smalltalk.addMethod( "_lf", smalltalk.method({ selector: "lf", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._lf()); return $1; }, self, "lf", [], smalltalk.StringStream)} }), smalltalk.StringStream); smalltalk.addMethod( "_next_", smalltalk.method({ selector: "next:", fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx) { var $1; var tempCollection; tempCollection=_st(_st(_st(self)._collection())._class())._new(); _st(anInteger)._timesRepeat_((function(){ $1=_st(self)._atEnd(); if(! smalltalk.assert($1)){ tempCollection=_st(tempCollection).__comma(_st(self)._next()); return tempCollection; }; })); return tempCollection; }, self, "next:", [anInteger], smalltalk.StringStream)} }), smalltalk.StringStream); smalltalk.addMethod( "_nextPut_", smalltalk.method({ selector: "nextPut:", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._nextPutAll_(aString); return self}, self, "nextPut:", [aString], smalltalk.StringStream)} }), smalltalk.StringStream); smalltalk.addMethod( "_nextPutAll_", smalltalk.method({ selector: "nextPutAll:", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._setCollection_(_st(_st(_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._position())).__comma(aString)).__comma(_st(_st(self)._collection())._copyFrom_to_(_st(_st(_st(self)._position()).__plus((1))).__plus(_st(aString)._size()),_st(_st(self)._collection())._size()))); _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size())); _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position())); return self}, self, "nextPutAll:", [aString], smalltalk.StringStream)} }), smalltalk.StringStream); smalltalk.addMethod( "_space", smalltalk.method({ selector: "space", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._nextPut_(" "); return self}, self, "space", [], smalltalk.StringStream)} }), smalltalk.StringStream);