UNPKG

silegismg-interpretador-articulacao

Version:
46 lines (45 loc) 1.88 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); /* Copyright 2017 Assembleia Legislativa de Minas Gerais * * This file is part of Interpretador-Articulacao. * * Interpretador-Articulacao is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, version 3. * * Interpretador-Articulacao is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Interpretador-Articulacao. If not, see <http://www.gnu.org/licenses/>. */ const Artigo_1 = __importDefault(require("../Artigo")); const Dispositivo_1 = require("../Dispositivo"); const Divisao_1 = __importDefault(require("./Divisao")); const Subsecao_1 = __importDefault(require("./Subsecao")); class Secao extends Divisao_1.default { constructor(numero, descricao) { super(Dispositivo_1.TipoAgrupador.SECAO, numero, descricao, ['artigos', 'subsecoes']); this.subsecoes = []; this.artigos = []; } adicionar(dispositivo) { Object.defineProperty(dispositivo, '$parent', { value: this }); if (dispositivo instanceof Subsecao_1.default) { this.subsecoes.push(dispositivo); } else if (dispositivo instanceof Artigo_1.default) { this.artigos.push(dispositivo); } else { throw new Error('Derivação não suportada.'); } } } exports.default = Secao;