-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaselineNotation.ts
69 lines (51 loc) · 1.69 KB
/
BaselineNotation.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
'use strict'
import { InterchangeSerdeOpt } from './InterchangeSerdeOpt'
export class BaselineNotation {
constructor (header?: string[], options?: InterchangeSerdeOpt) {
this.header = header === undefined ? new Array<string>() : header
this.options = options === undefined ? {} : options
this.functionalGroups = new Array<BaselineFunctionalGroup>()
}
options?: InterchangeSerdeOpt
header: string[]
functionalGroups: BaselineFunctionalGroup[]
addFunctionalGroup (header: string[]): BaselineFunctionalGroup {
const functionalGroup = new BaselineFunctionalGroup(header)
this.functionalGroups.push(functionalGroup)
return functionalGroup
}
}
export class BaselineFunctionalGroup {
constructor (header?: string[]) {
this.header = header === undefined ? new Array<string>() : header
this.transactions = new Array<BaselineTransaction>()
}
header: string[]
transactions: BaselineTransaction[]
addTransaction (header: string[]): BaselineTransaction {
const transaction = new BaselineTransaction(header)
this.transactions.push(transaction)
return transaction
}
}
export class BaselineTransaction {
constructor (header?: string[]) {
this.header = header === undefined ? new Array<string>() : header
this.segments = new Array<BaselineSegment>()
}
header: string[]
segments: BaselineSegment[]
addSegment (tag: string, elements: string[]): BaselineSegment {
const segment = new BaselineSegment(tag, elements)
this.segments.push(segment)
return segment
}
}
export class BaselineSegment {
constructor (tag: string, elements: string[]) {
this.tag = tag
this.elements = elements
}
tag: string
elements: string[]
}