/*
 * SDK Pullenti Lingvo, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software.
 * This class is generated using the converter Unisharping (www.unisharping.ru) from Pullenti C#.NET project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */


const ISemContainer = require("./ISemContainer");
const SemGraph = require("./SemGraph");

/**
 * Документ
 * 
 */
class SemDocument extends ISemContainer {
    
    constructor() {
        super();
        this.m_Graph = new SemGraph();
        this.blocks = new Array();
    }
    
    get graph() {
        return this.m_Graph;
    }
    
    get higher() {
        return null;
    }
    
    get beginChar() {
        return (this.blocks.length === 0 ? 0 : this.blocks[0].beginChar);
    }
    
    get endChar() {
        return (this.blocks.length === 0 ? 0 : this.blocks[this.blocks.length - 1].endChar);
    }
    
    mergeAllBlocks() {
        if (this.blocks.length < 2) 
            return;
        for (let i = 1; i < this.blocks.length; i++) {
            this.blocks[0].mergeWith(this.blocks[i]);
        }
        this.blocks.splice(1, this.blocks.length - 1);
    }
}


module.exports = SemDocument