/*
 * SDK Pullenti Unitext, 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# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

const Hashtable = require("./../../../unisharp/Hashtable");

class ToggleOperand {

    constructor(val, str) {
        this.m_val = val;
        this.m_str = str;
    }
    toString() {
        return this.m_str;
    }
    value() {
        return this.m_val;
    }
    static of(val) {
        if(val instanceof ToggleOperand) 
            return val;
        if(typeof val === 'string' || val instanceof String) {
            val = val.toUpperCase();
            if(ToggleOperand.mapStringToEnum.containsKey(val))
                return ToggleOperand.mapStringToEnum.get(val);
            return null;
        }
        if(ToggleOperand.mapIntToEnum.containsKey(val))
            return ToggleOperand.mapIntToEnum.get(val);
        let it = new ToggleOperand(val, val.toString());
        ToggleOperand.mapIntToEnum.put(val, it);
        ToggleOperand.mapStringToEnum.put(val.toString(), it);
        return it;
    }
    static isDefined(val) {
        return ToggleOperand.m_Keys.indexOf(val) >= 0;
    }
    static getValues() {
        return ToggleOperand.m_Values;
    }
    static static_constructor() {
        ToggleOperand.mapIntToEnum = new Hashtable();
        ToggleOperand.mapStringToEnum = new Hashtable();
        ToggleOperand.RESET = new ToggleOperand(0, "RESET");
        ToggleOperand.mapIntToEnum.put(ToggleOperand.RESET.value(), ToggleOperand.RESET); 
        ToggleOperand.mapStringToEnum.put(ToggleOperand.RESET.m_str.toUpperCase(), ToggleOperand.RESET); 
        ToggleOperand.SET = new ToggleOperand(1, "SET");
        ToggleOperand.mapIntToEnum.put(ToggleOperand.SET.value(), ToggleOperand.SET); 
        ToggleOperand.mapStringToEnum.put(ToggleOperand.SET.m_str.toUpperCase(), ToggleOperand.SET); 
        ToggleOperand.POSITIVE = new ToggleOperand(0x80, "POSITIVE");
        ToggleOperand.mapIntToEnum.put(ToggleOperand.POSITIVE.value(), ToggleOperand.POSITIVE); 
        ToggleOperand.mapStringToEnum.put(ToggleOperand.POSITIVE.m_str.toUpperCase(), ToggleOperand.POSITIVE); 
        ToggleOperand.NEGATIVE = new ToggleOperand(0x81, "NEGATIVE");
        ToggleOperand.mapIntToEnum.put(ToggleOperand.NEGATIVE.value(), ToggleOperand.NEGATIVE); 
        ToggleOperand.mapStringToEnum.put(ToggleOperand.NEGATIVE.m_str.toUpperCase(), ToggleOperand.NEGATIVE); 
        ToggleOperand.m_Values = Array.from(ToggleOperand.mapIntToEnum.values);
        ToggleOperand.m_Keys = Array.from(ToggleOperand.mapIntToEnum.keys);
    }
}


ToggleOperand.static_constructor();

module.exports = ToggleOperand