From dd3fc9547ade9f65841dc9a784ed9f77f3ea7e5d Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 21 Jul 2025 23:13:49 +0200 Subject: [PATCH] Mon 21 Jul 22:43:21 CEST 2025 --- js/test/agent4.js | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 js/test/agent4.js diff --git a/js/test/agent4.js b/js/test/agent4.js new file mode 100644 index 0000000..e33caf3 --- /dev/null +++ b/js/test/agent4.js @@ -0,0 +1,75 @@ +global.TOP='/home/sbosse/proj/jam/js'; +require(TOP+'/top/module')([process.cwd(),TOP]); +var Io = Require('com/io'); +var Aios = Require('jam/aios'); +Aios.lock(); + +var ac = function (param1,param2) { + //var self=this; + // Data State + this.param1=param1; + this.param2=param2; + this.x=0; + this.list=[]; + // Activities + this.init = function () { + var res; + this.x=this.param1; + //log('init'); + }; + this.end = function () { + //log('finalize'); + kill(); + }; + this.act1 = function () { + this.x++; + }; + this.act2 = function () { + }; + this.act3 = function () { + }; + this.on = { + error : function (e) { + log('Caught exception '+e); + }, + exit : function () { + log('Terminating.'); + } + }; + // Transition network + this.trans = { + init: function () { + return 'act1'; + }, + act1: function () { + if (this.x