You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
622 B
15 lines
622 B
import { AnalyticUnit, DetectorType } from './analytic_unit'; |
|
import { PatternAnalyticUnit } from './pattern_analytic_unit'; |
|
import { ThresholdAnalyticUnit } from './threshold_analytic_unit'; |
|
|
|
export function createAnalyticUnit(serverObject: any): AnalyticUnit { |
|
const detectorType: DetectorType = serverObject.detectorType; |
|
switch(detectorType) { |
|
case DetectorType.PATTERN: |
|
return new PatternAnalyticUnit(serverObject); |
|
case DetectorType.THRESHOLD: |
|
return new ThresholdAnalyticUnit(serverObject); |
|
default: |
|
throw new Error(`Can't create analytic unit with type "${detectorType}"`); |
|
} |
|
}
|
|
|