@nfdi4plants/arctrl 3.0.0-alpha.4 → 3.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +16 -8
  2. package/dist/ts/cjs/ts/ARC.js +31 -20
  3. package/dist/ts/cjs/ts/Conversion.js +122 -76
  4. package/dist/ts/cjs/ts/Core/ArcTypes.js +1 -1
  5. package/dist/ts/cjs/ts/Core/Conversion.js +110 -43
  6. package/dist/ts/cjs/ts/Core/Data.js +4 -2
  7. package/dist/ts/cjs/ts/Core/Helper/Collections.js +69 -1
  8. package/dist/ts/cjs/ts/Core/OntologyAnnotation.js +27 -23
  9. package/dist/ts/cjs/ts/Core/Table/ArcTable.js +234 -217
  10. package/dist/ts/cjs/ts/Core/Table/ArcTableAux.js +904 -255
  11. package/dist/ts/cjs/ts/Core/Table/ArcTables.js +12 -19
  12. package/dist/ts/cjs/ts/Core/Table/CompositeColumn.js +4 -2
  13. package/dist/ts/cjs/ts/FileSystem/DefaultGitattributes.js +1 -1
  14. package/dist/ts/cjs/ts/Json/Decode.js +105 -0
  15. package/dist/ts/cjs/ts/Json/Encode.js +42 -0
  16. package/dist/ts/cjs/ts/Json/Table/ArcTable.js +100 -113
  17. package/dist/ts/cjs/ts/Json.js +46 -1
  18. package/dist/ts/cjs/ts/ROCrateIO.js +12 -1
  19. package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/ArcTable.js +15 -4
  20. package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +77 -6
  21. package/dist/ts/cjs/ts/Spreadsheet/ArcInvestigation.js +31 -15
  22. package/dist/ts/cjs/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
  23. package/dist/ts/cjs/ts/Spreadsheet/Metadata/SparseTable.js +2 -5
  24. package/dist/ts/esm/ts/ARC.js +34 -23
  25. package/dist/ts/esm/ts/Conversion.js +128 -82
  26. package/dist/ts/esm/ts/Core/ArcTypes.js +1 -1
  27. package/dist/ts/esm/ts/Core/Conversion.js +112 -45
  28. package/dist/ts/esm/ts/Core/Data.js +7 -5
  29. package/dist/ts/esm/ts/Core/Helper/Collections.js +61 -1
  30. package/dist/ts/esm/ts/Core/OntologyAnnotation.js +29 -25
  31. package/dist/ts/esm/ts/Core/Table/ArcTable.js +243 -226
  32. package/dist/ts/esm/ts/Core/Table/ArcTableAux.js +897 -264
  33. package/dist/ts/esm/ts/Core/Table/ArcTables.js +15 -22
  34. package/dist/ts/esm/ts/Core/Table/CompositeColumn.js +5 -3
  35. package/dist/ts/esm/ts/FileSystem/DefaultGitattributes.js +1 -1
  36. package/dist/ts/esm/ts/Json/Decode.js +105 -3
  37. package/dist/ts/esm/ts/Json/Encode.js +42 -2
  38. package/dist/ts/esm/ts/Json/Table/ArcTable.js +108 -121
  39. package/dist/ts/esm/ts/Json.js +39 -0
  40. package/dist/ts/esm/ts/ROCrateIO.js +14 -3
  41. package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/ArcTable.js +17 -7
  42. package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +78 -9
  43. package/dist/ts/esm/ts/Spreadsheet/ArcInvestigation.js +33 -17
  44. package/dist/ts/esm/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
  45. package/dist/ts/esm/ts/Spreadsheet/Metadata/SparseTable.js +3 -6
  46. package/dist/ts/types/ts/ARC.d.ts +2 -2
  47. package/dist/ts/types/ts/ARC.d.ts.map +1 -1
  48. package/dist/ts/types/ts/Conversion.d.ts +15 -16
  49. package/dist/ts/types/ts/Conversion.d.ts.map +1 -1
  50. package/dist/ts/types/ts/Core/ArcTypes.d.ts +2 -0
  51. package/dist/ts/types/ts/Core/ArcTypes.d.ts.map +1 -1
  52. package/dist/ts/types/ts/Core/Conversion.d.ts +14 -15
  53. package/dist/ts/types/ts/Core/Conversion.d.ts.map +1 -1
  54. package/dist/ts/types/ts/Core/Data.d.ts.map +1 -1
  55. package/dist/ts/types/ts/Core/Helper/Collections.d.ts +8 -0
  56. package/dist/ts/types/ts/Core/Helper/Collections.d.ts.map +1 -1
  57. package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts +9 -0
  58. package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts.map +1 -1
  59. package/dist/ts/types/ts/Core/Table/ArcTable.d.ts +35 -28
  60. package/dist/ts/types/ts/Core/Table/ArcTable.d.ts.map +1 -1
  61. package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts +83 -35
  62. package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts.map +1 -1
  63. package/dist/ts/types/ts/Core/Table/ArcTables.d.ts.map +1 -1
  64. package/dist/ts/types/ts/Core/Table/CompositeColumn.d.ts.map +1 -1
  65. package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts +1 -1
  66. package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts.map +1 -1
  67. package/dist/ts/types/ts/Json/Decode.d.ts +6 -0
  68. package/dist/ts/types/ts/Json/Decode.d.ts.map +1 -1
  69. package/dist/ts/types/ts/Json/Encode.d.ts +2 -0
  70. package/dist/ts/types/ts/Json/Encode.d.ts.map +1 -1
  71. package/dist/ts/types/ts/Json/Table/ArcTable.d.ts +4 -3
  72. package/dist/ts/types/ts/Json/Table/ArcTable.d.ts.map +1 -1
  73. package/dist/ts/types/ts/Json.d.ts +17 -0
  74. package/dist/ts/types/ts/Json.d.ts.map +1 -1
  75. package/dist/ts/types/ts/ROCrateIO.d.ts +1 -1
  76. package/dist/ts/types/ts/ROCrateIO.d.ts.map +1 -1
  77. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts +5 -0
  78. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts.map +1 -1
  79. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts +7 -0
  80. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts.map +1 -1
  81. package/dist/ts/types/ts/Spreadsheet/ArcInvestigation.d.ts.map +1 -1
  82. package/dist/ts/types/ts/Spreadsheet/Metadata/SparseTable.d.ts.map +1 -1
  83. package/package.json +1 -1
@@ -1,131 +1,140 @@
1
- import { CompositeHeader_ProtocolREF, CompositeHeader_ProtocolDescription, CompositeHeader_ProtocolUri, CompositeHeader_ProtocolVersion, CompositeHeader_ProtocolType } from "./CompositeHeader.js";
2
- import { boxHashValues, Unchecked_alignByHeaders, Unchecked_extendToRowCount, Unchecked_removeRowCells_withIndexChange, Unchecked_addRows, Unchecked_addRow, Unchecked_getEmptyCellForHeader, Unchecked_moveColumnTo, Unchecked_removeColumnCells_withIndexChange, tryFindDuplicateUniqueInArray, Unchecked_removeColumnCells, Unchecked_removeHeader, Unchecked_fillMissingCells, Unchecked_addColumn, SanityChecks_validateColumn, tryFindDuplicateUnique, Unchecked_setCellAt, SanityChecks_validateRowIndex, SanityChecks_validateColumnIndex, Unchecked_tryGetCellAt, getRowCount, getColumnCount, SanityChecks_validate } from "./ArcTableAux.js";
3
- import { compareArrays, safeHash, comparePrimitives, equals, disposeSafe, getEnumerator, arrayHash, equalArrays } from "@fable-org/fable-library-js/Util.js";
1
+ import { safeHash, equals, comparePrimitives, disposeSafe, getEnumerator } from "@fable-org/fable-library-js/Util.js";
4
2
  import { CompositeCell_FreeText, CompositeCell_Term, CompositeCell } from "./CompositeCell.js";
5
- import { Dictionary } from "@fable-org/fable-library-js/MutableMap.js";
6
- import { map as map_2, value as value_3, unwrap, defaultArg } from "@fable-org/fable-library-js/Option.js";
7
- import { item as item_1, fold, append as append_1, toList, indexed as indexed_1, choose, filter, length, tryFindIndex, empty, singleton, collect, removeAt, iterate, map, delay, toArray } from "@fable-org/fable-library-js/Seq.js";
3
+ import { SanityChecks_validateCellColumns, Unchecked_alignByHeaders, Unchecked_removeRowCells_withIndexChange, Unchecked_addRows, Unchecked_addEmptyRow, Unchecked_addRow, Unchecked_moveColumnTo, getEmptyCellForHeader, Unchecked_removeColumnCells_withIndexChange, tryFindDuplicateUniqueInArray, Unchecked_removeColumnCells, Unchecked_removeHeader, Unchecked_addColumnFill, Unchecked_addColumn, SanityChecks_validateColumn, tryFindDuplicateUnique, Unchecked_setCellAt, Unchecked_getCellWithDefault, SanityChecks_validateRowIndex, SanityChecks_validateColumnIndex, Unchecked_tryGetCellAt, ArcTableValues, SanityChecks_validateArcTableValues } from "./ArcTableAux.js";
4
+ import { CompositeHeader_ProtocolREF, CompositeHeader_ProtocolDescription, CompositeHeader_ProtocolUri, CompositeHeader_ProtocolVersion, CompositeHeader_ProtocolType } from "./CompositeHeader.js";
5
+ import { map as map_1, value as value_3, unwrap, defaultArg } from "@fable-org/fable-library-js/Option.js";
6
+ import { append as append_1, mapIndexed, toList, indexed, choose, singleton, collect, length, tryFindIndex, iterate as iterate_1, removeAt, map, delay, toArray } from "@fable-org/fable-library-js/Seq.js";
8
7
  import { CompositeColumn } from "./CompositeColumn.js";
9
8
  import { rangeDouble } from "@fable-org/fable-library-js/Range.js";
10
- import { ResizeArray_map } from "../Helper/Collections.js";
11
- import { getItemFromDict, addToDict } from "@fable-org/fable-library-js/MapUtil.js";
12
- import { join, printf, toFail } from "@fable-org/fable-library-js/String.js";
13
- import { sortBy, indexed, mapIndexed, item, sortDescending, iterateIndexed, initialize, map as map_1 } from "@fable-org/fable-library-js/Array.js";
14
- import { append, iterate as iterate_1, isEmpty } from "@fable-org/fable-library-js/List.js";
9
+ import { ResizeArray_indexed, ResizeArray_groupBy, ResizeArray_mapi, ResizeArray_choose, ResizeArray_init, ResizeArray_iter, ResizeArray_singleton, ResizeArray_iteri, ResizeArray_map } from "../Helper/Collections.js";
10
+ import { append, iterate, isEmpty } from "@fable-org/fable-library-js/List.js";
15
11
  import { StringBuilder__AppendLine_Z721C83C5, StringBuilder_$ctor } from "@fable-org/fable-library-js/System.Text.js";
16
12
  import { toString } from "@fable-org/fable-library-js/Types.js";
17
- import { Array_groupBy } from "@fable-org/fable-library-js/Seq2.js";
13
+ import { sortDescending } from "@fable-org/fable-library-js/Array.js";
14
+ import { getItemFromDict } from "@fable-org/fable-library-js/MapUtil.js";
15
+ import { join, printf, toFail } from "@fable-org/fable-library-js/String.js";
18
16
  import { boxHashSeq, boxHashArray } from "../Helper/HashCodes.js";
19
17
  import { class_type } from "@fable-org/fable-library-js/Reflection.js";
20
18
  export class ArcTable {
21
- constructor(name, headers, values) {
22
- const valid = SanityChecks_validate(headers, values, true);
23
- this["name@21"] = name;
24
- this["headers@22"] = headers;
25
- this["values@23"] = values;
19
+ constructor(name, headers, columns) {
20
+ const headers_1 = defaultArg(headers, []);
21
+ const columns_1 = defaultArg(columns, []);
22
+ const valid = SanityChecks_validateCellColumns(headers_1, columns_1, true);
23
+ this._values = ArcTableValues.fromCellColumns(columns_1);
24
+ this._name = name;
25
+ this._headers = headers_1;
26
+ }
27
+ get ValueMap() {
28
+ const this$ = this;
29
+ return this$._values.ValueMap;
30
+ }
31
+ set ValueMap(valueMap) {
32
+ const this$ = this;
33
+ this$._values.ValueMap = valueMap;
34
+ }
35
+ get ColumnRefs() {
36
+ const this$ = this;
37
+ return this$._values.Columns;
38
+ }
39
+ set ColumnRefs(internalColumnRefs) {
40
+ const this$ = this;
41
+ this$._values.Columns = internalColumnRefs;
26
42
  }
27
43
  get Headers() {
28
44
  const this$ = this;
29
- return this$["headers@22"];
45
+ return this$._headers;
30
46
  }
31
47
  set Headers(newHeaders) {
32
48
  const this$ = this;
33
- SanityChecks_validate(newHeaders, this$["values@23"], true);
34
- this$["headers@22"] = newHeaders;
49
+ SanityChecks_validateArcTableValues(newHeaders, this$._values, true);
50
+ this$._headers = newHeaders;
35
51
  }
36
52
  get Values() {
37
53
  const this$ = this;
38
- return this$["values@23"];
39
- }
40
- set Values(newValues) {
41
- const this$ = this;
42
- SanityChecks_validate(this$["headers@22"], newValues, true);
43
- this$["values@23"] = newValues;
54
+ return this$._values;
44
55
  }
45
56
  get Name() {
46
57
  const this$ = this;
47
- return this$["name@21"];
58
+ return this$._name;
48
59
  }
49
60
  set Name(newName) {
50
61
  const this$ = this;
51
- this$["name@21"] = newName;
62
+ this$._name = newName;
52
63
  }
53
64
  static create(name, headers, values) {
54
65
  return new ArcTable(name, headers, values);
55
66
  }
56
67
  static init(name) {
57
- return new ArcTable(name, [], new Dictionary([], {
58
- Equals: equalArrays,
59
- GetHashCode: arrayHash,
60
- }));
61
- }
62
- static createFromHeaders(name, headers) {
63
- return ArcTable.create(name, headers, new Dictionary([], {
64
- Equals: equalArrays,
65
- GetHashCode: arrayHash,
66
- }));
68
+ return new ArcTable(name, [], []);
69
+ }
70
+ static fromArcTableValues(name, headers, values) {
71
+ const t = ArcTable.init(name);
72
+ t.Headers = headers;
73
+ t.ValueMap = values.ValueMap;
74
+ t.ColumnRefs = values.Columns;
75
+ t.RowCount = (values.RowCount | 0);
76
+ return t;
67
77
  }
68
78
  static createFromRows(name, headers, rows) {
69
- const t = ArcTable.createFromHeaders(name, headers);
79
+ const t = new ArcTable(name, headers);
70
80
  t.AddRows(rows);
71
81
  return t;
72
82
  }
73
83
  Validate(raiseException) {
74
84
  const this$ = this;
75
85
  const raiseException_1 = defaultArg(raiseException, true);
76
- return SanityChecks_validate(this$.Headers, this$.Values, raiseException_1);
86
+ return SanityChecks_validateArcTableValues(this$.Headers, this$.Values, raiseException_1);
77
87
  }
78
88
  static validate(raiseException) {
79
89
  return (table) => table.Validate(unwrap(raiseException));
80
90
  }
81
91
  get ColumnCount() {
82
92
  const this$ = this;
83
- return getColumnCount(this$.Headers) | 0;
93
+ return this$.Headers.length | 0;
84
94
  }
85
95
  static columnCount(table) {
86
96
  return table.ColumnCount;
87
97
  }
88
98
  get RowCount() {
89
99
  const this$ = this;
90
- return getRowCount(this$.Values) | 0;
100
+ return this$._values.RowCount | 0;
101
+ }
102
+ set RowCount(newRowCount) {
103
+ const this$ = this;
104
+ this$._values.RowCount = (newRowCount | 0);
91
105
  }
92
106
  static rowCount(table) {
93
107
  return table.RowCount;
94
108
  }
109
+ static setRowCount(newRowCount) {
110
+ return (table) => {
111
+ const newTable = table.Copy();
112
+ newTable.RowCount = (newRowCount | 0);
113
+ return newTable;
114
+ };
115
+ }
95
116
  get Columns() {
96
117
  const this$ = this;
97
- return toArray(delay(() => map((i) => this$.GetColumn(i), rangeDouble(0, 1, this$.ColumnCount - 1))));
118
+ return Array.from(toArray(delay(() => map((i) => this$.GetColumn(i), rangeDouble(0, 1, this$.ColumnCount - 1)))));
98
119
  }
99
120
  Copy() {
100
121
  const this$ = this;
101
122
  const nextHeaders = ResizeArray_map((h) => h.Copy(), this$.Headers);
102
- const nextValues = new Dictionary([], {
103
- Equals: equalArrays,
104
- GetHashCode: arrayHash,
105
- });
106
- iterate((tupledArg) => {
107
- const ci = tupledArg[0] | 0;
108
- const ri = tupledArg[1] | 0;
109
- addToDict(nextValues, [ci, ri], getItemFromDict(this$.Values, [ci, ri]).Copy());
110
- }, this$.Values.keys());
111
- return ArcTable.create(this$.Name, nextHeaders, nextValues);
123
+ const nextValues = this$._values.Copy();
124
+ return ArcTable.fromArcTableValues(this$.Name, nextHeaders, nextValues);
112
125
  }
113
126
  TryGetCellAt(column, row) {
114
127
  const this$ = this;
115
- return Unchecked_tryGetCellAt(column, row, this$.Values);
128
+ return Unchecked_tryGetCellAt(column, row, this$._values);
116
129
  }
117
130
  static tryGetCellAt(column, row) {
118
131
  return (table) => table.TryGetCellAt(column, row);
119
132
  }
120
133
  GetCellAt(column, row) {
121
134
  const this$ = this;
122
- try {
123
- return getItemFromDict(this$.Values, [column, row]);
124
- }
125
- catch (matchValue) {
126
- const arg_2 = this$.Name;
127
- return toFail(printf("Unable to find cell for index: (%i, %i) in table %s"))(column)(row)(arg_2);
128
- }
135
+ SanityChecks_validateColumnIndex(column, this$.ColumnCount, false);
136
+ SanityChecks_validateRowIndex(row, this$.RowCount, false);
137
+ return Unchecked_getCellWithDefault(column, row, this$._headers, this$._values);
129
138
  }
130
139
  static getCellAt(column, row) {
131
140
  return (table) => table.GetCellAt(column, row);
@@ -163,7 +172,7 @@ export class ArcTable {
163
172
  SanityChecks_validateRowIndex(rowIndex, this$.RowCount, false);
164
173
  c.ValidateAgainstHeader(this$.Headers[columnIndex], true);
165
174
  }
166
- Unchecked_setCellAt(columnIndex, rowIndex, c, this$.Values);
175
+ Unchecked_setCellAt(columnIndex, rowIndex, c, this$._values);
167
176
  }
168
177
  static updateCellAt(columnIndex, rowIndex, cell, skipValidation) {
169
178
  return (table) => {
@@ -178,7 +187,7 @@ export class ArcTable {
178
187
  SanityChecks_validateColumnIndex(columnIndex, this$.ColumnCount, false);
179
188
  c.ValidateAgainstHeader(this$.Headers[columnIndex], true);
180
189
  }
181
- Unchecked_setCellAt(columnIndex, rowIndex, c, this$.Values);
190
+ Unchecked_setCellAt(columnIndex, rowIndex, c, this$._values);
182
191
  }
183
192
  static setCellAt(columnIndex, rowIndex, cell, skipValidation) {
184
193
  return (table) => {
@@ -190,7 +199,7 @@ export class ArcTable {
190
199
  UpdateCellsBy(f, skipValidation) {
191
200
  const this$ = this;
192
201
  const skipValidation_1 = defaultArg(skipValidation, false);
193
- let enumerator = getEnumerator(this$.Values);
202
+ const enumerator = getEnumerator(this$._values);
194
203
  try {
195
204
  while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
196
205
  const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
@@ -201,7 +210,7 @@ export class ArcTable {
201
210
  if (!skipValidation_1) {
202
211
  newCell.ValidateAgainstHeader(this$.Headers[ci], true);
203
212
  }
204
- Unchecked_setCellAt(ci, ri, newCell, this$.Values);
213
+ Unchecked_setCellAt(ci, ri, newCell, this$._values);
205
214
  }
206
215
  }
207
216
  finally {
@@ -225,7 +234,7 @@ export class ArcTable {
225
234
  if (!skipValidation_1) {
226
235
  newCell.ValidateAgainstHeader(this$.Headers[columnIndex], true);
227
236
  }
228
- Unchecked_setCellAt(columnIndex, rowIndex, newCell, this$.Values);
237
+ Unchecked_setCellAt(columnIndex, rowIndex, newCell, this$._values);
229
238
  }
230
239
  static updateCellBy(columnIndex, rowIndex, f, skipValidation) {
231
240
  return (table) => {
@@ -248,14 +257,14 @@ export class ArcTable {
248
257
  setHeader = (this$.Headers[index] = newHeader);
249
258
  }
250
259
  else if (forceConvertCells_1) {
251
- const convertedCells = newHeader.IsTermColumn ? map_1((c_1) => {
260
+ const convertedCells = newHeader.IsTermColumn ? ResizeArray_map((c_1) => {
252
261
  if (c_1.isFreeText) {
253
262
  return c_1.ToTermCell();
254
263
  }
255
264
  else {
256
265
  return c_1;
257
266
  }
258
- }, c.Cells) : map_1((c_2) => c_2.ToFreeTextCell(), c.Cells);
267
+ }, c.Cells) : ResizeArray_map((c_2) => c_2.ToFreeTextCell(), c.Cells);
259
268
  this$.UpdateColumn(index, newHeader, convertedCells);
260
269
  }
261
270
  else {
@@ -269,17 +278,14 @@ export class ArcTable {
269
278
  return newTable;
270
279
  };
271
280
  }
272
- AddColumn(header, cells, index, forceReplace, skipFillMissing) {
281
+ AddColumn(header, cells, index, forceReplace) {
273
282
  const this$ = this;
274
283
  const index_1 = defaultArg(index, this$.ColumnCount) | 0;
275
284
  const cells_1 = defaultArg(cells, []);
276
285
  const forceReplace_1 = defaultArg(forceReplace, false);
277
286
  SanityChecks_validateColumnIndex(index_1, this$.ColumnCount, true);
278
287
  SanityChecks_validateColumn(CompositeColumn.create(header, cells_1));
279
- Unchecked_addColumn(header, cells_1, index_1, forceReplace_1, false, this$.Headers, this$.Values);
280
- if (!equals(skipFillMissing, true)) {
281
- Unchecked_fillMissingCells(this$.Headers, this$.Values);
282
- }
288
+ Unchecked_addColumn(header, cells_1, index_1, forceReplace_1, false, this$.Headers, this$._values);
283
289
  }
284
290
  static addColumn(header, cells, index, forceReplace) {
285
291
  return (table) => {
@@ -290,8 +296,11 @@ export class ArcTable {
290
296
  }
291
297
  AddColumnFill(header, cell, index, forceReplace) {
292
298
  const this$ = this;
293
- const cells = initialize(this$.RowCount, (_arg) => cell.Copy());
294
- this$.AddColumn(header, cells, unwrap(index), unwrap(forceReplace));
299
+ const index_1 = defaultArg(index, this$.ColumnCount) | 0;
300
+ const forceReplace_1 = defaultArg(forceReplace, false);
301
+ SanityChecks_validateColumnIndex(index_1, this$.ColumnCount, true);
302
+ SanityChecks_validateColumn(CompositeColumn.create(header, [cell]));
303
+ Unchecked_addColumnFill(header, cell, index_1, forceReplace_1, false, this$.Headers, this$._values);
295
304
  }
296
305
  static addColumnFill(header, cell, index, forceReplace) {
297
306
  return (table) => {
@@ -300,7 +309,7 @@ export class ArcTable {
300
309
  return newTable;
301
310
  };
302
311
  }
303
- UpdateColumn(columnIndex, header, cells, skipFillMissing) {
312
+ UpdateColumn(columnIndex, header, cells) {
304
313
  const this$ = this;
305
314
  SanityChecks_validateColumnIndex(columnIndex, this$.ColumnCount, false);
306
315
  const column = CompositeColumn.create(header, unwrap(cells));
@@ -311,14 +320,11 @@ export class ArcTable {
311
320
  throw new Error(`Invalid input. Tried setting unique header \`${header_1}\`, but header of same type already exists at index ${value_3(matchValue)}.`);
312
321
  }
313
322
  Unchecked_removeHeader(columnIndex, this$.Headers);
314
- Unchecked_removeColumnCells(columnIndex, this$.Values);
323
+ Unchecked_removeColumnCells(columnIndex, this$._values);
315
324
  this$.Headers.splice(columnIndex, 0, column.Header);
316
- iterateIndexed((rowIndex, v) => {
317
- Unchecked_setCellAt(columnIndex, rowIndex, v, this$.Values);
325
+ ResizeArray_iteri((rowIndex, v) => {
326
+ Unchecked_setCellAt(columnIndex, rowIndex, v, this$._values);
318
327
  }, column.Cells);
319
- if (!equals(skipFillMissing, true)) {
320
- Unchecked_fillMissingCells(this$.Headers, this$.Values);
321
- }
322
328
  }
323
329
  static updateColumn(columnIndex, header, cells) {
324
330
  return (table) => {
@@ -349,7 +355,7 @@ export class ArcTable {
349
355
  return newTable;
350
356
  };
351
357
  }
352
- AddColumns(columns, index, forceReplace, skipFillMissing) {
358
+ AddColumns(columns, index, forceReplace) {
353
359
  const this$ = this;
354
360
  let index_1 = defaultArg(index, this$.ColumnCount);
355
361
  const forceReplace_1 = defaultArg(forceReplace, false);
@@ -358,29 +364,26 @@ export class ArcTable {
358
364
  if (!isEmpty(duplicates)) {
359
365
  const sb = StringBuilder_$ctor();
360
366
  StringBuilder__AppendLine_Z721C83C5(sb, "Found duplicate unique columns in `columns`.");
361
- iterate_1((x_1) => {
367
+ iterate((x_1) => {
362
368
  StringBuilder__AppendLine_Z721C83C5(sb, `Duplicate \`${x_1.HeaderType}\` at index ${x_1.Index1} and ${x_1.Index2}.`);
363
369
  }, duplicates);
364
370
  throw new Error(toString(sb));
365
371
  }
366
- columns.forEach((x_2) => {
372
+ iterate_1((x_2) => {
367
373
  SanityChecks_validateColumn(x_2);
368
- });
369
- columns.forEach((col) => {
374
+ }, columns);
375
+ iterate_1((col) => {
370
376
  const prevHeadersCount = this$.Headers.length | 0;
371
- Unchecked_addColumn(col.Header, col.Cells, index_1, forceReplace_1, false, this$.Headers, this$.Values);
377
+ Unchecked_addColumn(col.Header, col.Cells, index_1, forceReplace_1, false, this$.Headers, this$._values);
372
378
  if (this$.Headers.length > prevHeadersCount) {
373
379
  index_1 = ((index_1 + 1) | 0);
374
380
  }
375
- });
376
- if (!equals(skipFillMissing, true)) {
377
- Unchecked_fillMissingCells(this$.Headers, this$.Values);
378
- }
381
+ }, columns);
379
382
  }
380
- static addColumns(columns, index, skipFillMissing) {
383
+ static addColumns(columns, index) {
381
384
  return (table) => {
382
385
  const newTable = table.Copy();
383
- newTable.AddColumns(columns, unwrap(index), undefined, unwrap(skipFillMissing));
386
+ newTable.AddColumns(columns, unwrap(index));
384
387
  return newTable;
385
388
  };
386
389
  }
@@ -389,7 +392,7 @@ export class ArcTable {
389
392
  SanityChecks_validateColumnIndex(index, this$.ColumnCount, false);
390
393
  const columnCount = this$.ColumnCount | 0;
391
394
  Unchecked_removeHeader(index, this$.Headers);
392
- Unchecked_removeColumnCells_withIndexChange(index, columnCount, this$.RowCount, this$.Values);
395
+ Unchecked_removeColumnCells_withIndexChange(index, columnCount, this$._values);
393
396
  }
394
397
  static removeColumn(index) {
395
398
  return (table) => {
@@ -417,42 +420,59 @@ export class ArcTable {
417
420
  return newTable;
418
421
  };
419
422
  }
420
- GetColumn(columnIndex) {
423
+ GetColumn(columnIndex, fillDefault) {
421
424
  const this$ = this;
425
+ const fillDefault_1 = defaultArg(fillDefault, false);
422
426
  SanityChecks_validateColumnIndex(columnIndex, this$.ColumnCount, false);
423
427
  const h = this$.Headers[columnIndex];
424
- const cells = toArray(delay(() => collect((i) => {
425
- const matchValue = this$.TryGetCellAt(columnIndex, i);
426
- if (matchValue != null) {
427
- return singleton(value_3(matchValue));
428
+ const cells = [];
429
+ if (this$.RowCount !== 0) {
430
+ const col = getItemFromDict(this$._values.Columns, columnIndex);
431
+ if (col.tag === /* Sparse */ 1) {
432
+ const vals = col.fields[0];
433
+ const emptyCell = getEmptyCellForHeader(h, undefined);
434
+ for (let rowIndex = 0; rowIndex <= (this$.RowCount - 1); rowIndex++) {
435
+ if (vals.has(rowIndex)) {
436
+ void (cells.push(getItemFromDict(this$._values.ValueMap, getItemFromDict(vals, rowIndex))));
437
+ }
438
+ else if (fillDefault_1) {
439
+ void (cells.push(emptyCell));
440
+ }
441
+ else {
442
+ toFail(printf("Could not return column: Unable to find cell for index: (%i, %i)"))(columnIndex)(rowIndex);
443
+ }
444
+ }
428
445
  }
429
446
  else {
430
- toFail(printf("Unable to find cell for index: (%i, %i)"))(columnIndex)(i);
431
- return empty();
447
+ const valueHash = col.fields[0] | 0;
448
+ const c = getItemFromDict(this$._values.ValueMap, valueHash);
449
+ for (let i = 0; i <= (this$.RowCount - 1); i++) {
450
+ void (cells.push(c));
451
+ }
432
452
  }
433
- }, rangeDouble(0, 1, this$.RowCount - 1))));
453
+ }
434
454
  return CompositeColumn.create(h, cells);
435
455
  }
436
- static getColumn(index) {
437
- return (table) => table.GetColumn(index);
456
+ static getColumn(index, fillDefault) {
457
+ return (table) => table.GetColumn(index, unwrap(fillDefault));
438
458
  }
439
- TryGetColumnByHeader(header) {
459
+ TryGetColumnByHeader(header, fillDefault) {
440
460
  const this$ = this;
441
- return map_2((i) => this$.GetColumn(i), tryFindIndex((x) => equals(x, header), this$.Headers));
461
+ return map_1((i) => this$.GetColumn(i, unwrap(fillDefault)), tryFindIndex((x) => equals(x, header), this$.Headers));
442
462
  }
443
- static tryGetColumnByHeader(header) {
444
- return (table) => table.TryGetColumnByHeader(header);
463
+ static tryGetColumnByHeader(header, fillDefault) {
464
+ return (table) => table.TryGetColumnByHeader(header, unwrap(fillDefault));
445
465
  }
446
- TryGetColumnByHeaderBy(headerPredicate) {
466
+ TryGetColumnByHeaderBy(headerPredicate, fillDefault) {
447
467
  const this$ = this;
448
- return map_2((i) => this$.GetColumn(i), tryFindIndex(headerPredicate, this$.Headers));
468
+ return map_1((i) => this$.GetColumn(i, unwrap(fillDefault)), tryFindIndex(headerPredicate, this$.Headers));
449
469
  }
450
- static tryGetColumnByHeaderBy(headerPredicate) {
451
- return (table) => table.TryGetColumnByHeaderBy(headerPredicate);
470
+ static tryGetColumnByHeaderBy(headerPredicate, fillDefault) {
471
+ return (table) => table.TryGetColumnByHeaderBy(headerPredicate, unwrap(fillDefault));
452
472
  }
453
- GetColumnByHeader(header) {
473
+ GetColumnByHeader(header, fillDefault) {
454
474
  const this$ = this;
455
- const matchValue = this$.TryGetColumnByHeader(header);
475
+ const matchValue = this$.TryGetColumnByHeader(header, unwrap(fillDefault));
456
476
  if (matchValue == null) {
457
477
  const arg = this$.Name;
458
478
  return toFail(printf("Unable to find column with header in table %s: %O"))(arg)(header);
@@ -461,12 +481,12 @@ export class ArcTable {
461
481
  return value_3(matchValue);
462
482
  }
463
483
  }
464
- static getColumnByHeader(header) {
465
- return (table) => table.GetColumnByHeader(header);
484
+ static getColumnByHeader(header, fillDefault) {
485
+ return (table) => table.GetColumnByHeader(header, unwrap(fillDefault));
466
486
  }
467
487
  TryGetInputColumn() {
468
488
  const this$ = this;
469
- return map_2((i) => this$.GetColumn(i), tryFindIndex((x) => x.isInput, this$.Headers));
489
+ return map_1((i) => this$.GetColumn(i), tryFindIndex((x) => x.isInput, this$.Headers));
470
490
  }
471
491
  static tryGetInputColumn() {
472
492
  return (table) => table.TryGetInputColumn();
@@ -487,7 +507,7 @@ export class ArcTable {
487
507
  }
488
508
  TryGetOutputColumn() {
489
509
  const this$ = this;
490
- return map_2((i) => this$.GetColumn(i), tryFindIndex((x) => x.isOutput, this$.Headers));
510
+ return map_1((i) => this$.GetColumn(i), tryFindIndex((x) => x.isOutput, this$.Headers));
491
511
  }
492
512
  static tryGetOutputColumn() {
493
513
  return (table) => table.TryGetOutputColumn();
@@ -517,7 +537,7 @@ export class ArcTable {
517
537
  toFail(printf("Cannt move column. Invalid end column index: %i"))(endCol);
518
538
  }
519
539
  else {
520
- Unchecked_moveColumnTo(this$.RowCount, startCol, endCol, this$.Headers, this$.Values);
540
+ Unchecked_moveColumnTo(startCol, endCol, this$.Headers, this$._values);
521
541
  }
522
542
  }
523
543
  static moveColumn(startCol, endCol) {
@@ -530,22 +550,28 @@ export class ArcTable {
530
550
  AddRow(cells, index) {
531
551
  const this$ = this;
532
552
  const index_1 = defaultArg(index, this$.RowCount) | 0;
533
- const cells_1 = (cells == null) ? toArray(delay(() => collect((columnIndex) => singleton(Unchecked_getEmptyCellForHeader(this$.Headers[columnIndex], Unchecked_tryGetCellAt(columnIndex, 0, this$.Values))), rangeDouble(0, 1, this$.ColumnCount - 1)))) : value_3(cells);
534
553
  SanityChecks_validateRowIndex(index_1, this$.RowCount, true);
535
- const newCells = cells_1;
536
- const columnCount = this$.ColumnCount | 0;
537
- const newCellsCount = length(newCells) | 0;
538
- if (columnCount === 0) {
539
- throw new Error("Table contains no columns! Cannot add row to empty table!");
540
- }
541
- else if (newCellsCount !== columnCount) {
542
- throw new Error(`Cannot add a new row with ${newCellsCount} cells, as the table has ${columnCount} columns.`);
554
+ if (cells != null) {
555
+ const cells_1 = value_3(cells);
556
+ const newCells = cells_1;
557
+ const columnCount = this$.ColumnCount | 0;
558
+ const newCellsCount = length(newCells) | 0;
559
+ if (columnCount === 0) {
560
+ throw new Error("Table contains no columns! Cannot add row to empty table!");
561
+ }
562
+ else if (newCellsCount !== columnCount) {
563
+ throw new Error(`Cannot add a new row with ${newCellsCount} cells, as the table has ${columnCount} columns.`);
564
+ }
565
+ for (let columnIndex = 0; columnIndex <= (this$.ColumnCount - 1); columnIndex++) {
566
+ const h = this$.Headers[columnIndex];
567
+ const column = CompositeColumn.create(h, [cells_1[columnIndex]]);
568
+ cells_1[columnIndex].ValidateAgainstHeader(h, true);
569
+ }
570
+ Unchecked_addRow(index_1, cells_1, this$.Headers, this$._values);
543
571
  }
544
- for (let columnIndex_1 = 0; columnIndex_1 <= (this$.ColumnCount - 1); columnIndex_1++) {
545
- const h_1 = this$.Headers[columnIndex_1];
546
- SanityChecks_validateColumn(CompositeColumn.create(h_1, [item(columnIndex_1, cells_1)]));
572
+ else {
573
+ Unchecked_addEmptyRow(index_1, this$._values);
547
574
  }
548
- Unchecked_addRow(index_1, cells_1, this$.Headers, this$.Values);
549
575
  }
550
576
  static addRow(cells, index) {
551
577
  return (table) => {
@@ -566,12 +592,12 @@ export class ArcTable {
566
592
  else if (newCellsCount !== columnCount) {
567
593
  throw new Error(`Cannot add a new row with ${newCellsCount} cells, as the table has ${columnCount} columns.`);
568
594
  }
569
- iterateIndexed((i, cell) => {
595
+ ResizeArray_iteri((i, cell) => {
570
596
  const h = this$.Headers[i];
571
- SanityChecks_validateColumn(CompositeColumn.create(h, [cell]));
597
+ SanityChecks_validateColumn(CompositeColumn.create(h, ResizeArray_singleton(cell)));
572
598
  }, cells);
573
- iterateIndexed((columnIndex, cell_1) => {
574
- Unchecked_setCellAt(columnIndex, rowIndex, cell_1, this$.Values);
599
+ ResizeArray_iteri((columnIndex, cell_1) => {
600
+ Unchecked_setCellAt(columnIndex, rowIndex, cell_1, this$._values);
575
601
  }, cells);
576
602
  }
577
603
  static updateRow(rowIndex, cells) {
@@ -607,7 +633,7 @@ export class ArcTable {
607
633
  const this$ = this;
608
634
  let index_1 = defaultArg(index, this$.RowCount);
609
635
  SanityChecks_validateRowIndex(index_1, this$.RowCount, true);
610
- rows.forEach((row) => {
636
+ ResizeArray_iter((row) => {
611
637
  const newCells = row;
612
638
  const columnCount = this$.ColumnCount | 0;
613
639
  const newCellsCount = length(newCells) | 0;
@@ -617,15 +643,21 @@ export class ArcTable {
617
643
  else if (newCellsCount !== columnCount) {
618
644
  throw new Error(`Cannot add a new row with ${newCellsCount} cells, as the table has ${columnCount} columns.`);
619
645
  }
620
- });
621
- for (let idx = 0; idx <= (rows.length - 1); idx++) {
622
- const row_1 = item(idx, rows);
623
- for (let columnIndex = 0; columnIndex <= (this$.ColumnCount - 1); columnIndex++) {
624
- const h = this$.Headers[columnIndex];
625
- SanityChecks_validateColumn(CompositeColumn.create(h, [item(columnIndex, row_1)]));
646
+ }, rows);
647
+ let enumerator = getEnumerator(rows);
648
+ try {
649
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
650
+ const row_1 = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
651
+ for (let columnIndex = 0; columnIndex <= (this$.ColumnCount - 1); columnIndex++) {
652
+ const h = this$.Headers[columnIndex];
653
+ row_1[columnIndex].ValidateAgainstHeader(h, true);
654
+ }
626
655
  }
627
656
  }
628
- Unchecked_addRows(index_1, rows, this$.Headers, this$.Values);
657
+ finally {
658
+ disposeSafe(enumerator);
659
+ }
660
+ Unchecked_addRows(index_1, rows, this$.Headers, this$._values);
629
661
  }
630
662
  static addRows(rows, index) {
631
663
  return (table) => {
@@ -636,8 +668,10 @@ export class ArcTable {
636
668
  }
637
669
  AddRowsEmpty(rowCount, index) {
638
670
  const this$ = this;
639
- const row = toArray(delay(() => collect((columnIndex) => singleton(Unchecked_getEmptyCellForHeader(this$.Headers[columnIndex], Unchecked_tryGetCellAt(columnIndex, 0, this$.Values))), rangeDouble(0, 1, this$.ColumnCount - 1))));
640
- const rows = initialize(rowCount, (_arg) => row);
671
+ let row;
672
+ const collection = toArray(delay(() => collect((columnIndex) => singleton(getEmptyCellForHeader(this$.Headers[columnIndex], Unchecked_tryGetCellAt(columnIndex, 0, this$._values))), rangeDouble(0, 1, this$.ColumnCount - 1))));
673
+ row = Array.from(collection);
674
+ const rows = ResizeArray_init(rowCount, (_arg) => row);
641
675
  this$.AddRows(rows, unwrap(index));
642
676
  }
643
677
  static addRowsEmpty(rowCount, index) {
@@ -650,7 +684,7 @@ export class ArcTable {
650
684
  RemoveRow(index) {
651
685
  const this$ = this;
652
686
  SanityChecks_validateRowIndex(index, this$.RowCount, false);
653
- Unchecked_removeRowCells_withIndexChange(index, this$.ColumnCount, this$.RowCount, this$.Values);
687
+ Unchecked_removeRowCells_withIndexChange(index, this$._values);
654
688
  }
655
689
  static removeRow(index) {
656
690
  return (table) => {
@@ -683,53 +717,50 @@ export class ArcTable {
683
717
  if (!equals(SkipValidation, true)) {
684
718
  SanityChecks_validateRowIndex(rowIndex, this$.RowCount, false);
685
719
  }
686
- return toArray(delay(() => map((columnIndex) => value_3(this$.TryGetCellAt(columnIndex, rowIndex)), rangeDouble(0, 1, this$.ColumnCount - 1))));
720
+ const collection = toArray(delay(() => map((columnIndex) => this$.GetCellAt(columnIndex, rowIndex), rangeDouble(0, 1, this$.ColumnCount - 1))));
721
+ return Array.from(collection);
687
722
  }
688
723
  static getRow(index) {
689
724
  return (table) => table.GetRow(index);
690
725
  }
691
- Join(table, index, joinOptions, forceReplace, skipFillMissing) {
726
+ Join(table, index, joinOptions, forceReplace) {
692
727
  const this$ = this;
693
728
  const joinOptions_1 = defaultArg(joinOptions, "headers");
694
729
  const forceReplace_1 = defaultArg(forceReplace, false);
695
- const skipFillMissing_1 = defaultArg(skipFillMissing, false);
696
730
  let index_1 = defaultArg(index, this$.ColumnCount);
697
731
  index_1 = (((index_1 === -1) ? this$.ColumnCount : index_1) | 0);
698
732
  SanityChecks_validateColumnIndex(index_1, this$.ColumnCount, true);
699
733
  const onlyHeaders = equals(joinOptions_1, "headers");
700
734
  let columns;
701
735
  const pre = table.Columns;
702
- columns = ((joinOptions_1 === "withUnit") ? map_1((c_1) => {
736
+ columns = ((joinOptions_1 === "withUnit") ? ResizeArray_map((c_1) => {
703
737
  const unitsOpt = c_1.TryGetColumnUnits();
704
738
  if (unitsOpt == null) {
705
739
  return new CompositeColumn(c_1.Header, []);
706
740
  }
707
741
  else {
708
- return new CompositeColumn(c_1.Header, map_1((u) => CompositeCell.createUnitized("", u), value_3(unitsOpt)));
742
+ return new CompositeColumn(c_1.Header, ResizeArray_map((u) => CompositeCell.createUnitized("", u), value_3(unitsOpt)));
709
743
  }
710
- }, pre) : ((joinOptions_1 === "withValues") ? pre : map_1((c) => (new CompositeColumn(c.Header, [])), pre)));
744
+ }, pre) : ((joinOptions_1 === "withValues") ? pre : ResizeArray_map((c) => (new CompositeColumn(c.Header, [])), pre)));
711
745
  const duplicates = tryFindDuplicateUniqueInArray(map((x) => x.Header, columns));
712
746
  if (!isEmpty(duplicates)) {
713
747
  const sb = StringBuilder_$ctor();
714
748
  StringBuilder__AppendLine_Z721C83C5(sb, "Found duplicate unique columns in `columns`.");
715
- iterate_1((x_1) => {
749
+ iterate((x_1) => {
716
750
  StringBuilder__AppendLine_Z721C83C5(sb, `Duplicate \`${x_1.HeaderType}\` at index ${x_1.Index1} and ${x_1.Index2}.`);
717
751
  }, duplicates);
718
752
  throw new Error(toString(sb));
719
753
  }
720
- columns.forEach((x_2) => {
754
+ ResizeArray_iter((x_2) => {
721
755
  SanityChecks_validateColumn(x_2);
722
- });
723
- columns.forEach((col) => {
756
+ }, columns);
757
+ ResizeArray_iter((col) => {
724
758
  const prevHeadersCount = this$.Headers.length | 0;
725
- Unchecked_addColumn(col.Header, col.Cells, index_1, forceReplace_1, onlyHeaders, this$.Headers, this$.Values);
759
+ Unchecked_addColumn(col.Header, col.Cells, index_1, forceReplace_1, onlyHeaders, this$.Headers, this$._values);
726
760
  if (this$.Headers.length > prevHeadersCount) {
727
761
  index_1 = ((index_1 + 1) | 0);
728
762
  }
729
- });
730
- if (!skipFillMissing_1) {
731
- Unchecked_fillMissingCells(this$.Headers, this$.Values);
732
- }
763
+ }, columns);
733
764
  }
734
765
  static join(table, index, joinOptions, forceReplace) {
735
766
  return (this$) => {
@@ -738,30 +769,30 @@ export class ArcTable {
738
769
  return copy;
739
770
  };
740
771
  }
741
- AddProtocolTypeColumn(types, index) {
772
+ AddProtocolTypeColumn(types, index, forceReplace) {
742
773
  const this$ = this;
743
- const cells = map_2((array) => map_1(CompositeCell_Term, array), types);
744
- this$.AddColumn(CompositeHeader_ProtocolType(), unwrap(cells), unwrap(index));
774
+ const cells = map_1((a) => ResizeArray_map(CompositeCell_Term, a), types);
775
+ this$.AddColumn(CompositeHeader_ProtocolType(), unwrap(cells), unwrap(index), unwrap(forceReplace));
745
776
  }
746
- AddProtocolVersionColumn(versions, index) {
777
+ AddProtocolVersionColumn(versions, index, forceReplace) {
747
778
  const this$ = this;
748
- const cells = map_2((array) => map_1(CompositeCell_FreeText, array), versions);
749
- this$.AddColumn(CompositeHeader_ProtocolVersion(), unwrap(cells), unwrap(index));
779
+ const cells = map_1((a) => ResizeArray_map(CompositeCell_FreeText, a), versions);
780
+ this$.AddColumn(CompositeHeader_ProtocolVersion(), unwrap(cells), unwrap(index), unwrap(forceReplace));
750
781
  }
751
- AddProtocolUriColumn(uris, index) {
782
+ AddProtocolUriColumn(uris, index, forceReplace) {
752
783
  const this$ = this;
753
- const cells = map_2((array) => map_1(CompositeCell_FreeText, array), uris);
754
- this$.AddColumn(CompositeHeader_ProtocolUri(), unwrap(cells), unwrap(index));
784
+ const cells = map_1((a) => ResizeArray_map(CompositeCell_FreeText, a), uris);
785
+ this$.AddColumn(CompositeHeader_ProtocolUri(), unwrap(cells), unwrap(index), unwrap(forceReplace));
755
786
  }
756
- AddProtocolDescriptionColumn(descriptions, index) {
787
+ AddProtocolDescriptionColumn(descriptions, index, forceReplace) {
757
788
  const this$ = this;
758
- const cells = map_2((array) => map_1(CompositeCell_FreeText, array), descriptions);
759
- this$.AddColumn(CompositeHeader_ProtocolDescription(), unwrap(cells), unwrap(index));
789
+ const cells = map_1((a) => ResizeArray_map(CompositeCell_FreeText, a), descriptions);
790
+ this$.AddColumn(CompositeHeader_ProtocolDescription(), unwrap(cells), unwrap(index), unwrap(forceReplace));
760
791
  }
761
- AddProtocolNameColumn(names, index) {
792
+ AddProtocolNameColumn(names, index, forceReplace) {
762
793
  const this$ = this;
763
- const cells = map_2((array) => map_1(CompositeCell_FreeText, array), names);
764
- this$.AddColumn(CompositeHeader_ProtocolREF(), unwrap(cells), unwrap(index));
794
+ const cells = map_1((a) => ResizeArray_map(CompositeCell_FreeText, a), names);
795
+ this$.AddColumn(CompositeHeader_ProtocolREF(), unwrap(cells), unwrap(index), unwrap(forceReplace));
765
796
  }
766
797
  GetProtocolTypeColumn() {
767
798
  const this$ = this;
@@ -789,25 +820,31 @@ export class ArcTable {
789
820
  }
790
821
  GetComponentColumns() {
791
822
  const this$ = this;
792
- return map_1((h_1) => this$.GetColumnByHeader(h_1), toArray(filter((h) => h.isComponent, this$.Headers)));
823
+ return ResizeArray_choose((h) => {
824
+ if (h.isComponent) {
825
+ return this$.GetColumnByHeader(h);
826
+ }
827
+ else {
828
+ return undefined;
829
+ }
830
+ }, this$.Headers);
831
+ }
832
+ RescanValueMap() {
833
+ const this$ = this;
834
+ this$._values.RescanValueMap();
793
835
  }
794
836
  static SplitByColumnValues(columnIndex) {
795
- return (table) => mapIndexed((i, indexGroup) => {
796
- let headers;
797
- const collection = table.Headers;
798
- headers = Array.from(collection);
799
- const rows = map_1((i_1) => table.GetRow(i_1, true), indexGroup);
837
+ return (table) => ResizeArray_mapi((i, indexGroup) => {
838
+ const headers = table.Headers;
839
+ const rows = ResizeArray_map((i_1) => table.GetRow(i_1, true), indexGroup);
800
840
  return ArcTable.createFromRows(table.Name, headers, rows);
801
- }, map_1((tupledArg) => map_1((tuple_1) => tuple_1[0], tupledArg[1]), Array_groupBy((tuple) => tuple[1], indexed(table.GetColumn(columnIndex).Cells), {
802
- Equals: equals,
803
- GetHashCode: safeHash,
804
- })));
841
+ }, ResizeArray_map((tupledArg) => ResizeArray_map((tuple_1) => tuple_1[0], tupledArg[1]), ResizeArray_groupBy((tuple) => tuple[1], ResizeArray_indexed(table.GetColumn(columnIndex, true).Cells))));
805
842
  }
806
843
  static SplitByColumnValuesByHeader(header) {
807
844
  return (table) => {
808
845
  const index = tryFindIndex((x) => equals(x, header), table.Headers);
809
846
  if (index == null) {
810
- return [table.Copy()];
847
+ return ResizeArray_singleton(table.Copy());
811
848
  }
812
849
  else {
813
850
  const i = value_3(index) | 0;
@@ -828,20 +865,25 @@ export class ArcTable {
828
865
  else {
829
866
  return tupledArg[0];
830
867
  }
831
- }, indexed_1(refTable_1.Headers)));
868
+ }, indexed(refTable_1.Headers)));
832
869
  refTable_1.RemoveColumns(nonProtocolColumns);
833
- Unchecked_extendToRowCount(annotationTable_1.RowCount, refTable_1.Headers, refTable_1.Values);
834
- const arr = annotationTable_1.Columns;
835
- for (let idx = 0; idx <= (arr.length - 1); idx++) {
836
- const c = item(idx, arr);
837
- refTable_1.AddColumn(c.Header, c.Cells, undefined, true);
870
+ refTable_1.RowCount = (annotationTable_1.RowCount | 0);
871
+ let enumerator = getEnumerator(annotationTable_1.Columns);
872
+ try {
873
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
874
+ const c = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
875
+ refTable_1.AddColumn(c.Header, c.Cells, undefined, true);
876
+ }
877
+ }
878
+ finally {
879
+ disposeSafe(enumerator);
838
880
  }
839
881
  return refTable_1;
840
882
  }
841
883
  static append(table1, table2) {
842
- const getList = (t) => toList(delay(() => map((row) => toList(delay(() => map((col) => [t.Headers[col], getItemFromDict(t.Values, [col, row])], rangeDouble(0, 1, t.ColumnCount - 1)))), rangeDouble(0, 1, t.RowCount - 1))));
884
+ const getList = (t) => toList(delay(() => map((row) => toList(mapIndexed((i, c) => [t.Headers[i], c], t.GetRow(row, true))), rangeDouble(0, 1, t.RowCount - 1))));
843
885
  const patternInput = Unchecked_alignByHeaders(false, append(getList(table1), getList(table2)));
844
- return ArcTable.create(table1.Name, patternInput[0], patternInput[1]);
886
+ return ArcTable.fromArcTableValues(table1.Name, patternInput[0], patternInput[1]);
845
887
  }
846
888
  toString() {
847
889
  const this$ = this;
@@ -849,33 +891,8 @@ export class ArcTable {
849
891
  return join("\n", toList(delay(() => append_1(singleton(`Table: ${this$.Name}`), delay(() => append_1(singleton("-------------"), delay(() => append_1(singleton(join("\t|\t", map(toString, this$.Headers))), delay(() => ((rowCount > 50) ? append_1(map((rowI) => join("\t|\t", map(toString, this$.GetRow(rowI))), rangeDouble(0, 1, 19)), delay(() => append_1(singleton("..."), delay(() => map((rowI_1) => join("\t|\t", map(toString, this$.GetRow(rowI_1))), rangeDouble(rowCount - 20, 1, rowCount - 1)))))) : ((rowCount === 0) ? singleton("No rows") : map((rowI_2) => join("\t|\t", map(toString, this$.GetRow(rowI_2))), rangeDouble(0, 1, rowCount - 1)))))))))))));
850
892
  }
851
893
  StructurallyEquals(other) {
852
- let a, b;
853
894
  const this$ = this;
854
- const sort = (arg) => sortBy((_arg) => _arg[0], Array.from(arg), {
855
- Compare: compareArrays,
856
- });
857
- if ((this$.Name === other.Name) && ((a = this$.Headers, (b = other.Headers, (length(a) === length(b)) && fold((acc, e) => {
858
- if (acc) {
859
- return e;
860
- }
861
- else {
862
- return false;
863
- }
864
- }, true, toList(delay(() => map((i) => equals(item_1(i, a), item_1(i, b)), rangeDouble(0, 1, length(a) - 1))))))))) {
865
- const a_1 = sort(this$.Values);
866
- const b_1 = sort(other.Values);
867
- return (length(a_1) === length(b_1)) && fold((acc_1, e_1) => {
868
- if (acc_1) {
869
- return e_1;
870
- }
871
- else {
872
- return false;
873
- }
874
- }, true, toList(delay(() => map((i_1) => equals(item_1(i_1, a_1), item_1(i_1, b_1)), rangeDouble(0, 1, length(a_1) - 1)))));
875
- }
876
- else {
877
- return false;
878
- }
895
+ return safeHash(this$) === safeHash(other);
879
896
  }
880
897
  ReferenceEquals(other) {
881
898
  const this$ = this;
@@ -888,13 +905,13 @@ export class ArcTable {
888
905
  }
889
906
  GetHashCode() {
890
907
  const this$ = this;
891
- const vHash = boxHashValues(this$.ColumnCount, this$.Values);
908
+ const vHash = safeHash(this$._values) | 0;
892
909
  return boxHashArray([this$.Name, boxHashSeq(this$.Headers), vHash]) | 0;
893
910
  }
894
911
  }
895
912
  export function ArcTable_$reflection() {
896
913
  return class_type("ARCtrl.ArcTable", undefined, ArcTable);
897
914
  }
898
- export function ArcTable_$ctor_76CAD84E(name, headers, values) {
899
- return new ArcTable(name, headers, values);
915
+ export function ArcTable_$ctor_2D310C9B(name, headers, columns) {
916
+ return new ArcTable(name, headers, columns);
900
917
  }