/*
 * 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
 */

package com.pullenti.unitext.internal.html;

public class HtmlTag {

    public static HtmlTag findTag(String _name) {
        if (_name == null) 
            return null;
        HtmlTag res;
        com.pullenti.unisharp.Outargwrapper<HtmlTag> wrapres43 = new com.pullenti.unisharp.Outargwrapper<HtmlTag>();
        boolean inoutres44 = com.pullenti.unisharp.Utils.tryGetValue(getAllTags(), _name, wrapres43);
        res = wrapres43.value;
        if (!inoutres44) 
            return null;
        return res;
    }

    public String name;

    public boolean isInline() {
        return (((m_Attrs.value()) & (Attrs.INLINE.value()))) != 0;
    }


    public boolean isBlock() {
        return (((m_Attrs.value()) & (Attrs.BLOCK.value()))) != 0;
    }


    public boolean isTable() {
        return (((m_Attrs.value()) & (Attrs.TABLEITEM.value()))) != 0;
    }


    public boolean isEmpty() {
        return (((m_Attrs.value()) & (Attrs.EMPTY.value()))) != 0;
    }


    public boolean getEndtagRequired() {
        return (((m_Attrs.value()) & (Attrs.ENDTAGREQ.value()))) != 0;
    }


    public boolean getIgnoreWithContent() {
        return (((m_Attrs.value()) & (Attrs.IGNOREWITHCONTENT.value()))) != 0;
    }


    private Attrs m_Attrs = Attrs.INLINE;

    private HtmlTag(String _name, Attrs typ) {
        if(_globalInstance == null) return;
        name = _name;
        m_Attrs = typ;
        m_AllTags.put(_name, this);
    }

    private static java.util.HashMap<String, HtmlTag> m_AllTags;

    private static java.util.HashMap<String, HtmlTag> getAllTags() {
        if (m_AllTags == null) {
            m_AllTags = new java.util.HashMap<String, HtmlTag>();
            createAllTags();
        }
        return m_AllTags;
    }


    private static void createAllTags() {
        HtmlTag ht;
        ht = new HtmlTag("A", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("ABBR", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("ACRONYM", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("ADDRESS", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("APPLET", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNOREWITHCONTENT.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("AREA", Attrs.of((Attrs.BLOCK.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("B", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("BASE", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("BASEFONT", Attrs.of((Attrs.INLINE.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("BDO", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("BIG", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("BLOCKQUOTE", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("BODY", Attrs.BLOCK);
        ht = new HtmlTag("BR", Attrs.of((Attrs.BLOCK.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("BUTTON", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("CAPTION", Attrs.of((Attrs.TABLEITEM.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("CENTER", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("CITE", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("CODE", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNOREWITHCONTENT.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("COL", Attrs.of((Attrs.TABLEITEM.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("COLGROUP", Attrs.TABLEITEM);
        ht = new HtmlTag("DD", Attrs.BLOCK);
        ht = new HtmlTag("DEL", Attrs.of((Attrs.INLINE.value()) | (Attrs.IGNOREWITHCONTENT.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("DFN", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("DIR", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("DIV", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("DL", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("DT", Attrs.INLINE);
        ht = new HtmlTag("EM", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("FIELDSET", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("FONT", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("FORM", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("FRAME", Attrs.of((Attrs.BLOCK.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("FRAMESET", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("H1", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("H2", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("H3", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("H4", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("H5", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("H6", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("HEAD", Attrs.BLOCK);
        ht = new HtmlTag("HR", Attrs.of((Attrs.BLOCK.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("HTML", Attrs.BLOCK);
        ht = new HtmlTag("I", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("IFRAME", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("IMG", Attrs.of((Attrs.INLINE.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("INPUT", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("INS", Attrs.of((Attrs.INLINE.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("ISINDEX", Attrs.of((Attrs.CONTROL.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("KBD", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("LABEL", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("LEGEND", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("LI", Attrs.BLOCK);
        ht = new HtmlTag("LINK", Attrs.of((Attrs.CONTROL.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("MAP", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("MENU", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("META", Attrs.of((Attrs.CONTROL.value()) | (Attrs.EMPTY.value())));
        ht = new HtmlTag("NOFRAMES", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("NOSCRIPT", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("OBJECT", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNOREWITHCONTENT.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("OL", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("OPTGROUP", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("OPTION", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value())));
        ht = new HtmlTag("P", Attrs.BLOCK);
        ht = new HtmlTag("PARAM", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNOREWITHCONTENT.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("PRE", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("Q", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("S", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("SAMP", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("SCRIPT", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNOREWITHCONTENT.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("SELECT", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("SMALL", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("SPAN", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("STRIKE", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("STRONG", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("STYLE", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNOREWITHCONTENT.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("SUB", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("SUP", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("TABLE", Attrs.of((Attrs.TABLEITEM.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("TBODY", Attrs.TABLEITEM);
        ht = new HtmlTag("TD", Attrs.TABLEITEM);
        ht = new HtmlTag("TFOOT", Attrs.TABLEITEM);
        ht = new HtmlTag("TH", Attrs.TABLEITEM);
        ht = new HtmlTag("THEAD", Attrs.TABLEITEM);
        ht = new HtmlTag("TR", Attrs.TABLEITEM);
        ht = new HtmlTag("TEXTAREA", Attrs.of((Attrs.CONTROL.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("TITLE", Attrs.of((Attrs.CONTROL.value()) | (Attrs.IGNORETHIS.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("TT", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("U", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("UL", Attrs.of((Attrs.BLOCK.value()) | (Attrs.ENDTAGREQ.value())));
        ht = new HtmlTag("VAR", Attrs.of((Attrs.INLINE.value()) | (Attrs.ENDTAGREQ.value())));
    }

    public static class Attrs implements Comparable<Attrs> {
    
        public static final Attrs INLINE; // 1
    
        public static final Attrs BLOCK; // 2
    
        public static final Attrs TABLEITEM; // 4
    
        public static final Attrs CONTROL; // 8
    
        public static final Attrs IGNORETHIS; // 0x10
    
        public static final Attrs IGNOREWITHCONTENT; // 0x20
    
        public static final Attrs EMPTY; // 0x40
    
        public static final Attrs ENDTAGREQ; // 0x80
    
    
        public int value() { return m_val; }
        private int m_val;
        private String m_str;
        private Attrs(int val, String str) { m_val = val; m_str = str; }
        @Override
        public String toString() {
            if(m_str != null) return m_str;
            return ((Integer)m_val).toString();
        }
        @Override
        public int hashCode() {
            return (int)m_val;
        }
        @Override
        public int compareTo(Attrs v) {
            if(m_val < v.m_val) return -1;
            if(m_val > v.m_val) return 1;
            return 0;
        }
        private static java.util.HashMap<Integer, Attrs> mapIntToEnum; 
        private static java.util.HashMap<String, Attrs> mapStringToEnum; 
        private static Attrs[] m_Values; 
        private static java.util.Collection<Integer> m_Keys; 
        public static Attrs of(int val) {
            if (mapIntToEnum.containsKey(val)) return mapIntToEnum.get(val);
            Attrs item = new Attrs(val, ((Integer)val).toString());
            mapIntToEnum.put(val, item);
            mapStringToEnum.put(item.m_str.toUpperCase(), item);
            return item; 
        }
        public static Attrs of(String str) {
            str = str.toUpperCase(); 
            if (mapStringToEnum.containsKey(str)) return mapStringToEnum.get(str);
            return null; 
        }
        public static boolean isDefined(Object val) {
            if(val instanceof Integer) return m_Keys.contains((Integer)val); 
            return false; 
        }
        public static Attrs[] getValues() {
            return m_Values; 
        }
        static {
            mapIntToEnum = new java.util.HashMap<Integer, Attrs>();
            mapStringToEnum = new java.util.HashMap<String, Attrs>();
            INLINE = new Attrs(1, "INLINE");
            mapIntToEnum.put(INLINE.value(), INLINE);
            mapStringToEnum.put(INLINE.m_str.toUpperCase(), INLINE);
            BLOCK = new Attrs(2, "BLOCK");
            mapIntToEnum.put(BLOCK.value(), BLOCK);
            mapStringToEnum.put(BLOCK.m_str.toUpperCase(), BLOCK);
            TABLEITEM = new Attrs(4, "TABLEITEM");
            mapIntToEnum.put(TABLEITEM.value(), TABLEITEM);
            mapStringToEnum.put(TABLEITEM.m_str.toUpperCase(), TABLEITEM);
            CONTROL = new Attrs(8, "CONTROL");
            mapIntToEnum.put(CONTROL.value(), CONTROL);
            mapStringToEnum.put(CONTROL.m_str.toUpperCase(), CONTROL);
            IGNORETHIS = new Attrs(0x10, "IGNORETHIS");
            mapIntToEnum.put(IGNORETHIS.value(), IGNORETHIS);
            mapStringToEnum.put(IGNORETHIS.m_str.toUpperCase(), IGNORETHIS);
            IGNOREWITHCONTENT = new Attrs(0x20, "IGNOREWITHCONTENT");
            mapIntToEnum.put(IGNOREWITHCONTENT.value(), IGNOREWITHCONTENT);
            mapStringToEnum.put(IGNOREWITHCONTENT.m_str.toUpperCase(), IGNOREWITHCONTENT);
            EMPTY = new Attrs(0x40, "EMPTY");
            mapIntToEnum.put(EMPTY.value(), EMPTY);
            mapStringToEnum.put(EMPTY.m_str.toUpperCase(), EMPTY);
            ENDTAGREQ = new Attrs(0x80, "ENDTAGREQ");
            mapIntToEnum.put(ENDTAGREQ.value(), ENDTAGREQ);
            mapStringToEnum.put(ENDTAGREQ.m_str.toUpperCase(), ENDTAGREQ);
            java.util.Collection<Attrs> col = mapIntToEnum.values();
            m_Values = new Attrs[col.size()];
            col.toArray(m_Values);
            m_Keys = new java.util.ArrayList<Integer>(mapIntToEnum.keySet());
        }
    }

    public HtmlTag() {
    }
    public static HtmlTag _globalInstance;
    
    static {
        try { _globalInstance = new HtmlTag(); } 
        catch(Exception e) { }
    }
}
