blob: cc169ddc90e1905ecdec86ded46601612a21ac12 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
import { inject, injectable } from "tsyringe";
import Operator from "../Operator";
import OperatorFactoryChain from "../OperatorFactoryChain";
import TabPresenter from "../../presenters/TabPresenter";
import * as operations from "../../../shared/operations";
import FindNextOperator from "./FindNextOperator";
import FindPrevOperator from "./FindPrevOperator";
import FindRepository from "../../repositories/FindRepository";
import FindClient from "../../clients/FindClient";
import ConsoleClient from "../../infrastructures/ConsoleClient";
import ReadyFrameRepository from "../../repositories/ReadyFrameRepository";
@injectable()
export default class FindOperatorFactoryChain implements OperatorFactoryChain {
constructor(
@inject("TabPresenter")
private readonly tabPresenter: TabPresenter,
@inject("FindRepository")
private readonly findRepository: FindRepository,
@inject("FindClient")
private readonly findClient: FindClient,
@inject("ConsoleClient")
private readonly consoleClient: ConsoleClient,
@inject("ReadyFrameRepository")
private readonly frameRepository: ReadyFrameRepository
) {}
create(op: operations.Operation): Operator | null {
switch (op.type) {
case operations.FIND_NEXT:
return new FindNextOperator(
this.tabPresenter,
this.findRepository,
this.findClient,
this.consoleClient,
this.frameRepository
);
case operations.FIND_PREV:
return new FindPrevOperator(
this.tabPresenter,
this.findRepository,
this.findClient,
this.consoleClient,
this.frameRepository
);
}
return null;
}
}
|