/* * Copyright (C) Sapphirecode - All Rights Reserved * This file is part of graphviz-builder which is released under MIT. * See file 'LICENSE' for full license details. * Created by Timo Hocker , May 2020 */ import { validate_name } from '../Helper'; export class Element { private _name = ''; protected parent_name: string; public get full_name (): string { if (this.parent_name) return `${this.parent_name}_${this.name}`; return this.name; } public get name (): string { return this._name; } public set name (val: string) { this._name = validate_name (val); } public get parent (): string { return this.parent_name; } public constructor (name: string, parent = '') { this.name = name; this.parent_name = parent; } // eslint-disable-next-line @typescript-eslint/naming-convention public toString (): string { return this.full_name; } }