import HasSettings from './HasSettings';

export default abstract class Controller<ValueType, SettingsType> extends HasSettings<SettingsType> {
  time: number;
  initialize? (): void;

  constructor (givenSettings?: SettingsType) {
    super(givenSettings);
    this.time = 0;
    if (this.initialize) {
      this.initialize();
    }
  }

  abstract calculateValue(): ValueType;
  process() {
    const result = this.calculateValue();
    this.time ++;
    return result;
  }
}
