-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathclass_tableListMod.ahk
48 lines (39 loc) · 1.16 KB
/
class_tableListMod.ahk
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
/* Modification class for parsing lists.
*/
global MODOP_REPLACE := "r"
global MODOP_BEGIN := "b"
global MODOP_END := "e"
class TableListMod {
bit := 1
operation := ""
text := ""
label := 0
__New(b, o, t, l) {
this.bit := b
this.operation := o
this.text := t
this.label := l
}
; Actually do what this mod describes to the given row.
executeMod(rowBits, temp = false) {
rowBit := rowBits[this.bit]
if(this.operation = MODOP_REPLACE)
outBit := this.text
else if(this.operation = MODOP_BEGIN)
outBit := this.text rowBit
else if(this.operation = MODOP_END)
outBit := rowBit this.text
; DEBUG.popup("Row bits", rowBits, "Row bit to modify", rowBit, "Operation", this.operation, "Text", this.text, "Result", outBit, "Begin", MODOP_BEGIN)
; Put the bit back into the full row.
rowBits[this.bit] := outBit
return rowBits
}
; Debug info
debugName := "TableListMod"
debugToString(debugBuilder) {
debugBuilder.addLine("Bit", this.bit)
debugBuilder.addLine("Operation", this.operation)
debugBuilder.addLine("Text", this.text)
debugBuilder.addLine("Label", this.label)
}
}