File tree Expand file tree Collapse file tree 6 files changed +19
-4
lines changed Expand file tree Collapse file tree 6 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,11 @@ var EventManager = /** @class */ (function () {
14
14
viewer . playButtonState ( ) ;
15
15
if ( this . nextEvents . length == 0 ) {
16
16
screenLock ( false ) ;
17
+ if ( control . getAlgoName ( ) === "MaxHeapCombined" ) {
18
+ $ ( "#removeElem" ) . attr ( { "disabled" : "true" } ) ;
19
+ if ( control . getAlgorithm ( ) . finished )
20
+ screenLock ( true ) ;
21
+ }
17
22
return ;
18
23
}
19
24
screenLock ( true ) ;
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ class EventManager {
17
17
viewer . playButtonState ( ) ;
18
18
if ( this . nextEvents . length == 0 ) {
19
19
screenLock ( false ) ;
20
+ if ( control . getAlgoName ( ) === "MaxHeapCombined" ) {
21
+ $ ( "#removeElem" ) . attr ( { "disabled" : "true" } ) ;
22
+ if ( ( < MaxHeapCombined > control . getAlgorithm ( ) ) . finished )
23
+ screenLock ( true ) ;
24
+ }
20
25
return ;
21
26
}
22
27
screenLock ( true ) ;
@@ -30,10 +35,10 @@ class EventManager {
30
35
// Executing the previous event
31
36
previous ( ) {
32
37
if ( this . previousEvents . length == 0 ) {
33
- screenLock ( false ) ;
38
+ screenLock ( false ) ;
34
39
return ;
35
40
}
36
- screenLock ( true ) ;
41
+ screenLock ( true ) ;
37
42
var event : FrontendEvent = ( < FrontendEvent > this . previousEvents . pop ( ) ) ;
38
43
event . previous ( ) ;
39
44
this . nextEvents . unshift ( event ) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ var MaxHeapCombined = /** @class */ (function (_super) {
19
19
var _this = _super . call ( this , size ) || this ;
20
20
HeapSort . insertElems ( 10 ) ;
21
21
_this . sortIndex = _this . currIndex - 1 ;
22
+ _this . finished = false ;
22
23
return _this ;
23
24
}
24
25
MaxHeapCombined . prototype . add = function ( a ) {
@@ -37,6 +38,7 @@ var MaxHeapCombined = /** @class */ (function (_super) {
37
38
this . remove ( ) ;
38
39
}
39
40
control . setArrow ( - 1 ) ;
41
+ this . finished = true ;
40
42
} ;
41
43
MaxHeapCombined . prototype . remove = function ( ) {
42
44
// Switch root and last element, remove root and start frontendevents
Original file line number Diff line number Diff line change 7
7
8
8
class MaxHeapCombined extends MaxHeapFree {
9
9
private sortIndex ;
10
+ public finished ;
10
11
11
12
constructor ( size : number ) {
12
13
super ( size ) ;
13
14
HeapSort . insertElems ( 10 ) ;
14
15
this . sortIndex = this . currIndex - 1 ;
16
+ this . finished = false ;
15
17
}
16
18
17
19
add ( a : number ) {
@@ -30,6 +32,7 @@ class MaxHeapCombined extends MaxHeapFree {
30
32
this . remove ( ) ;
31
33
}
32
34
control . setArrow ( - 1 ) ;
35
+ this . finished = true ;
33
36
}
34
37
35
38
remove ( ) : void {
Original file line number Diff line number Diff line change @@ -154,9 +154,9 @@ var View = /** @class */ (function () {
154
154
$ ( "#buildHeap, #sortHeap" ) . show ( ) ;
155
155
control . initController ( new MaxHeapCombined ( 10 ) ) ;
156
156
this . play ( ) ;
157
- $ ( "#removeElem" ) . attr ( { "disabled" : "true" } ) ;
158
157
lockBackForward ( true ) ;
159
158
lockPlay ( false ) ;
159
+ $ ( "#removeElem" ) . attr ( { "disabled" : "true" } ) ;
160
160
break ;
161
161
}
162
162
case "BuildHeap" : {
Original file line number Diff line number Diff line change @@ -177,9 +177,9 @@ class View {
177
177
$ ( "#buildHeap, #sortHeap" ) . show ( ) ;
178
178
control . initController ( new MaxHeapCombined ( 10 ) ) ;
179
179
this . play ( ) ;
180
- $ ( "#removeElem" ) . attr ( { "disabled" : "true" } ) ;
181
180
lockBackForward ( true ) ;
182
181
lockPlay ( false ) ;
182
+ $ ( "#removeElem" ) . attr ( { "disabled" : "true" } ) ;
183
183
break ;
184
184
}
185
185
case "BuildHeap" : {
You can’t perform that action at this time.
0 commit comments