| 6 | |
| 7 | /** Manages currently selected weight service. */ |
| 8 | export default class WeightServiceManager { |
| 9 | |
| 10 | private weightServices: { [key: string]: WeightService }; |
| 11 | private weightService: WeightService; |
| 12 | |
| 13 | constructor(graphManager: GraphManager) { |
| 14 | // Add bindings count as the default service. |
| 15 | this.weightServices = {}; |
| 16 | this.weightService = this.weightServices['bindings'] = new BindingsService(graphManager); |
| 17 | |
| 18 | // TODO: Separate services into a config file. |
| 19 | if (graphManager.classInfo && Object.keys(graphManager.classInfo).length) { |
| 20 | const classSizeService = new ClassSizeService(graphManager.classInfo); |
| 21 | this.weightServices['class memory'] = classSizeService; |
| 22 | this.weightServices['graph memory'] = new GraphSizeService(graphManager, classSizeService); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | getWeightServiceNames(): Array<string> { |
| 27 | return Object.keys(this.weightServices).sort(); |
| 28 | } |
| 29 | |
| 30 | getWeightService(): WeightService { |
| 31 | return this.weightService; |
| 32 | } |
| 33 | |
| 34 | selectWeightService(weight: string) { |
| 35 | this.weightService = this.weightServices[weight]; |
| 36 | } |
| 37 | } |
nothing calls this directly
no outgoing calls
no test coverage detected