UNPKG

step-sequence-generator

Version:

A step sequence generator for figure skating programs

31 lines (30 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.App = void 0; const SequenceGeneratorFactory_1 = require("../sequence-generator/SequenceGeneratorFactory"); class App { constructor({ sourceFormatter, config }) { this.sequenceGenerator = null; this.sourceFormatter = sourceFormatter; this.config = config; } generateSequence(stepAmountBySequenceLevel, distanceFactor) { if (this.sequenceGenerator) { return this.sequenceGenerator.generate(stepAmountBySequenceLevel, distanceFactor); } else { throw new Error('Необходимо инициализировать приложение'); } } init() { const data = this.loadExcelSource(this.config.excelPath, this.config.excelName); this.sequenceGenerator = this.createSequenceGenerator(data); } createSequenceGenerator(data) { return SequenceGeneratorFactory_1.SequenceGeneratorFactory.createDefaultGenerator(data); } loadExcelSource(dirPath, srcFileName) { return this.sourceFormatter.loadSource(dirPath, srcFileName); } } exports.App = App;