/*
 * 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 StringBuilder = require("./../unisharp/StringBuilder");

const SemLinkType = require("./SemLinkType");

/**
 * Семантическая связь между объектами
 */
class SemLink {
    
    constructor(gr, src, tgt) {
        this.graph = null;
        this.typ = SemLinkType.UNDEFINED;
        this.m_Source = null;
        this.m_Target = null;
        this.altLink = null;
        this.question = null;
        this.preposition = null;
        this.isOr = false;
        this.tag = null;
        this.graph = gr;
        this.m_Source = src;
        this.m_Target = tgt;
        src.linksFrom.push(this);
        tgt.linksTo.push(this);
    }
    
    get source() {
        return this.m_Source;
    }
    
    get target() {
        return this.m_Target;
    }
    
    toString() {
        let tmp = new StringBuilder();
        if (this.altLink !== null) 
            tmp.append("??? ");
        if (this.isOr) 
            tmp.append("OR ");
        if (this.typ !== SemLinkType.UNDEFINED) 
            tmp.append(this.typ.toString());
        if (this.question !== null) 
            tmp.append(" ").append(this.question).append("?");
        if (this.source !== null) 
            tmp.append(" ").append(this.source.toString());
        if (this.target !== null) 
            tmp.append(" -> ").append(this.target.toString());
        return tmp.toString();
    }
    
    static _new3860(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) {
        let res = new SemLink(_arg1, _arg2, _arg3);
        res.typ = _arg4;
        res.question = _arg5;
        res.isOr = _arg6;
        res.preposition = _arg7;
        return res;
    }
}


module.exports = SemLink