FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

rename variable "tm" to manager · lusan/AlgorithmVisualizer@456b26f · GitHub

Commit 456b26f

Browse files
committed
rename variable "tm" to manager
1 parent 33f3c7f commit 456b26f

6 files changed

Lines changed: 36 additions & 36 deletions

File tree

‎js/module/array2d.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Array2DTracer.prototype = $.extend(true, Object.create(Tracer.prototype), {
1313
this.$container.append(this.$table);
1414
},
1515
_notify: function (x, y, v) {
16-
this.tm.pushStep(this.capsule, {
16+
this.manager.pushStep(this.capsule, {
1717
type: 'notify',
1818
x: x,
1919
y: y,
@@ -22,7 +22,7 @@ Array2DTracer.prototype = $.extend(true, Object.create(Tracer.prototype), {
2222
return this;
2323
},
2424
_denotify: function (x, y) {
25-
this.tm.pushStep(this.capsule, {
25+
this.manager.pushStep(this.capsule, {
2626
type: 'denotify',
2727
x: x,
2828
y: y
@@ -93,7 +93,7 @@ Array2DTracer.prototype = $.extend(true, Object.create(Tracer.prototype), {
9393
type: type
9494
};
9595
$.extend(step, coord);
96-
this.tm.pushStep(this.capsule, step);
96+
this.manager.pushStep(this.capsule, step);
9797
},
9898
processStep: function (step, options) {
9999
switch (step.type) {

‎js/module/directed_graph.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ DirectedGraphTracer.prototype = $.extend(true, Object.create(Tracer.prototype),
4646
this.graph = this.capsule.graph = this.s.graph;
4747
},
4848
_setTreeData: function (G, root) {
49-
this.tm.pushStep(this.capsule, {type: 'setTreeData', arguments: arguments});
49+
this.manager.pushStep(this.capsule, {type: 'setTreeData', arguments: arguments});
5050
return this;
5151
},
5252
_visit: function (target, source) {
53-
this.tm.pushStep(this.capsule, {type: 'visit', target: target, source: source});
53+
this.manager.pushStep(this.capsule, {type: 'visit', target: target, source: source});
5454
return this;
5555
},
5656
_leave: function (target, source) {
57-
this.tm.pushStep(this.capsule, {type: 'leave', target: target, source: source});
57+
this.manager.pushStep(this.capsule, {type: 'leave', target: target, source: source});
5858
return this;
5959
},
6060
processStep: function (step, options) {

‎js/module/log_tracer.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LogTracer.prototype = $.extend(true, Object.create(Tracer.prototype), {
1313
this.$container.append(this.$wrapper);
1414
},
1515
_print: function (msg) {
16-
this.tm.pushStep(this.capsule, {type: 'print', msg: msg});
16+
this.manager.pushStep(this.capsule, {type: 'print', msg: msg});
1717
return this;
1818
},
1919
processStep: function (step, options) {

‎js/module/tracer.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
function Tracer(name) {
22
this.module = this.constructor;
3-
this.capsule = this.tm.allocate(this);
3+
this.capsule = this.manager.allocate(this);
44
$.extend(this, this.capsule);
55
this.setName(name);
66
return this.new;
77
}
88

99
Tracer.prototype = {
1010
constructor: Tracer,
11-
tm: null,
11+
manager: null,
1212
_setData: function () {
1313
var args = Array.prototype.slice.call(arguments);
14-
this.tm.pushStep(this.capsule, {type: 'setData', args: TracerUtil.toJSON(args)});
14+
this.manager.pushStep(this.capsule, {type: 'setData', args: TracerUtil.toJSON(args)});
1515
return this;
1616
},
1717
_clear: function () {
18-
this.tm.pushStep(this.capsule, {type: 'clear'});
18+
this.manager.pushStep(this.capsule, {type: 'clear'});
1919
return this;
2020
},
2121
_wait: function () {
22-
this.tm.newStep();
22+
this.manager.newStep();
2323
return this;
2424
},
2525
processStep: function (step, options) {

‎js/module/weighted_directed_graph.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ WeightedDirectedGraphTracer.prototype = $.extend(true, Object.create(DirectedGra
3030
});
3131
},
3232
_weight: function (target, weight) {
33-
this.tm.pushStep(this.capsule, {type: 'weight', target: target, weight: weight});
33+
this.manager.pushStep(this.capsule, {type: 'weight', target: target, weight: weight});
3434
return this;
3535
},
3636
_visit: function (target, source, weight) {
37-
this.tm.pushStep(this.capsule, {type: 'visit', target: target, source: source, weight: weight});
37+
this.manager.pushStep(this.capsule, {type: 'visit', target: target, source: source, weight: weight});
3838
return this;
3939
},
4040
_leave: function (target, source, weight) {
41-
this.tm.pushStep(this.capsule, {type: 'leave', target: target, source: source, weight: weight});
41+
this.manager.pushStep(this.capsule, {type: 'leave', target: target, source: source, weight: weight});
4242
return this;
4343
},
4444
processStep: function (step, options) {

‎js/script.js‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ var executeDataAndCode = function () {
3535
e.stopPropagation();
3636
});
3737

38-
var tm = new TracerManager();
39-
Tracer.prototype.tm = tm;
38+
var tracerManager = new TracerManager();
39+
Tracer.prototype.manager = tracerManager;
4040

4141
$('#interval').on('change', function () {
42-
tm.interval = Number.parseFloat($(this).val() * 1000);
43-
showInfoToast('Tracing interval has been set to ' + tm.interval / 1000 + ' second(s).');
42+
tracerManager.interval = Number.parseFloat($(this).val() * 1000);
43+
showInfoToast('Tracing interval has been set to ' + tracerManager.interval / 1000 + ' second(s).');
4444
});
4545

4646
var $module_container = $('.module_container');
@@ -63,7 +63,7 @@ var executeDataAndCode = function () {
6363
dataEditor.on('change', function () {
6464
var data = dataEditor.getValue();
6565
if (lastFile) cachedFile[lastFile].data = data;
66-
executeData(tm, data);
66+
executeData(tracerManager, data);
6767
});
6868
codeEditor.on('change', function () {
6969
var code = codeEditor.getValue();
@@ -305,7 +305,7 @@ var executeDataAndCode = function () {
305305
$sidemenu.css('right', 0);
306306
$workspace.css('left', 0);
307307
}
308-
tm.resize();
308+
tracerManager.resize();
309309
});
310310

311311
var showErrorToast = function (err) {
@@ -345,26 +345,26 @@ var executeDataAndCode = function () {
345345
$('#btn_trace').click();
346346
var data = dataEditor.getValue();
347347
var code = codeEditor.getValue();
348-
var err = executeDataAndCode(tm, data, code);
348+
var err = executeDataAndCode(tracerManager, data, code);
349349
if (err) {
350350
console.error(err);
351351
showErrorToast(err);
352352
}
353353
});
354354
$('#btn_pause').click(function () {
355-
if (tm.isPause()) {
356-
tm.resumeStep();
355+
if (tracerManager.isPause()) {
356+
tracerManager.resumeStep();
357357
} else {
358-
tm.pauseStep();
358+
tracerManager.pauseStep();
359359
}
360360
});
361361
$('#btn_prev').click(function () {
362-
tm.pauseStep();
363-
tm.prevStep();
362+
tracerManager.pauseStep();
363+
tracerManager.prevStep();
364364
});
365365
$('#btn_next').click(function () {
366-
tm.pauseStep();
367-
tm.nextStep();
366+
tracerManager.pauseStep();
367+
tracerManager.nextStep();
368368
});
369369

370370
$('#btn_desc').click(function () {
@@ -381,7 +381,7 @@ var executeDataAndCode = function () {
381381
});
382382

383383
$(window).resize(function () {
384-
tm.resize();
384+
tracerManager.resize();
385385
});
386386

387387
var dividers = [
@@ -422,7 +422,7 @@ var executeDataAndCode = function () {
422422
$first.css('right', (100 - percent) + '%');
423423
$second.css('left', percent + '%');
424424
x = e.pageX;
425-
tm.resize();
425+
tracerManager.resize();
426426
$('.files_bar > .wrapper').scroll();
427427
}
428428
});
@@ -451,7 +451,7 @@ var executeDataAndCode = function () {
451451
$first.css('bottom', (100 - percent) + '%');
452452
$second.css('top', percent + '%');
453453
y = e.pageY;
454-
tm.resize();
454+
tracerManager.resize();
455455
}
456456
});
457457
$(document).mouseup(function (e) {
@@ -464,16 +464,16 @@ var executeDataAndCode = function () {
464464
}
465465

466466
$module_container.on('mousedown', '.module_wrapper', function (e) {
467-
tm.findOwner(this).mousedown(e);
467+
tracerManager.findOwner(this).mousedown(e);
468468
});
469469
$module_container.on('mousemove', '.module_wrapper', function (e) {
470-
tm.findOwner(this).mousemove(e);
470+
tracerManager.findOwner(this).mousemove(e);
471471
});
472472
$(document).mouseup(function (e) {
473-
tm.command('mouseup', e);
473+
tracerManager.command('mouseup', e);
474474
});
475475
$module_container.on('DOMMouseScroll mousewheel', '.module_wrapper', function (e) {
476-
tm.findOwner(this).mousewheel(e);
476+
tracerManager.findOwner(this).mousewheel(e);
477477
});
478478

479479
// Share scratch paper

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL