-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFringe.m
34 lines (28 loc) · 786 Bytes
/
Fringe.m
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
classdef Fringe < handle
properties
Nodes = Node.empty;
NumberOfExpandedNodes = 0;
end
methods
function node = RemoveFront(fringe)
node = fringe.Nodes(1);
fringe.Nodes = fringe.Nodes(2:length(fringe.Nodes));
end
function InsertAll(fringe, nodes)
for node = nodes
fringe.Insert(node);
end
fringe.NumberOfExpandedNodes = fringe.NumberOfExpandedNodes + 1;
end
function result = IsEmpty(fringe)
if isempty(fringe.Nodes)
result = true;
else
result = false;
end
end
end
methods (Abstract=true)
Insert(node)
end
end