switched to Gulp

This commit is contained in:
Kevin Jahns
2014-08-12 19:13:42 +02:00
parent b340bbe806
commit 28b48de454
505 changed files with 97711 additions and 18525 deletions

View File

@@ -0,0 +1,112 @@
#
# @param {Function} callback The callback is called when the connector is initialized.
#
createIwcConnector = (callback)->
iwcHandler = {}
duiClient = new DUIClient()
#@duiClient = new iwc.Client()
duiClient.connect (intent)->
#console.log "intent received iwc: #{JSON.stringify(intent)}"
#console.log "#{JSON.stringify(@iwcHandler)}"
iwcHandler[intent.action]?.map (f)->
setTimeout ()->
f intent
, 0
duiClient.initOK()
received_HB = null
#
# The Iwc Connector adds support for the Inter-Widget-Communication protocol that is used in the Role-SDK.
# @see http://dbis.rwth-aachen.de/cms/projects/the-xmpp-experience#interwidget-communication
# @see http://dbis.rwth-aachen.de/cms/projects/ROLE
#
class IwcConnector
#
# @param {Engine} engine The transformation engine
# @param {HistoryBuffer} HB
# @param {Array<Function>} execution_listener You must ensure that whenever an operation is executed, every function in this Array is called.
# @param {Yatta} yatta The Yatta framework.
#
constructor: (@engine, @HB, @execution_listener, @yatta)->
@duiClient = duiClient
@iwcHandler = iwcHandler
send_ = (o)=>
@send o
@execution_listener.push send_
receive_ = (intent)=>
o = intent.extras
@receive o
@iwcHandler["Yatta_new_operation"] = [receive_]
if received_HB?
@engine.applyOpsCheckDouble received_HB
sendHistoryBuffer = ()=>
json =
HB : @yatta.getHistoryBuffer()._encode()
@sendIwcIntent "Yatta_push_HB_element", json
@iwcHandler["Yatta_get_HB_element"] = [sendHistoryBuffer]
#
# This function is called whenever an operation was executed.
# @param {Operation} o The operation that was executed.
#
send: (o)->
if o.uid.creator is @HB.getUserId() and (typeof o.uid.op_number isnt "string")
@sendIwcIntent "Yatta_new_operation", o
#
# This function is called whenever an operation was received from another peer.
# @param {Operation} o The operation that was received.
#
receive: (o)->
if o.uid.creator isnt @HB.getUserId()
@engine.applyOp o
#
# Helper for sending iwc intents.
# @param {String} action_name The name of the action that is going to be send.
# @param {String} content The content that is atteched to the intent.
#
sendIwcIntent: (action_name, content)->
intent =
action: action_name
component: ""
data: ""
dataType: ""
extras: content
@duiClient.sendIntent(intent)
get_HB_intent =
action: "Yatta_get_HB_element"
component: ""
data: ""
dataType: ""
extras: {}
init = ()->
duiClient.sendIntent(get_HB_intent)
is_initialized = false
receiveHB = (json)->
proposed_user_id = duiClient.getIwcClient()._componentName
received_HB = json?.extras.HB
if not is_initialized
is_initialized = true
callback IwcConnector, proposed_user_id
iwcHandler["Yatta_push_HB_element"] = [receiveHB]
setTimeout receiveHB, 0
setTimeout init, (Math.random()*0)
undefined
module.exports = createIwcConnector
window?.createConnector = createIwcConnector

View File

@@ -0,0 +1 @@
{"version":3,"file":"Connectors/IwcConnector.coffee","names":[],"mappings":"","sources":["Connectors/IwcConnector.coffee"],"sourcesContent":["\n#\n# @param {Function} callback The callback is called when the connector is initialized.\n#\ncreateIwcConnector = (callback)->\n iwcHandler = {}\n duiClient = new DUIClient()\n #@duiClient = new iwc.Client()\n duiClient.connect (intent)->\n #console.log \"intent received iwc: #{JSON.stringify(intent)}\"\n #console.log \"#{JSON.stringify(@iwcHandler)}\"\n iwcHandler[intent.action]?.map (f)->\n setTimeout ()->\n f intent\n , 0\n\n duiClient.initOK()\n\n received_HB = null\n\n #\n # The Iwc Connector adds support for the Inter-Widget-Communication protocol that is used in the Role-SDK.\n # @see http://dbis.rwth-aachen.de/cms/projects/the-xmpp-experience#interwidget-communication\n # @see http://dbis.rwth-aachen.de/cms/projects/ROLE\n #\n class IwcConnector\n\n #\n # @param {Engine} engine The transformation engine\n # @param {HistoryBuffer} HB\n # @param {Array<Function>} execution_listener You must ensure that whenever an operation is executed, every function in this Array is called.\n # @param {Yatta} yatta The Yatta framework.\n #\n constructor: (@engine, @HB, @execution_listener, @yatta)->\n @duiClient = duiClient\n @iwcHandler = iwcHandler\n\n send_ = (o)=>\n @send o\n @execution_listener.push send_\n\n receive_ = (intent)=>\n o = intent.extras\n @receive o\n @iwcHandler[\"Yatta_new_operation\"] = [receive_]\n\n if received_HB?\n @engine.applyOpsCheckDouble received_HB\n\n sendHistoryBuffer = ()=>\n json =\n HB : @yatta.getHistoryBuffer()._encode()\n @sendIwcIntent \"Yatta_push_HB_element\", json\n @iwcHandler[\"Yatta_get_HB_element\"] = [sendHistoryBuffer]\n\n #\n # This function is called whenever an operation was executed.\n # @param {Operation} o The operation that was executed.\n #\n send: (o)->\n if o.uid.creator is @HB.getUserId() and (typeof o.uid.op_number isnt \"string\")\n @sendIwcIntent \"Yatta_new_operation\", o\n\n #\n # This function is called whenever an operation was received from another peer.\n # @param {Operation} o The operation that was received.\n #\n receive: (o)->\n if o.uid.creator isnt @HB.getUserId()\n @engine.applyOp o\n\n #\n # Helper for sending iwc intents.\n # @param {String} action_name The name of the action that is going to be send.\n # @param {String} content The content that is atteched to the intent.\n #\n sendIwcIntent: (action_name, content)->\n intent =\n action: action_name\n component: \"\"\n data: \"\"\n dataType: \"\"\n extras: content\n\n @duiClient.sendIntent(intent)\n\n get_HB_intent =\n action: \"Yatta_get_HB_element\"\n component: \"\"\n data: \"\"\n dataType: \"\"\n extras: {}\n\n init = ()->\n duiClient.sendIntent(get_HB_intent)\n\n is_initialized = false\n receiveHB = (json)->\n proposed_user_id = duiClient.getIwcClient()._componentName\n received_HB = json?.extras.HB\n if not is_initialized\n is_initialized = true\n callback IwcConnector, proposed_user_id\n iwcHandler[\"Yatta_push_HB_element\"] = [receiveHB]\n setTimeout receiveHB, 0\n\n setTimeout init, (Math.random()*0)\n\n undefined\nmodule.exports = createIwcConnector\nwindow?.createConnector = createIwcConnector\n\n"],"sourceRoot":"/source/"}

View File

@@ -0,0 +1,2 @@
(function(){var t;t=function(t){var n,e,i,r,o,u;return o={},e=new DUIClient,e.connect(function(t){var n;return null!=(n=o[t.action])?n.map(function(n){return setTimeout(function(){return n(t)},0)}):void 0}),e.initOK(),u=null,n=function(){function t(t,n,i,r){var a,c,s;this.engine=t,this.HB=n,this.execution_listener=i,this.yatta=r,this.duiClient=e,this.iwcHandler=o,s=function(t){return function(n){return t.send(n)}}(this),this.execution_listener.push(s),a=function(t){return function(n){var e;return e=n.extras,t.receive(e)}}(this),this.iwcHandler.Yatta_new_operation=[a],null!=u&&this.engine.applyOpsCheckDouble(u),c=function(t){return function(){var n;return n={HB:t.yatta.getHistoryBuffer()._encode()},t.sendIwcIntent("Yatta_push_HB_element",n)}}(this),this.iwcHandler.Yatta_get_HB_element=[c]}return t.prototype.send=function(t){return t.uid.creator===this.HB.getUserId()&&"string"!=typeof t.uid.op_number?this.sendIwcIntent("Yatta_new_operation",t):void 0},t.prototype.receive=function(t){return t.uid.creator!==this.HB.getUserId()?this.engine.applyOp(t):void 0},t.prototype.sendIwcIntent=function(t,n){var e;return e={action:t,component:"",data:"",dataType:"",extras:n},this.duiClient.sendIntent(e)},t}(),i={action:"Yatta_get_HB_element",component:"",data:"",dataType:"",extras:{}},r=function(){var r,a;return e.sendIntent(i),r=!1,a=function(i){var o;return o=e.getIwcClient()._componentName,u=null!=i?i.extras.HB:void 0,r?void 0:(r=!0,t(n,o))},o.Yatta_push_HB_element=[a],setTimeout(a,0)},void setTimeout(r,0*Math.random())},module.exports=t,"undefined"!=typeof window&&null!==window&&(window.createConnector=t)}).call(this);
//# sourceMappingURL=../Connectors/IwcConnector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Connectors/IwcConnector.js","sources":["Connectors/IwcConnector.coffee"],"names":[],"mappings":"CAIA,WAAA,GAAA,EAAA,GAAqB,SAAC,GACpB,GAAA,GAAA,EAAA,EAAA,EAAA,EAAA,QAAA,MACA,EAAgB,GAAA,WAEhB,EAAU,QAAQ,SAAC,GAGjB,GAAA,kCAA2B,IAAI,SAAC,SAC9B,YAAW,iBACT,GAAE,IACF,KAHJ,SAKF,EAAU,SAEV,EAAc,KAOR,EAAA,WAQS,QAAA,GAAE,EAAS,EAAK,EAAqB,GAChD,GAAA,GAAA,EAAA,CADY,MAAC,OAAA,EAAQ,KAAC,GAAA,EAAI,KAAC,mBAAA,EAAoB,KAAC,MAAA,EAChD,KAAC,UAAY,EACb,KAAC,WAAa,EAEd,EAAQ,SAAA,SAAA,UAAC,SACP,GAAC,KAAK,KADA,MAER,KAAC,mBAAmB,KAAK,GAEzB,EAAW,SAAA,SAAA,UAAC,GACV,GAAA,SAAA,GAAI,EAAO,OACX,EAAC,QAAQ,KAFA,MAGX,KAAC,WAAW,qBAA0B,GAEnC,MAAA,GACD,KAAC,OAAO,oBAAoB,GAE9B,EAAoB,SAAA,SAAA,YAClB,GAAA,SAAA,IACE,GAAK,EAAC,MAAM,mBAAmB,WACjC,EAAC,cAAc,wBAAyB,KAHtB,MAIpB,KAAC,WAAW,sBAA2B,SApBzC,GAAA,UA0BA,KAAM,SAAC,GACL,MAAG,GAAE,IAAI,UAAW,KAAC,GAAG,aAA6C,gBAA5B,GAAS,IAAI,UACpD,KAAC,cAAc,sBAAuB,GADxC,QA3BF,EAAA,UAkCA,QAAS,SAAC,GACR,MAAG,GAAE,IAAI,UAAa,KAAC,GAAG,YACxB,KAAC,OAAO,QAAQ,GADlB,QAnCF,EAAA,UA2CA,cAAe,SAAC,EAAa,GAC3B,GAAA,SAAA,IACE,OAAQ,EACR,UAAW,GACX,KAAM,GACN,SAAU,GACV,OAAQ,GAEV,KAAC,UAAU,WAAW,SAE1B,GACE,OAAQ,uBACR,UAAW,GACX,KAAM,GACN,SAAU,GACV,WAEF,EAAO,WACL,GAAA,GAAA,QAAA,GAAU,WAAW,GAErB,GAAiB,EACjB,EAAY,SAAC,GACX,GAAA,EAEA,OAFA,GAAmB,EAAU,eAAe,eAC5C,EAAA,MAAA,EAAc,EAAM,OAAO,GAAA,OACxB,EAAH,QACE,GAAiB,EACjB,EAAS,EAAc,KAC3B,EAAW,uBAA4B,GACvC,WAAW,EAAW,QAExB,YAAW,EAAqB,EAAd,KAAK,WAGzB,OAAO,QAAU,8CACjB,OAAQ,gBAAkB","sourcesContent":["\n#\n# @param {Function} callback The callback is called when the connector is initialized.\n#\ncreateIwcConnector = (callback)->\n iwcHandler = {}\n duiClient = new DUIClient()\n #@duiClient = new iwc.Client()\n duiClient.connect (intent)->\n #console.log \"intent received iwc: #{JSON.stringify(intent)}\"\n #console.log \"#{JSON.stringify(@iwcHandler)}\"\n iwcHandler[intent.action]?.map (f)->\n setTimeout ()->\n f intent\n , 0\n\n duiClient.initOK()\n\n received_HB = null\n\n #\n # The Iwc Connector adds support for the Inter-Widget-Communication protocol that is used in the Role-SDK.\n # @see http://dbis.rwth-aachen.de/cms/projects/the-xmpp-experience#interwidget-communication\n # @see http://dbis.rwth-aachen.de/cms/projects/ROLE\n #\n class IwcConnector\n\n #\n # @param {Engine} engine The transformation engine\n # @param {HistoryBuffer} HB\n # @param {Array<Function>} execution_listener You must ensure that whenever an operation is executed, every function in this Array is called.\n # @param {Yatta} yatta The Yatta framework.\n #\n constructor: (@engine, @HB, @execution_listener, @yatta)->\n @duiClient = duiClient\n @iwcHandler = iwcHandler\n\n send_ = (o)=>\n @send o\n @execution_listener.push send_\n\n receive_ = (intent)=>\n o = intent.extras\n @receive o\n @iwcHandler[\"Yatta_new_operation\"] = [receive_]\n\n if received_HB?\n @engine.applyOpsCheckDouble received_HB\n\n sendHistoryBuffer = ()=>\n json =\n HB : @yatta.getHistoryBuffer()._encode()\n @sendIwcIntent \"Yatta_push_HB_element\", json\n @iwcHandler[\"Yatta_get_HB_element\"] = [sendHistoryBuffer]\n\n #\n # This function is called whenever an operation was executed.\n # @param {Operation} o The operation that was executed.\n #\n send: (o)->\n if o.uid.creator is @HB.getUserId() and (typeof o.uid.op_number isnt \"string\")\n @sendIwcIntent \"Yatta_new_operation\", o\n\n #\n # This function is called whenever an operation was received from another peer.\n # @param {Operation} o The operation that was received.\n #\n receive: (o)->\n if o.uid.creator isnt @HB.getUserId()\n @engine.applyOp o\n\n #\n # Helper for sending iwc intents.\n # @param {String} action_name The name of the action that is going to be send.\n # @param {String} content The content that is atteched to the intent.\n #\n sendIwcIntent: (action_name, content)->\n intent =\n action: action_name\n component: \"\"\n data: \"\"\n dataType: \"\"\n extras: content\n\n @duiClient.sendIntent(intent)\n\n get_HB_intent =\n action: \"Yatta_get_HB_element\"\n component: \"\"\n data: \"\"\n dataType: \"\"\n extras: {}\n\n init = ()->\n duiClient.sendIntent(get_HB_intent)\n\n is_initialized = false\n receiveHB = (json)->\n proposed_user_id = duiClient.getIwcClient()._componentName\n received_HB = json?.extras.HB\n if not is_initialized\n is_initialized = true\n callback IwcConnector, proposed_user_id\n iwcHandler[\"Yatta_push_HB_element\"] = [receiveHB]\n setTimeout receiveHB, 0\n\n setTimeout init, (Math.random()*0)\n\n undefined\nmodule.exports = createIwcConnector\nwindow?.createConnector = createIwcConnector\n\n"],"sourceRoot":"/source/"}

View File

@@ -0,0 +1,76 @@
_ = require "underscore"
module.exports = (user_list)->
#
# A trivial Connector that simulates network delay.
#
class TestConnector
#
# @param {Engine} engine The transformation engine
# @param {HistoryBuffer} HB
# @param {Array<Function>} execution_listener You must ensure that whenever an operation is executed, every function in this Array is called.
# @param {Yatta} yatta The Yatta framework.
#
constructor: (@engine, @HB, @execution_listener)->
send_ = (o)=>
@send o
@execution_listener.push send_
@applied_operations = []
appliedOperationsListener = (o)=>
@applied_operations.push o
@execution_listener.push appliedOperationsListener
if not (user_list?.length is 0)
@engine.applyOps user_list[0].getHistoryBuffer()._encode()
@unexecuted = {}
#
# This engine applied operations in a specific order.
# Get the ops in the right order.
#
getOpsInExecutionOrder: ()->
@applied_operations
#
# This function is called whenever an operation was executed.
# @param {Operation} o The operation that was executed.
#
send: (o)->
if (o.uid.creator is @HB.getUserId()) and (typeof o.uid.op_number isnt "string")
for user in user_list
if user.getUserId() isnt @HB.getUserId()
user.getConnector().receive(o)
#
# This function is called whenever an operation was received from another peer.
# @param {Operation} o The operation that was received.
#
receive: (o)->
@unexecuted[o.uid.creator] ?= []
@unexecuted[o.uid.creator].push o
#
# Flush one operation from the line of a specific user.
#
flushOne: (user)->
if @unexecuted[user]?.length > 0
@engine.applyOp @unexecuted[user].shift()
#
# Flush one operation on a random line.
#
flushOneRandom: ()->
@flushOne (_.random 0, (user_list.length-1))
#
# Flush all operations on every line.
#
flushAll: ()->
for n,ops of @unexecuted
@engine.applyOps ops
@unexecuted = {}

View File

@@ -0,0 +1 @@
{"version":3,"file":"Connectors/TestConnector.coffee","names":[],"mappings":"","sources":["Connectors/TestConnector.coffee"],"sourcesContent":["\n_ = require \"underscore\"\n\nmodule.exports = (user_list)->\n\n #\n # A trivial Connector that simulates network delay.\n #\n class TestConnector\n\n #\n # @param {Engine} engine The transformation engine\n # @param {HistoryBuffer} HB\n # @param {Array<Function>} execution_listener You must ensure that whenever an operation is executed, every function in this Array is called.\n # @param {Yatta} yatta The Yatta framework.\n #\n constructor: (@engine, @HB, @execution_listener)->\n send_ = (o)=>\n @send o\n @execution_listener.push send_\n\n @applied_operations = []\n appliedOperationsListener = (o)=>\n @applied_operations.push o\n @execution_listener.push appliedOperationsListener\n if not (user_list?.length is 0)\n @engine.applyOps user_list[0].getHistoryBuffer()._encode()\n\n @unexecuted = {}\n\n #\n # This engine applied operations in a specific order.\n # Get the ops in the right order.\n #\n getOpsInExecutionOrder: ()->\n @applied_operations\n\n #\n # This function is called whenever an operation was executed.\n # @param {Operation} o The operation that was executed.\n #\n send: (o)->\n if (o.uid.creator is @HB.getUserId()) and (typeof o.uid.op_number isnt \"string\")\n for user in user_list\n if user.getUserId() isnt @HB.getUserId()\n user.getConnector().receive(o)\n\n #\n # This function is called whenever an operation was received from another peer.\n # @param {Operation} o The operation that was received.\n #\n receive: (o)->\n @unexecuted[o.uid.creator] ?= []\n @unexecuted[o.uid.creator].push o\n\n #\n # Flush one operation from the line of a specific user.\n #\n flushOne: (user)->\n if @unexecuted[user]?.length > 0\n @engine.applyOp @unexecuted[user].shift()\n\n #\n # Flush one operation on a random line.\n #\n flushOneRandom: ()->\n @flushOne (_.random 0, (user_list.length-1))\n\n #\n # Flush all operations on every line.\n #\n flushAll: ()->\n for n,ops of @unexecuted\n @engine.applyOps ops\n @unexecuted = {}\n\n"],"sourceRoot":"/source/"}

View File

@@ -0,0 +1,2 @@
(function(){var e;e=require("underscore"),module.exports=function(t){var n;return n=function(){function n(e,n,i){var r,u;this.engine=e,this.HB=n,this.execution_listener=i,u=function(e){return function(t){return e.send(t)}}(this),this.execution_listener.push(u),this.applied_operations=[],r=function(e){return function(t){return e.applied_operations.push(t)}}(this),this.execution_listener.push(r),0!==(null!=t?t.length:void 0)&&this.engine.applyOps(t[0].getHistoryBuffer()._encode()),this.unexecuted={}}return n.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},n.prototype.send=function(e){var n,i,r,u;if(e.uid.creator===this.HB.getUserId()&&"string"!=typeof e.uid.op_number){for(u=[],i=0,r=t.length;r>i;i++)n=t[i],u.push(n.getUserId()!==this.HB.getUserId()?n.getConnector().receive(e):void 0);return u}},n.prototype.receive=function(e){var t,n;return null==(t=this.unexecuted)[n=e.uid.creator]&&(t[n]=[]),this.unexecuted[e.uid.creator].push(e)},n.prototype.flushOne=function(e){var t;return(null!=(t=this.unexecuted[e])?t.length:void 0)>0?this.engine.applyOp(this.unexecuted[e].shift()):void 0},n.prototype.flushOneRandom=function(){return this.flushOne(e.random(0,t.length-1))},n.prototype.flushAll=function(){var e,t,n;n=this.unexecuted;for(e in n)t=n[e],this.engine.applyOps(t);return this.unexecuted={}},n}()}}).call(this);
//# sourceMappingURL=../Connectors/TestConnector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Connectors/TestConnector.js","sources":["Connectors/TestConnector.coffee"],"names":[],"mappings":"CACA,WAAA,GAAA,EAAA,GAAI,QAAQ,cAEZ,OAAO,QAAU,SAAC,GAKhB,GAAA,SAAM,GAAA,WAQS,QAAA,GAAE,EAAS,EAAK,GAC3B,GAAA,GAAA,CADY,MAAC,OAAA,EAAQ,KAAC,GAAA,EAAI,KAAC,mBAAA,EAC3B,EAAQ,SAAA,SAAA,UAAC,SACP,GAAC,KAAK,KADA,MAER,KAAC,mBAAmB,KAAK,GAEzB,KAAC,sBACD,EAA4B,SAAA,SAAA,UAAC,SAC3B,GAAC,mBAAmB,KAAK,KADC,MAE5B,KAAC,mBAAmB,KAAK,GACI,KAA1B,MAAA,EAAK,EAAW,OAAA,SACjB,KAAC,OAAO,SAAS,EAAU,GAAG,mBAAmB,WAEnD,KAAC,oBAZH,GAAA,UAkBA,uBAAwB,iBACtB,MAAC,oBAnBH,EAAA,UAyBA,KAAM,SAAC,GACL,GAAA,GAAA,EAAA,EAAA,CAAA,IAAI,EAAE,IAAI,UAAW,KAAC,GAAG,aAA8C,gBAA5B,GAAS,IAAI,UAAxD,KACE,KAAA,EAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,kBACK,EAAK,cAAiB,KAAC,GAAG,YAC3B,EAAK,eAAe,QAAQ,sBA7BpC,EAAA,UAmCA,QAAS,SAAC,GACR,GAAA,GAAA,+DACA,KAAC,WAAW,EAAE,IAAI,SAAS,KAAK,IArClC,EAAA,UA0CA,SAAU,SAAC,GACT,GAAA,EAAA,QAAA,OAAA,EAAA,KAAA,WAAA,IAAA,EAAsB,OAAA,QAAS,EAC7B,KAAC,OAAO,QAAQ,KAAC,WAAW,GAAM,SADpC,QA3CF,EAAA,UAiDA,eAAgB,iBACd,MAAC,SAAU,EAAE,OAAO,EAAI,EAAU,OAAO,KAlD3C,EAAA,UAuDA,SAAU,WACR,GAAA,GAAA,EAAA,CAAA,GAAA,KAAA,UAAA,KAAA,IAAA,UACE,KAAC,OAAO,SAAS,SACnB,MAAC","sourcesContent":["\n_ = require \"underscore\"\n\nmodule.exports = (user_list)->\n\n #\n # A trivial Connector that simulates network delay.\n #\n class TestConnector\n\n #\n # @param {Engine} engine The transformation engine\n # @param {HistoryBuffer} HB\n # @param {Array<Function>} execution_listener You must ensure that whenever an operation is executed, every function in this Array is called.\n # @param {Yatta} yatta The Yatta framework.\n #\n constructor: (@engine, @HB, @execution_listener)->\n send_ = (o)=>\n @send o\n @execution_listener.push send_\n\n @applied_operations = []\n appliedOperationsListener = (o)=>\n @applied_operations.push o\n @execution_listener.push appliedOperationsListener\n if not (user_list?.length is 0)\n @engine.applyOps user_list[0].getHistoryBuffer()._encode()\n\n @unexecuted = {}\n\n #\n # This engine applied operations in a specific order.\n # Get the ops in the right order.\n #\n getOpsInExecutionOrder: ()->\n @applied_operations\n\n #\n # This function is called whenever an operation was executed.\n # @param {Operation} o The operation that was executed.\n #\n send: (o)->\n if (o.uid.creator is @HB.getUserId()) and (typeof o.uid.op_number isnt \"string\")\n for user in user_list\n if user.getUserId() isnt @HB.getUserId()\n user.getConnector().receive(o)\n\n #\n # This function is called whenever an operation was received from another peer.\n # @param {Operation} o The operation that was received.\n #\n receive: (o)->\n @unexecuted[o.uid.creator] ?= []\n @unexecuted[o.uid.creator].push o\n\n #\n # Flush one operation from the line of a specific user.\n #\n flushOne: (user)->\n if @unexecuted[user]?.length > 0\n @engine.applyOp @unexecuted[user].shift()\n\n #\n # Flush one operation on a random line.\n #\n flushOneRandom: ()->\n @flushOne (_.random 0, (user_list.length-1))\n\n #\n # Flush all operations on every line.\n #\n flushAll: ()->\n for n,ops of @unexecuted\n @engine.applyOps ops\n @unexecuted = {}\n\n"],"sourceRoot":"/source/"}