123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588 |
- smalltalk.addPackage('Kernel-Announcements');
- smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
- smalltalk.AnnouncementSubscription.comment="The subscription is a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "announcementClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@announcementClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"announcementClass",{},smalltalk.AnnouncementSubscription)})},
- args: [],
- source: "announcementClass\x0a\x09^announcementClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "announcementClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@announcementClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},smalltalk.AnnouncementSubscription)})},
- args: ["aClass"],
- source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "block",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@block"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"block",{},smalltalk.AnnouncementSubscription)})},
- args: [],
- source: "block\x0a\x09^block",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "block:",
- category: 'accessing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@block"]=aBlock;
- return self}, function($ctx1) {$ctx1.fill(self,"block:",{aBlock:aBlock},smalltalk.AnnouncementSubscription)})},
- args: ["aBlock"],
- source: "block: aBlock\x0a\x09block := aBlock",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deliver:",
- category: 'announcing',
- fn: function (anAnnouncement){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._handlesAnnouncement_(anAnnouncement);
- if(smalltalk.assert($1)){
- _st(_st(self)._block())._value_(anAnnouncement);
- };
- return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
- args: ["anAnnouncement"],
- source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self block value: anAnnouncement]",
- messageSends: ["ifTrue:", "value:", "block", "handlesAnnouncement:"],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "handlesAnnouncement:",
- category: 'announcing',
- fn: function (anAnnouncement){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(anAnnouncement)._isKindOf_(_st(self)._announcementClass());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
- args: ["anAnnouncement"],
- source: "handlesAnnouncement: anAnnouncement\x0a\x09^anAnnouncement isKindOf: self announcementClass",
- messageSends: ["isKindOf:", "announcementClass"],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
- smalltalk.Announcer.comment="The code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0aThe Announcer holds annoncement subscriptions (`AnnouncementSubscription`) in a private registry.\x0a\x0aUse `#on:do:` to register subscriptions."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "announce:",
- category: 'announcing',
- fn: function (anAnnouncement){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@subscriptions"])._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._deliver_(anAnnouncement);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.Announcer)})},
- args: ["anAnnouncement"],
- source: "announce: anAnnouncement\x0a\x09subscriptions do: [:each |\x0a\x09\x09each deliver: anAnnouncement]",
- messageSends: ["do:", "deliver:"],
- referencedClasses: []
- }),
- smalltalk.Announcer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- self["@subscriptions"]=_st($Array())._new();
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Announcer)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := Array new",
- messageSends: ["initialize", "new"],
- referencedClasses: ["Array"]
- }),
- smalltalk.Announcer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:do:",
- category: 'subscribing',
- fn: function (aClass,aBlock){
- var self=this;
- function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st($AnnouncementSubscription())._new();
- _st($1)._block_(aBlock);
- _st($1)._announcementClass_(aClass);
- $2=_st($1)._yourself();
- _st(self["@subscriptions"])._add_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},smalltalk.Announcer)})},
- args: ["aClass", "aBlock"],
- source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09block: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
- messageSends: ["add:", "block:", "new", "announcementClass:", "yourself"],
- referencedClasses: ["AnnouncementSubscription"]
- }),
- smalltalk.Announcer);
- smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
- smalltalk.SystemAnnouncer.comment="My unique instance #current is the global announcer handling all Amber system-related announces"
- smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "current",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@current"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@current"]=smalltalk.Announcer.klass.fn.prototype._new.apply(_st(self), []);
- $1=self["@current"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SystemAnnouncer.klass)})},
- args: [],
- source: "current\x0a\x09^ current ifNil: [ current := super new ]",
- messageSends: ["ifNil:", "new"],
- referencedClasses: []
- }),
- smalltalk.SystemAnnouncer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "new",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._shouldNotImplement();
- return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.SystemAnnouncer.klass)})},
- args: [],
- source: "new\x0a\x09self shouldNotImplement",
- messageSends: ["shouldNotImplement"],
- referencedClasses: []
- }),
- smalltalk.SystemAnnouncer.klass);
- smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
- smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@theClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SystemAnnouncement)})},
- args: [],
- source: "theClass\x0a\x09^ theClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SystemAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@theClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SystemAnnouncement)})},
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SystemAnnouncement);
- smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@theClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassAnnouncement)})},
- args: [],
- source: "theClass\x0a\x09^ theClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@theClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassAnnouncement)})},
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassAnnouncement);
- smalltalk.addClass('ClassAdded', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods"
- smalltalk.addClass('ClassCommentChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)"
- smalltalk.addClass('ClassDefinitionChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassDefinitionChanged.comment="I am emitted when the defintion of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:"
- smalltalk.addClass('ClassMoved', smalltalk.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldPackage",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@oldPackage"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"oldPackage",{},smalltalk.ClassMoved)})},
- args: [],
- source: "oldPackage\x0a\x09^ oldPackage",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassMoved);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldPackage:",
- category: 'accessing',
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@oldPackage"]=aPackage;
- return self}, function($ctx1) {$ctx1.fill(self,"oldPackage:",{aPackage:aPackage},smalltalk.ClassMoved)})},
- args: ["aPackage"],
- source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassMoved);
- smalltalk.addClass('ClassRemoved', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:"
- smalltalk.addClass('ClassRenamed', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:"
- smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "method",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@method"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodAnnouncement)})},
- args: [],
- source: "method\x0a\x09^ method",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "method:",
- category: 'accessing',
- fn: function (aCompiledMethod){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@method"]=aCompiledMethod;
- return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.MethodAnnouncement)})},
- args: ["aCompiledMethod"],
- source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodAnnouncement);
- smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldMethod",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@oldMethod"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"oldMethod",{},smalltalk.MethodModified)})},
- args: [],
- source: "oldMethod\x0a\x09^ oldMethod",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodModified);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldMethod:",
- category: 'accessing',
- fn: function (aMethod){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@oldMethod"]=aMethod;
- return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod},smalltalk.MethodModified)})},
- args: ["aMethod"],
- source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodModified);
- smalltalk.addClass('MethodMoved', smalltalk.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldProtocol",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@oldProtocol"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"oldProtocol",{},smalltalk.MethodMoved)})},
- args: [],
- source: "oldProtocol\x0a\x09^ oldProtocol",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodMoved);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldProtocol:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@oldProtocol"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"oldProtocol:",{aString:aString},smalltalk.MethodMoved)})},
- args: ["aString"],
- source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodMoved);
- smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('PackageAnnouncement', smalltalk.SystemAnnouncement, ['package'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "package",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@package"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageAnnouncement)})},
- args: [],
- source: "package\x0a\x09^ package",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.PackageAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "package:",
- category: 'accessing',
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@package"]=aPackage;
- return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageAnnouncement)})},
- args: ["aPackage"],
- source: "package: aPackage\x0a\x09package := aPackage",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.PackageAnnouncement);
- smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "protocol",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@protocol"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.ProtocolAnnouncement)})},
- args: [],
- source: "protocol\x0a\x09^ protocol",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ProtocolAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "protocol:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@protocol"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.ProtocolAnnouncement)})},
- args: ["aString"],
- source: "protocol: aString\x0a\x09protocol := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ProtocolAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@theClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ProtocolAnnouncement)})},
- args: [],
- source: "theClass\x0a\x09^ theClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ProtocolAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@theClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ProtocolAnnouncement)})},
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ProtocolAnnouncement);
- smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
|