import { EdgeStyles } from './Styles'; import { Color } from './Color'; export class Edge { public origin: string; public target: string; public style?: EdgeStyles; public color?: Color; public constructor (origin: string, target: string) { this.origin = origin; this.target = target; } // eslint-disable-next-line @typescript-eslint/naming-convention public toString (): string { const attributes = []; if (this.style) attributes.push ({ name: 'style', value: this.style.toString () }); if (this.color) attributes.push ({ name: 'color', value: this.color.toString () }); const attr_string = ` [${attributes.map ((v) => `${v.name}="${v.value}"`) .join (',')}]`; return `${this.origin} -> ${this.target}${attributes.length > 0 ? attr_string : ''}`; } }