blob: a9312095a934038b85cc02daa4dd551718d5afe2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import { inject, injectable } from "tsyringe";
import Operator from "../Operator";
import OperatorFactoryChain from "../OperatorFactoryChain";
import RepeatLastOperator from "./RepeatLastOperator";
import RepeatRepository from "../../repositories/RepeatRepository";
import OperatorFactory from "../OperatorFactory";
import * as operations from "../../../shared/operations";
@injectable()
export default class RepeatOperatorFactoryChain
implements OperatorFactoryChain
{
constructor(
@inject("RepeatRepository")
private readonly repeatRepository: RepeatRepository,
@inject("OperatorFactory")
private readonly operatorFactory: OperatorFactory
) {}
create(op: operations.Operation): Operator | null {
switch (op.type) {
case operations.REPEAT_LAST:
return new RepeatLastOperator(
this.repeatRepository,
this.operatorFactory
);
}
return null;
}
}
|