001package Torello.Browser.JsonAST;
002
003import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg;
004
005import Torello.Java.ReadOnly.ReadOnlySet;
006
007import javax.json.JsonObject;
008
009/**
010 * Class {@code TCE} serves as the common denominator for three inheriting, child classes: 
011 * {@link TypeNode}, {@link CommandNode} & {@link EventNode}.
012 * 
013 * <EMBED CLASS='external-html' DATA-FILE-ID=AST_TREES>
014 */
015@JDHeaderBackgroundImg(EmbedTagFileID="AST_NODES_JDHBI")
016public abstract class TCE extends Entity implements java.io.Serializable
017{
018    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
019    protected static final long serialVersionUID = 1;
020
021    /**
022     * Contains a simple 'enum' constant which Indicates whether {@code 'this'} TCE instance has
023     * been parsed a {@code "types", "commands"} or an {@code "events"} array.
024     */
025    public final WhichTCE which;
026
027    // Constructs a class that represents a Java-Script 'type', 'command' or 'event'
028    TCE(
029            final Domain                ownerDomain,
030            final JsonObject            jo,
031            final WhichTCE              which,
032            final ReadOnlySet<String>   extraAllowedJsonPropNames,
033            final int                   index
034        )
035    {
036        super(
037            ownerDomain,
038            WhichEntity.ClassTCE,
039            jo,
040            index,
041            extraAllowedJsonPropNames
042        );
043
044        this.which = which;
045    }
046
047    /** An abbreviated {@code String} representation of this class. */
048    public String toStringShort()
049    {
050        return
051            this.ownerDomain.ownerAPI.name + '.' +  // API-Name
052            this.ownerDomain.name + '.' +           // Domain-Name
053            this.name + ' ' +                       // TCE-Name
054            "[#" + this.id + ", WhichTCE." + this.which + ']';
055    }
056}