This repository has been archived by the owner on May 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CartridgeSlotBuilder.ts
81 lines (72 loc) · 2.38 KB
/
CartridgeSlotBuilder.ts
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { CartridgeSlotInterface } from '../nodes/CartridgeSlotInterface'
import { CartridgeSlotFactory } from '../factories/CartridgeSlotFactory'
/**
* A builder for [[CartridgeSlotInterface]]s
*/
export class CartridgeSlotBuilder {
private _cartridgeInsertionPoint: CartridgeSlotInterface
constructor () {
this._cartridgeInsertionPoint = new CartridgeSlotFactory().create()
}
/**
* Set the isCollector parameter of the [[CartridgeSlotInterface]]
* @param {boolean} isCollector
* @return {CartridgeSlotBuilder}
*/
public withIsCollector (isCollector: boolean): CartridgeSlotBuilder {
this._cartridgeInsertionPoint.isCollector = isCollector
return this
}
/**
* Set the cartridgeName parameter of the [[CartridgeSlotInterface]]
* @param {string} cartridgeName
* @return {CartridgeSlotBuilder}
*/
public withCartridgeName (cartridgeName: string): CartridgeSlotBuilder {
this._cartridgeInsertionPoint.cartridgeName = cartridgeName
return this
}
/**
* Set the cartridgePattern parameter of the [[CartridgeSlotInterface]]
* @param {string | RegExp} cartridgePattern
* @return {CartridgeSlotBuilder}
*/
public withCartridgePattern (cartridgePattern: string | RegExp): CartridgeSlotBuilder {
this._cartridgeInsertionPoint.cartridgePattern = cartridgePattern
return this
}
/**
* Set the index parameter of the [[CartridgeSlotInterface]]
* @param {number} index
* @return {CartridgeSlotBuilder}
*/
public withIndex (index: number): CartridgeSlotBuilder {
this._cartridgeInsertionPoint.index = index
return this
}
/**
* Set the maxDepth parameter of the [[CartridgeSlotInterface]]
* @param {number} maxDepth
* @return {CartridgeSlotBuilder}
*/
public withMaxDepth (maxDepth: number): CartridgeSlotBuilder {
this._cartridgeInsertionPoint.maxDepth = maxDepth
return this
}
/**
* Set the cartridgeContent parameter of the [[CartridgeSlotInterface]]
* @param {string} cartridgeContent
* @return {CartridgeSlotBuilder}
*/
public withCartridgeContent (cartridgeContent: string): CartridgeSlotBuilder {
this._cartridgeInsertionPoint.cartridgeContent = cartridgeContent
return this
}
/**
* Assemble the [[CartridgeSlotInterface]] and return it
* @return {CartridgeSlotInterface}
*/
public build (): CartridgeSlotInterface {
return this._cartridgeInsertionPoint
}
}