Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 6x 6x 6x 6x 13x 15x 6x 8x 1x | import { RootFinderMethod, IRootFinder, RootFinderOptions } from '../definition'
import { BisectionRootFinder } from '../bisection'
import { NewtonRootFinder } from '../newton'
export interface IRootFinderConstructor {
new (options: RootFinderOptions): IRootFinder
}
export class RootFinderFactory {
constructor(private readonly options: RootFinderOptions) {}
public make(method: RootFinderMethod): IRootFinder {
switch (method) {
case RootFinderMethod.Bisection:
return new BisectionRootFinder(this.options)
case RootFinderMethod.Newton:
return new NewtonRootFinder(this.options)
default:
throw new Error(`RootFinderFactory ${method} not implemented.`)
}
}
}
|