course-renderer
Version:
Manages CA School Courses file system storage and HTML conversion
73 lines (72 loc) • 1.61 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Token {
constructor(type) {
this.type = type;
if (type === 'REPL') {
this.setReadonly();
}
}
setType(type) {
this.type = type;
}
addChild(token) {
if (!this.children)
this.children = [];
this.children.push(token);
}
setContent(content) {
this.content = content;
}
setAnswer(answer) {
this.answer = answer;
}
setChapter(chapter) {
this.chapter = chapter;
}
setReadonly(readonly = false) {
this.readonly = readonly;
}
setCaption(caption) {
this.caption = caption;
}
setId(id) {
this.id = id;
}
setInitialization(initialization) {
this.initialization = initialization;
}
addCode(code) {
if (!this.code)
this.code = [];
this.code.push(code);
}
addParam(param) {
if (!this.param)
this.param = [];
this.param.push(param);
}
addFile(file) {
if (!this.files)
this.files = [];
this.files.push(file);
}
addChoice(choice) {
if (!this.choices)
this.choices = [];
this.choices.push(choice);
}
getFiles() {
return this.files ? this.files : [];
}
getCodes() {
return this.code ? this.code : [];
}
setChoiceType(choiceType) {
this.choiceType = choiceType;
}
getChoiceType() {
return this.choiceType;
}
}
exports.default = Token;