import {Graph} from "./graph"; import {SerializableItem} from "../helper/serializableitem"; export class GraphElement extends SerializableItem { protected isNode: boolean; protected isLink: boolean; public graph: Graph; constructor(graph: Graph = undefined) { super(); this.graph = graph; this.isNode = false; this.isLink = false; } public get node(): boolean { return this.isNode; } public get link(): boolean { return this.isLink; } /** * Removes element from its parent graph. * @returns True, if successful. */ public delete(): boolean { throw new Error("Function \"delete()\" has not been implemented."); } /** * Adds the element to the given graph. * @param graph Graph to add element to. * @returns True, if successful. */ public add(graph: Graph = this.graph): boolean { throw new Error("Function \"add(graph)\" has not been implemented."); } /** * Needs to be implemented to create a filtered version for storing in the data history. * @returns Filtered object. */ public getCleanInstance(): any { throw new Error("Function \"getCleanInstance()\" has not been implemented."); } }