Oleg Sh 43a4b44a22 Change script location.
Split js code.
Added cache and changed loading mechanism for js sources.
2023-11-06 19:16:50 +02:00

57 lines
1.1 KiB
JavaScript

/**
* Find short path.
*
*/
function BaseTraversal(graph, app)
{
BaseAlgorithmEx.apply(this, arguments);
this.visited = [];
this.edges = [];
this.timer = null;
}
// inheritance.
BaseTraversal.prototype = Object.create(BaseAlgorithmEx.prototype);
// timer interval
BaseTraversal.prototype.timerInterval = 500;
BaseTraversal.prototype.result = function(resultCallback)
{
var result = {};
result["version"] = 1;
return result;
}
BaseTraversal.prototype.selectVertex = function(vertex)
{
this.visited = [];
this.edges = [];
if (this.timer)
clearTimeout(this.timer);
this.timer = null;
this.visited.push(vertex);
var context = this;
this.timer = setInterval(function()
{
context.step();
}, this.timerInterval);
this.message = this.getMainMessage();
return true;
}
BaseTraversal.prototype.getObjectSelectedGroup = function(object)
{
return (this.visited.includes(object) ? 1 : (this.edges.includes(object) ? 1 : 0));
}
BaseTraversal.prototype.instance = function()
{
return false;
}