blob: b3524c163db6d6d01e7956790df5dd4a900959b3 (
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
|
import { inject, injectable } from "tsyringe";
import Operator from "../Operator";
import OperatorFactoryChain from "../OperatorFactoryChain";
import FindNextOperator from "./FindNextOperator";
import FindPrevOperator from "./FindPrevOperator";
import FindMasterClient from "../../client/FindMasterClient";
import * as operations from "../../../shared/operations";
@injectable()
export default class FindOperatorFactoryChain implements OperatorFactoryChain {
constructor(
@inject("FindMasterClient")
private readonly findMasterClient: FindMasterClient
) {}
create(op: operations.Operation, repeat: number): Operator | null {
switch (op.type) {
case operations.FIND_NEXT:
return new FindNextOperator(this.findMasterClient, repeat);
case operations.FIND_PREV:
return new FindPrevOperator(this.findMasterClient, repeat);
}
return null;
}
}
|