1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import { ICustomNode } from '../interfaces/ICustomNode';
- import { INode } from '../interfaces/nodes/INode';
- import { IOptions } from "../interfaces/IOptions";
- import { AppendState } from '../enums/AppendState';
- import { NodeUtils } from "../NodeUtils";
- export abstract class Node implements ICustomNode {
- /**
- * @type {AppendState}
- */
- protected appendState: AppendState = AppendState.BeforeObfuscation;
- /**
- * @type {INode}
- */
- protected node: INode;
- /**
- * @type {IOptions}
- */
- protected options: IOptions;
- /**
- * @param options
- */
- constructor (options: IOptions = {}) {
- this.options = options;
- }
- public abstract appendNode (astTree: INode): void;
- /**
- * @returns {AppendState}
- */
- public getAppendState (): AppendState {
- return this.appendState;
- }
- /**
- * @returns any
- */
- public getNode (): INode {
- NodeUtils.parentize(this.node);
- return this.node;
- }
- /**
- * @param node
- */
- public setNode (node: INode): void {
- this.node = node;
- }
- public updateNode (): void {
- this.node = this.getNodeStructure();
- }
- /**
- * @returns any
- */
- protected abstract getNodeStructure (): any;
- }
|