import { ResourceAmount } from '@src/Tools/Production/Result/ResourceAmount' ; import { GraphEdge } from '@src/Tools/Production/Result/Edges/GraphEdge' ; import { IVisNode } from '@src/Tools/Production/Result/IVisNode' ; export abstract class GraphNode { public id : number ; public connectedEdges : GraphEdge [ ] = [ ] ; public abstract getInputs ( ) ; public abstract getOutputs ( ) ; public abstract getTitle ( ) ; public abstract getTooltip ( ) ; public abstract getVisNode ( ) ; public hasOutputTo ( target ) { for ( const edge of this . connectedEdges ) { if ( edge . from === this && edge . to === target ) { return true ; } } return false ; } protected formatText ( text , bold = true ) { const parts = text . split ( ' ' ) ; if ( parts . length >= 4 ) { parts . splice ( Math . ceil ( parts . length / 2 ) , 0 , bold ? '</b>\n<b>' : '\n' ) ; } return bold ? ( '<b>' + parts . join ( ' ' ) + '</b>' ) : parts . join ( ' ' ) ; } }