# All files / src/custom-nodes Node.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49

    1x

    27x

    54x

    21x

     import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
    import { INode } from '../interfaces/nodes/INode';
    import { IOptions } from "../interfaces/IOptions";

    import { AppendState } from '../enums/AppendState';

    export abstract class Node implements ICustomNode {
        /**
         * @type {AppendState}
         */
        protected abstract appendState: AppendState;

        /**
         * @type {IOptions}
         */
        protected options: IOptions;

        /**
         * @param options
         */
        constructor (options: IOptions) {
            this.options = options;
        }

        /**
         * @param astTree
         */
        public abstract appendNode (astTree: INode): void;

        /**
         * @returns {AppendState}
         */
        public getAppendState (): AppendState {
            return this.appendState;
        }

        /**
         * @returns {INode}
         */
        public getNode (): INode {
            return this.getNodeStructure();
        }

        /**
         * @returns {INode}
         */
        protected abstract getNodeStructure (): INode;
    }