Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tianyazhichiC
algorithm-visualizer
提交
dbcd9ed3
A
algorithm-visualizer
项目概览
tianyazhichiC
/
algorithm-visualizer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
algorithm-visualizer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dbcd9ed3
编写于
8年前
作者:
J
Jason Park
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename variable "tm" to manager
上级
af3f5438
master
dependabot/npm_and_yarn/acorn-5.7.4
dependabot/npm_and_yarn/axios-0.21.1
dependabot/npm_and_yarn/chart.js-2.9.4
dependabot/npm_and_yarn/color-string-1.8.1
dependabot/npm_and_yarn/elliptic-6.5.3
dependabot/npm_and_yarn/elliptic-6.5.4
dependabot/npm_and_yarn/hosted-git-info-2.8.9
dependabot/npm_and_yarn/lodash-4.17.19
dependabot/npm_and_yarn/lodash-4.17.21
dependabot/npm_and_yarn/merge-deep-3.0.3
dependabot/npm_and_yarn/node-sass-4.13.1
dependabot/npm_and_yarn/path-parse-1.0.7
dependabot/npm_and_yarn/postcss-7.0.36
dependabot/npm_and_yarn/ssri-6.0.2
dependabot/npm_and_yarn/tmpl-1.0.5
dependabot/npm_and_yarn/url-parse-1.5.3
dependabot/npm_and_yarn/ws-5.2.3
dependabot/npm_and_yarn/y18n-3.2.2
无相关合并请求
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
36 addition
and
36 deletion
+36
-36
js/module/array2d.js
js/module/array2d.js
+3
-3
js/module/directed_graph.js
js/module/directed_graph.js
+3
-3
js/module/log_tracer.js
js/module/log_tracer.js
+1
-1
js/module/tracer.js
js/module/tracer.js
+5
-5
js/module/weighted_directed_graph.js
js/module/weighted_directed_graph.js
+3
-3
js/script.js
js/script.js
+21
-21
未找到文件。
js/module/array2d.js
浏览文件 @
dbcd9ed3
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
js/module/directed_graph.js
浏览文件 @
dbcd9ed3
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
js/module/log_tracer.js
浏览文件 @
dbcd9ed3
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
js/module/tracer.js
浏览文件 @
dbcd9ed3
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
)
{
...
...
This diff is collapsed.
Click to expand it.
js/module/weighted_directed_graph.js
浏览文件 @
dbcd9ed3
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
js/script.js
浏览文件 @
dbcd9ed3
...
...
@@ -35,12 +35,12 @@ var executeDataAndCode = function () {
e
.
stopPropagation
();
});
var
t
m
=
new
TracerManager
();
Tracer
.
prototype
.
tm
=
tm
;
var
t
racerManager
=
new
TracerManager
();
Tracer
.
prototype
.
manager
=
tracerManager
;
$
(
'
#interval
'
).
on
(
'
change
'
,
function
()
{
t
m
.
interval
=
Number
.
parseFloat
(
$
(
this
).
val
()
*
1000
);
showInfoToast
(
'
Tracing interval has been set to
'
+
t
m
.
interval
/
1000
+
'
second(s).
'
);
t
racerManager
.
interval
=
Number
.
parseFloat
(
$
(
this
).
val
()
*
1000
);
showInfoToast
(
'
Tracing interval has been set to
'
+
t
racerManager
.
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
(
t
m
,
data
);
executeData
(
t
racerManager
,
data
);
});
codeEditor
.
on
(
'
change
'
,
function
()
{
var
code
=
codeEditor
.
getValue
();
...
...
@@ -305,7 +305,7 @@ var executeDataAndCode = function () {
$sidemenu
.
css
(
'
right
'
,
0
);
$workspace
.
css
(
'
left
'
,
0
);
}
t
m
.
resize
();
t
racerManager
.
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
(
t
m
,
data
,
code
);
var
err
=
executeDataAndCode
(
t
racerManager
,
data
,
code
);
if
(
err
)
{
console
.
error
(
err
);
showErrorToast
(
err
);
}
});
$
(
'
#btn_pause
'
).
click
(
function
()
{
if
(
t
m
.
isPause
())
{
t
m
.
resumeStep
();
if
(
t
racerManager
.
isPause
())
{
t
racerManager
.
resumeStep
();
}
else
{
t
m
.
pauseStep
();
t
racerManager
.
pauseStep
();
}
});
$
(
'
#btn_prev
'
).
click
(
function
()
{
t
m
.
pauseStep
();
t
m
.
prevStep
();
t
racerManager
.
pauseStep
();
t
racerManager
.
prevStep
();
});
$
(
'
#btn_next
'
).
click
(
function
()
{
t
m
.
pauseStep
();
t
m
.
nextStep
();
t
racerManager
.
pauseStep
();
t
racerManager
.
nextStep
();
});
$
(
'
#btn_desc
'
).
click
(
function
()
{
...
...
@@ -381,7 +381,7 @@ var executeDataAndCode = function () {
});
$
(
window
).
resize
(
function
()
{
t
m
.
resize
();
t
racerManager
.
resize
();
});
var
dividers
=
[
...
...
@@ -422,7 +422,7 @@ var executeDataAndCode = function () {
$first
.
css
(
'
right
'
,
(
100
-
percent
)
+
'
%
'
);
$second
.
css
(
'
left
'
,
percent
+
'
%
'
);
x
=
e
.
pageX
;
t
m
.
resize
();
t
racerManager
.
resize
();
$
(
'
.files_bar > .wrapper
'
).
scroll
();
}
});
...
...
@@ -451,7 +451,7 @@ var executeDataAndCode = function () {
$first
.
css
(
'
bottom
'
,
(
100
-
percent
)
+
'
%
'
);
$second
.
css
(
'
top
'
,
percent
+
'
%
'
);
y
=
e
.
pageY
;
t
m
.
resize
();
t
racerManager
.
resize
();
}
});
$
(
document
).
mouseup
(
function
(
e
)
{
...
...
@@ -464,16 +464,16 @@ var executeDataAndCode = function () {
}
$module_container
.
on
(
'
mousedown
'
,
'
.module_wrapper
'
,
function
(
e
)
{
t
m
.
findOwner
(
this
).
mousedown
(
e
);
t
racerManager
.
findOwner
(
this
).
mousedown
(
e
);
});
$module_container
.
on
(
'
mousemove
'
,
'
.module_wrapper
'
,
function
(
e
)
{
t
m
.
findOwner
(
this
).
mousemove
(
e
);
t
racerManager
.
findOwner
(
this
).
mousemove
(
e
);
});
$
(
document
).
mouseup
(
function
(
e
)
{
t
m
.
command
(
'
mouseup
'
,
e
);
t
racerManager
.
command
(
'
mouseup
'
,
e
);
});
$module_container
.
on
(
'
DOMMouseScroll mousewheel
'
,
'
.module_wrapper
'
,
function
(
e
)
{
t
m
.
findOwner
(
this
).
mousewheel
(
e
);
t
racerManager
.
findOwner
(
this
).
mousewheel
(
e
);
});
// Share scratch paper
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录