提交 dbcd9ed3 编写于 作者: J Jason Park

rename variable "tm" to manager

......@@ -13,7 +13,7 @@ Array2DTracer.prototype = $.extend(true, Object.create(Tracer.prototype), {
this.$container.append(this.$table);
},
_notify: function (x, y, v) {
this.tm.pushStep(this.capsule, {
this.manager.pushStep(this.capsule, {
type: 'notify',
x: x,
y: y,
......@@ -22,7 +22,7 @@ Array2DTracer.prototype = $.extend(true, Object.create(Tracer.prototype), {
return this;
},
_denotify: function (x, y) {
this.tm.pushStep(this.capsule, {
this.manager.pushStep(this.capsule, {
type: 'denotify',
x: x,
y: y
......@@ -93,7 +93,7 @@ Array2DTracer.prototype = $.extend(true, Object.create(Tracer.prototype), {
type: type
};
$.extend(step, coord);
this.tm.pushStep(this.capsule, step);
this.manager.pushStep(this.capsule, step);
},
processStep: function (step, options) {
switch (step.type) {
......
......@@ -46,15 +46,15 @@ DirectedGraphTracer.prototype = $.extend(true, Object.create(Tracer.prototype),
this.graph = this.capsule.graph = this.s.graph;
},
_setTreeData: function (G, root) {
this.tm.pushStep(this.capsule, {type: 'setTreeData', arguments: arguments});
this.manager.pushStep(this.capsule, {type: 'setTreeData', arguments: arguments});
return this;
},
_visit: function (target, source) {
this.tm.pushStep(this.capsule, {type: 'visit', target: target, source: source});
this.manager.pushStep(this.capsule, {type: 'visit', target: target, source: source});
return this;
},
_leave: function (target, source) {
this.tm.pushStep(this.capsule, {type: 'leave', target: target, source: source});
this.manager.pushStep(this.capsule, {type: 'leave', target: target, source: source});
return this;
},
processStep: function (step, options) {
......
......@@ -13,7 +13,7 @@ LogTracer.prototype = $.extend(true, Object.create(Tracer.prototype), {
this.$container.append(this.$wrapper);
},
_print: function (msg) {
this.tm.pushStep(this.capsule, {type: 'print', msg: msg});
this.manager.pushStep(this.capsule, {type: 'print', msg: msg});
return this;
},
processStep: function (step, options) {
......
function Tracer(name) {
this.module = this.constructor;
this.capsule = this.tm.allocate(this);
this.capsule = this.manager.allocate(this);
$.extend(this, this.capsule);
this.setName(name);
return this.new;
......@@ -8,18 +8,18 @@ function Tracer(name) {
Tracer.prototype = {
constructor: Tracer,
tm: null,
manager: null,
_setData: function () {
var args = Array.prototype.slice.call(arguments);
this.tm.pushStep(this.capsule, {type: 'setData', args: TracerUtil.toJSON(args)});
this.manager.pushStep(this.capsule, {type: 'setData', args: TracerUtil.toJSON(args)});
return this;
},
_clear: function () {
this.tm.pushStep(this.capsule, {type: 'clear'});
this.manager.pushStep(this.capsule, {type: 'clear'});
return this;
},
_wait: function () {
this.tm.newStep();
this.manager.newStep();
return this;
},
processStep: function (step, options) {
......
......@@ -30,15 +30,15 @@ WeightedDirectedGraphTracer.prototype = $.extend(true, Object.create(DirectedGra
});
},
_weight: function (target, weight) {
this.tm.pushStep(this.capsule, {type: 'weight', target: target, weight: weight});
this.manager.pushStep(this.capsule, {type: 'weight', target: target, weight: weight});
return this;
},
_visit: function (target, source, weight) {
this.tm.pushStep(this.capsule, {type: 'visit', target: target, source: source, weight: weight});
this.manager.pushStep(this.capsule, {type: 'visit', target: target, source: source, weight: weight});
return this;
},
_leave: function (target, source, weight) {
this.tm.pushStep(this.capsule, {type: 'leave', target: target, source: source, weight: weight});
this.manager.pushStep(this.capsule, {type: 'leave', target: target, source: source, weight: weight});
return this;
},
processStep: function (step, options) {
......
......@@ -35,12 +35,12 @@ var executeDataAndCode = function () {
e.stopPropagation();
});
var tm = new TracerManager();
Tracer.prototype.tm = tm;
var tracerManager = new TracerManager();
Tracer.prototype.manager = tracerManager;
$('#interval').on('change', function () {
tm.interval = Number.parseFloat($(this).val() * 1000);
showInfoToast('Tracing interval has been set to ' + tm.interval / 1000 + ' second(s).');
tracerManager.interval = Number.parseFloat($(this).val() * 1000);
showInfoToast('Tracing interval has been set to ' + tracerManager.interval / 1000 + ' second(s).');
});
var $module_container = $('.module_container');
......@@ -63,7 +63,7 @@ var executeDataAndCode = function () {
dataEditor.on('change', function () {
var data = dataEditor.getValue();
if (lastFile) cachedFile[lastFile].data = data;
executeData(tm, data);
executeData(tracerManager, data);
});
codeEditor.on('change', function () {
var code = codeEditor.getValue();
......@@ -305,7 +305,7 @@ var executeDataAndCode = function () {
$sidemenu.css('right', 0);
$workspace.css('left', 0);
}
tm.resize();
tracerManager.resize();
});
var showErrorToast = function (err) {
......@@ -345,26 +345,26 @@ var executeDataAndCode = function () {
$('#btn_trace').click();
var data = dataEditor.getValue();
var code = codeEditor.getValue();
var err = executeDataAndCode(tm, data, code);
var err = executeDataAndCode(tracerManager, data, code);
if (err) {
console.error(err);
showErrorToast(err);
}
});
$('#btn_pause').click(function () {
if (tm.isPause()) {
tm.resumeStep();
if (tracerManager.isPause()) {
tracerManager.resumeStep();
} else {
tm.pauseStep();
tracerManager.pauseStep();
}
});
$('#btn_prev').click(function () {
tm.pauseStep();
tm.prevStep();
tracerManager.pauseStep();
tracerManager.prevStep();
});
$('#btn_next').click(function () {
tm.pauseStep();
tm.nextStep();
tracerManager.pauseStep();
tracerManager.nextStep();
});
$('#btn_desc').click(function () {
......@@ -381,7 +381,7 @@ var executeDataAndCode = function () {
});
$(window).resize(function () {
tm.resize();
tracerManager.resize();
});
var dividers = [
......@@ -422,7 +422,7 @@ var executeDataAndCode = function () {
$first.css('right', (100 - percent) + '%');
$second.css('left', percent + '%');
x = e.pageX;
tm.resize();
tracerManager.resize();
$('.files_bar > .wrapper').scroll();
}
});
......@@ -451,7 +451,7 @@ var executeDataAndCode = function () {
$first.css('bottom', (100 - percent) + '%');
$second.css('top', percent + '%');
y = e.pageY;
tm.resize();
tracerManager.resize();
}
});
$(document).mouseup(function (e) {
......@@ -464,16 +464,16 @@ var executeDataAndCode = function () {
}
$module_container.on('mousedown', '.module_wrapper', function (e) {
tm.findOwner(this).mousedown(e);
tracerManager.findOwner(this).mousedown(e);
});
$module_container.on('mousemove', '.module_wrapper', function (e) {
tm.findOwner(this).mousemove(e);
tracerManager.findOwner(this).mousemove(e);
});
$(document).mouseup(function (e) {
tm.command('mouseup', e);
tracerManager.command('mouseup', e);
});
$module_container.on('DOMMouseScroll mousewheel', '.module_wrapper', function (e) {
tm.findOwner(this).mousewheel(e);
tracerManager.findOwner(this).mousewheel(e);
});
// Share scratch paper
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册