123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- smalltalk.addPackage('Trapped', {});
- smalltalk.addClass('EavModel', smalltalk.Object, ['getBlock', 'putBlock'], 'Trapped');
- smalltalk.EavModel.comment="External actor value model."
- smalltalk.addMethod(
- "_getBlock_",
- smalltalk.method({
- selector: "getBlock:",
- category: 'accessing',
- fn: function (aBlock){
- var self=this;
- self["@getBlock"]=aBlock;
- return self},
- args: ["aBlock"],
- source: "getBlock: aBlock\x0a\x0agetBlock := aBlock",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.EavModel);
- smalltalk.addMethod(
- "_initialize",
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- self["@getBlock"]=(function(){
- return smalltalk.send(self,"_error_",["No getter block."]);
- });
- self["@putBlock"]=(function(){
- return smalltalk.send(self,"_error_",["No putter block."]);
- });
- return self},
- args: [],
- source: "initialize\x0a\x0agetBlock := [ self error: 'No getter block.' ].\x0aputBlock := [ self error: 'No putter block.' ].",
- messageSends: ["error:"],
- referencedClasses: []
- }),
- smalltalk.EavModel);
- smalltalk.addMethod(
- "_on_",
- smalltalk.method({
- selector: "on:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- var $1;
- $1=smalltalk.send(self["@getBlock"],"_value_",[anObject]);
- return $1;
- },
- args: ["anObject"],
- source: "on: anObject\x0a\x22Returns value of model applied on object\x22\x0a\x0a^getBlock value: anObject",
- messageSends: ["value:"],
- referencedClasses: []
- }),
- smalltalk.EavModel);
- smalltalk.addMethod(
- "_on_put_",
- smalltalk.method({
- selector: "on:put:",
- category: 'accessing',
- fn: function (anObject,anObject2){
- var self=this;
- var $1;
- $1=smalltalk.send(self["@putBlock"],"_value_value_",[anObject,anObject2]);
- return $1;
- },
- args: ["anObject", "anObject2"],
- source: "on: anObject put: anObject2\x0a\x22Puts a value via model applied on object\x22\x0a\x0a^putBlock value: anObject value: anObject2",
- messageSends: ["value:value:"],
- referencedClasses: []
- }),
- smalltalk.EavModel);
- smalltalk.addMethod(
- "_putBlock_",
- smalltalk.method({
- selector: "putBlock:",
- category: 'accessing',
- fn: function (aBlock){
- var self=this;
- self["@putBlock"]=aBlock;
- return self},
- args: ["aBlock"],
- source: "putBlock: aBlock\x0a\x0aputBlock := aBlock",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.EavModel);
- smalltalk.addClass('Isolator', smalltalk.Object, ['root'], 'Trapped');
- smalltalk.addMethod(
- "_model_modify_",
- smalltalk.method({
- selector: "model:modify:",
- category: 'action',
- fn: function (anEavModel,aBlock){
- var self=this;
- var newValue;
- newValue=smalltalk.send(aBlock,"_value_",[smalltalk.send(anEavModel,"_on_",[self])]);
- smalltalk.send(anEavModel,"_on_put_",[self,smalltalk.send(newValue,"_deepCopy",[])]);
- return self},
- args: ["anEavModel", "aBlock"],
- source: "model: anEavModel modify: aBlock\x0a\x0a| newValue |\x0anewValue := aBlock value: (anEavModel on: self).\x0aanEavModel on: self put: newValue deepCopy\x0a",
- messageSends: ["value:", "on:", "on:put:", "deepCopy"],
- referencedClasses: []
- }),
- smalltalk.Isolator);
- smalltalk.addMethod(
- "_model_read_",
- smalltalk.method({
- selector: "model:read:",
- category: 'action',
- fn: function (anEavModel,aBlock){
- var self=this;
- smalltalk.send(aBlock,"_value_",[smalltalk.send(smalltalk.send(anEavModel,"_on_",[self]),"_deepCopy",[])]);
- return self},
- args: ["anEavModel", "aBlock"],
- source: "model: anEavModel read: aBlock\x0a\x0aaBlock value: (anEavModel on: self) deepCopy",
- messageSends: ["value:", "deepCopy", "on:"],
- referencedClasses: []
- }),
- smalltalk.Isolator);
- smalltalk.addMethod(
- "_root",
- smalltalk.method({
- selector: "root",
- category: 'accessing',
- fn: function (){
- var self=this;
- return self["@root"];
- },
- args: [],
- source: "root\x0a\x0a^root\x0a",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Isolator);
- smalltalk.addMethod(
- "_root_",
- smalltalk.method({
- selector: "root:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@root"]=anObject;
- return self},
- args: ["anObject"],
- source: "root: anObject\x0a\x0aroot := anObject",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Isolator);
- smalltalk.addMethod(
- "_on_",
- smalltalk.method({
- selector: "on:",
- category: 'initialization',
- fn: function (anObject){
- var self=this;
- var $1;
- $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_root_",[anObject]);
- return $1;
- },
- args: ["anObject"],
- source: "on: anObject\x0a^self new root: anObject",
- messageSends: ["root:", "new"],
- referencedClasses: []
- }),
- smalltalk.Isolator.klass);
- smalltalk.addClass('Trapped', smalltalk.Object, [], 'Trapped');
|