@@ -8,7 +8,6 @@ import { UUID } from "@phosphor/coreutils";
8
8
* Abstract class for accessing cell data.
9
9
*/
10
10
export abstract class AbstractCell implements Cell {
11
- abstract is_cell : boolean ;
12
11
abstract id : string ;
13
12
abstract executionCount : number ;
14
13
abstract executionEventId : string ;
@@ -77,37 +76,37 @@ export abstract class AbstractCell implements Cell {
77
76
}
78
77
}
79
78
79
+ export interface LogCellOptions {
80
+ id ?: string ;
81
+ executionCount ?: number ;
82
+ persistentId ?: string ;
83
+ executionEventId ?: string ;
84
+ hasError ?: boolean ;
85
+ text ?: string ;
86
+ outputs ?: nbformat . IOutput [ ] ;
87
+ }
88
+
80
89
/**
81
90
* Static cell data. Provides an interfaces to cell data loaded from a log.
82
91
*/
83
92
export class LogCell extends AbstractCell {
84
- constructor ( data : {
85
- id ?: string ;
86
- executionCount ?: number ;
87
- persistentId ?: string ;
88
- executionEventId ?: string ;
89
- hasError ?: boolean ;
90
- text ?: string ;
91
- outputs ?: nbformat . IOutput [ ] ;
92
- } ) {
93
+ constructor ( options : LogCellOptions ) {
93
94
super ( ) ;
94
- this . is_cell = true ;
95
- this . id = data . id || UUID . uuid4 ( ) ;
96
- this . executionCount = data . executionCount || undefined ;
97
- this . persistentId = data . persistentId || UUID . uuid4 ( ) ;
98
- this . executionEventId = data . executionEventId || UUID . uuid4 ( ) ;
99
- this . hasError = data . hasError || false ;
100
- this . text = data . text || "" ;
95
+ this . id = options . id || UUID . uuid4 ( ) ;
96
+ this . executionCount = options . executionCount || undefined ;
97
+ this . persistentId = options . persistentId || UUID . uuid4 ( ) ;
98
+ this . executionEventId = options . executionEventId || UUID . uuid4 ( ) ;
99
+ this . hasError = options . hasError || false ;
100
+ this . text = options . text || "" ;
101
101
this . lastExecutedText = this . text ;
102
- this . outputs = data . outputs || [ ] ;
102
+ this . outputs = options . outputs || [ ] ;
103
103
this . gathered = false ;
104
104
}
105
105
106
106
deepCopy ( ) : AbstractCell {
107
107
return new LogCell ( this ) ;
108
108
}
109
109
110
- readonly is_cell : boolean ;
111
110
readonly id : string ;
112
111
readonly executionCount : number ;
113
112
readonly persistentId : string ;
@@ -215,7 +214,5 @@ export class LabCell extends AbstractCell {
215
214
return this . _model . toJSON ( ) ;
216
215
}
217
216
218
- is_cell : boolean = true ;
219
- is_outputter_cell : boolean = true ;
220
217
private _model : ICodeCellModel ;
221
218
}
0 commit comments