forked from algorithm-visualizer/algorithm-visualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray1d.js
More file actions
65 lines (55 loc) · 1.23 KB
/
array1d.js
File metadata and controls
65 lines (55 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'use strict';
const Array2DTracer = require('./array2d');
class Array1DTracer extends Array2DTracer {
static getClassName() {
return 'Array1DTracer';
}
constructor(name) {
super(name);
}
_notify(idx, v) {
super._notify(0, idx, v);
return this;
}
_denotify(idx) {
super._denotify(0, idx);
return this;
}
_select(s, e) {
if (e === undefined) {
super._select(0, s);
} else {
super._selectRow(0, s, e);
}
return this;
}
_deselect(s, e) {
if (e === undefined) {
super._deselect(0, s);
} else {
super._deselectRow(0, s, e);
}
return this;
}
processStep(step, options) {
super.processStep(step, options);
if (this.chartTracer) {
const newStep = $.extend(true, {}, step);
newStep.capsule = this.chartTracer.capsule;
newStep.s = newStep.sy;
newStep.e = newStep.ey;
if (newStep.s === undefined) newStep.s = newStep.y;
delete newStep.x;
delete newStep.y;
delete newStep.sx;
delete newStep.sy;
delete newStep.ex;
delete newStep.ey;
this.chartTracer.processStep(newStep, options);
}
}
setData(D) {
return super.setData([D]);
}
}
module.exports = Array1DTracer;