From 40a35dea8e7b402b1ede3658e0e52cbfcd90075e Mon Sep 17 00:00:00 2001
From: David Sehnal <david.sehnal@gmail.com>
Date: Thu, 2 Nov 2017 16:10:41 +0100
Subject: [PATCH] More refactoring, fixed jest

---
 package.json                                  |   1 +
 src/mol-base/collections/integer.ts           |   3 +-
 .../{ => integer}/_spec/linked-index.spec.ts  |   0
 .../collections/{ => integer}/linked-index.ts |   0
 src/mol-base/collections/table.ts             | 118 +----------------
 .../{ => table}/_spec/table.spec.ts           |   3 +-
 .../collections/table/column-helpers.ts       |  40 ++++++
 .../collections/{ => table}/column.ts         |  37 +-----
 src/mol-base/collections/table/table.ts       | 121 ++++++++++++++++++
 .../structure/model/builders/mmcif.ts         |   3 +-
 .../model/properties/conformation.ts          |   2 +-
 .../structure/model/properties/hierarchy.ts   |   3 +-
 .../structure/model/utils/hierarchy-keys.ts   |   2 +-
 src/mol-io/reader/_spec/column.spec.ts        |   2 +-
 src/mol-io/reader/cif/binary/field.ts         |   2 +-
 src/mol-io/reader/cif/data-model.ts           |   2 +-
 src/mol-io/reader/cif/schema.ts               |   3 +-
 src/mol-io/reader/cif/text/field.ts           |   2 +-
 src/mol-io/reader/common/text/column/fixed.ts |   2 +-
 src/mol-io/reader/common/text/column/token.ts |   2 +-
 src/mol-io/reader/gro/parser.ts               |   2 +-
 src/mol-io/reader/gro/schema.d.ts             |   2 +-
 src/mol-io/reader/mol2/schema.d.ts            |   2 +-
 src/perf-tests/column.ts                      |   2 +-
 24 files changed, 187 insertions(+), 169 deletions(-)
 rename src/mol-base/collections/{ => integer}/_spec/linked-index.spec.ts (100%)
 rename src/mol-base/collections/{ => integer}/linked-index.ts (100%)
 rename src/mol-base/collections/{ => table}/_spec/table.spec.ts (98%)
 create mode 100644 src/mol-base/collections/table/column-helpers.ts
 rename src/mol-base/collections/{ => table}/column.ts (86%)
 create mode 100644 src/mol-base/collections/table/table.ts

diff --git a/package.json b/package.json
index 02761decc..44965fe03 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
     "transform": {
       "\\.ts$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
     },
+    "moduleDirectories": ["node_modules", "build/node_modules"], 
     "testRegex": "\\.spec\\.ts$"
   },
   "author": "",
diff --git a/src/mol-base/collections/integer.ts b/src/mol-base/collections/integer.ts
index a7ca91076..aba4ca874 100644
--- a/src/mol-base/collections/integer.ts
+++ b/src/mol-base/collections/integer.ts
@@ -9,6 +9,7 @@ import OrderedSet from './integer/ordered-set'
 import Segmentation from './integer/segmentation'
 import SortedArray from './integer/sorted-array'
 import Tuple from './integer/tuple'
+import LinkedIndex from './integer/linked-index'
 import Iterator from './iterator'
 
-export { Interval, OrderedSet, Segmentation, SortedArray, Tuple, Iterator }
\ No newline at end of file
+export { Interval, OrderedSet, Segmentation, SortedArray, Tuple, LinkedIndex, Iterator }
\ No newline at end of file
diff --git a/src/mol-base/collections/_spec/linked-index.spec.ts b/src/mol-base/collections/integer/_spec/linked-index.spec.ts
similarity index 100%
rename from src/mol-base/collections/_spec/linked-index.spec.ts
rename to src/mol-base/collections/integer/_spec/linked-index.spec.ts
diff --git a/src/mol-base/collections/linked-index.ts b/src/mol-base/collections/integer/linked-index.ts
similarity index 100%
rename from src/mol-base/collections/linked-index.ts
rename to src/mol-base/collections/integer/linked-index.ts
diff --git a/src/mol-base/collections/table.ts b/src/mol-base/collections/table.ts
index 32a7b5379..b175419ae 100644
--- a/src/mol-base/collections/table.ts
+++ b/src/mol-base/collections/table.ts
@@ -4,118 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column from './column'
-import { sortArray } from './sort'
+import Table from './table/table'
+import Column from './table/column'
+import * as ColumnHelpers from './table/column-helpers'
 
-type Table<Schema extends Table.Schema> = { readonly _rowCount: number, readonly _columns: ReadonlyArray<string> } & Table.Columns<Schema>
-
-/** An immutable table */
-namespace Table {
-    export type Schema = { [field: string]: Column.Type }
-    export type Columns<S extends Schema> = { [C in keyof S]: Column<S[C]['T']> }
-    export type Row<S extends Schema> = { [C in keyof S]: S[C]['T'] }
-    export type Arrays<S extends Schema> = { [C in keyof S]: ArrayLike<S[C]['T']> }
-    export type PartialTable<S extends Table.Schema> = { readonly _rowCount: number, readonly _columns: ReadonlyArray<string> } & { [C in keyof S]?: Column<S[C]['T']> }
-
-    export function pickColumns<S extends Schema>(schema: S, table: PartialTable<S>, guard: Partial<Columns<S>> = {}): Table<S> {
-        const ret = Object.create(null);
-        const keys = Object.keys(schema);
-        ret._rowCount = table._rowCount;
-        ret._columns = keys;
-        for (const k of keys) {
-            if (!!table[k]) ret[k] = table[k];
-            else if (!!guard[k]) ret[k] = guard[k];
-            else throw Error(`Cannot find column '${k}'.`);
-        }
-        return ret;
-    }
-
-    export function ofColumns<S extends Schema, R extends Table<S> = Table<S>>(columns: Columns<S>): R {
-        const _columns = Object.keys(columns);
-        const _rowCount = columns[_columns[0]].rowCount;
-        return { _rowCount, _columns, ...(columns as any) };
-    }
-
-    export function ofRows<S extends Schema, R extends Table<S> = Table<S>>(schema: Schema, rows: ArrayLike<Row<S>>): R {
-        const ret = Object.create(null);
-        const rowCount = rows.length;
-        const columns = Object.keys(schema);
-        ret._rowCount = rowCount;
-        ret._columns = columns;
-        for (const k of columns) {
-            (ret as any)[k] = Column.ofLambda({
-                rowCount,
-                type: schema[k],
-                value: r => rows[r][k],
-                valueKind: r => typeof rows[r][k] === 'undefined' ? Column.ValueKind.NotPresent : Column.ValueKind.Present
-            })
-        }
-        return ret as R;
-    }
-
-    export function ofArrays<S extends Schema, R extends Table<S> = Table<S>>(schema: Schema, arrays: Arrays<S>): R {
-        const ret = Object.create(null);
-        const columns = Object.keys(schema);
-        ret._rowCount = arrays[columns[0]].length;
-        ret._columns = columns;
-        for (const k of columns) {
-            (ret as any)[k] = Column.ofArray({ array: arrays[k], type: schema[k] })
-        }
-        return ret as R;
-    }
-
-    export function view<S extends Schema, R extends Schema>(table: Table<S>, schema: R, view: ArrayLike<number>) {
-        const ret = Object.create(null);
-        const columns = Object.keys(schema);
-        ret._rowCount = view.length;
-        ret._columns = columns;
-        for (const k of columns) {
-            (ret as any)[k] = Column.view(table[k], view);
-        }
-        return ret as Table<R>;
-    }
-
-    export function columnToArray<S extends Schema>(table: Table<S>, name: keyof S, array?: Column.ArrayCtor<any>) {
-        table[name] = Column.asArrayColumn(table[name], array);
-    }
-
-    /** Sort and return a new table */
-    export function sort<T extends Table<S>, S extends Schema>(table: T, cmp: (i: number, j: number) => number) {
-        const indices = new Int32Array(table._rowCount);
-        for (let i = 0, _i = indices.length; i < _i; i++) indices[i] = i;
-        sortArray(indices, (_, i, j) => cmp(i, j));
-
-        let isIdentity = true;
-        for (let i = 0, _i = indices.length; i < _i; i++) {
-            if (indices[i] !== i) {
-                isIdentity = false;
-                break;
-            }
-        }
-        if (isIdentity) return table;
-
-        const ret = Object.create(null);
-        ret._rowCount = table._rowCount;
-        ret._columns = table._columns;
-        for (const c of table._columns) {
-            ret[c] = Column.view((table as any)[c], indices, false);
-        }
-        return ret;
-    }
-
-    export function areEqual<T extends Table<Schema>>(a: T, b: T) {
-        if (a._rowCount !== b._rowCount) return false;
-        if (a._columns.length !== b._columns.length) return false;
-        for (const c of a._columns) {
-            if (!b[c]) return false;
-        }
-
-        for (const c of a._columns) {
-            if (!Column.areEqual(a[c], b[c])) return false;
-        }
-
-        return true;
-    }
-}
-
-export default Table
\ No newline at end of file
+export { Table, Column, ColumnHelpers }
\ No newline at end of file
diff --git a/src/mol-base/collections/_spec/table.spec.ts b/src/mol-base/collections/table/_spec/table.spec.ts
similarity index 98%
rename from src/mol-base/collections/_spec/table.spec.ts
rename to src/mol-base/collections/table/_spec/table.spec.ts
index 4d79f445b..18a49fc54 100644
--- a/src/mol-base/collections/_spec/table.spec.ts
+++ b/src/mol-base/collections/table/_spec/table.spec.ts
@@ -4,7 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column, { ColumnHelpers } from '../column'
+import * as ColumnHelpers from '../column-helpers'
+import Column from '../column'
 import Table from '../table'
 
 describe('column', () => {
diff --git a/src/mol-base/collections/table/column-helpers.ts b/src/mol-base/collections/table/column-helpers.ts
new file mode 100644
index 000000000..b57deec09
--- /dev/null
+++ b/src/mol-base/collections/table/column-helpers.ts
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import Column from './column'
+
+export function getArrayBounds(rowCount: number, params?: Column.ToArrayParams<any>) {
+    const start = params && typeof params.start !== 'undefined' ? Math.max(Math.min(params.start, rowCount - 1), 0) : 0;
+    const end = params && typeof params.end !== 'undefined' ? Math.min(params.end, rowCount) : rowCount;
+    return { start, end };
+}
+
+export function createArray(rowCount: number, params?: Column.ToArrayParams<any>) {
+    const c = params && typeof params.array !== 'undefined' ? params.array : Array;
+    const { start, end } = getArrayBounds(rowCount, params);
+    return { array: new c(end - start) as any[], start, end };
+}
+
+export function fillArrayValues(value: (row: number) => any, target: any[], start: number) {
+    for (let i = 0, _e = target.length; i < _e; i++) target[i] = value(start + i);
+    return target;
+}
+
+export function createAndFillArray(rowCount: number, value: (row: number) => any, params?: Column.ToArrayParams<any>) {
+    const { array, start } = createArray(rowCount, params);
+    return fillArrayValues(value, array, start);
+}
+
+export function isTypedArray(data: any): boolean {
+    return !!data.buffer && typeof data.byteLength === 'number' && typeof data.BYTES_PER_ELEMENT === 'number';
+}
+
+export function typedArrayWindow(data: any, params?: Column.ToArrayParams<any>): ReadonlyArray<number> {
+    const { constructor, buffer, length, byteOffset, BYTES_PER_ELEMENT } = data;
+    const { start, end } = getArrayBounds(length, params);
+    if (start === 0 && end === length) return data;
+    return new constructor(buffer, byteOffset + BYTES_PER_ELEMENT * start, Math.min(length, end - start));
+}
\ No newline at end of file
diff --git a/src/mol-base/collections/column.ts b/src/mol-base/collections/table/column.ts
similarity index 86%
rename from src/mol-base/collections/column.ts
rename to src/mol-base/collections/table/column.ts
index 7118f96d0..9f0263306 100644
--- a/src/mol-base/collections/column.ts
+++ b/src/mol-base/collections/table/column.ts
@@ -4,6 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
+import * as ColumnHelpers from './column-helpers'
+
 interface Column<T> {
     readonly '@type': Column.Type,
     readonly '@array': ArrayLike<any> | undefined,
@@ -304,39 +306,4 @@ function areValuesEqual(a: Column<any>, b: Column<any>) {
         if (va(i) !== vb(i)) return false;
     }
     return true;
-}
-
-export namespace ColumnHelpers {
-    export function getArrayBounds(rowCount: number, params?: Column.ToArrayParams<any>) {
-        const start = params && typeof params.start !== 'undefined' ? Math.max(Math.min(params.start, rowCount - 1), 0) : 0;
-        const end = params && typeof params.end !== 'undefined' ? Math.min(params.end, rowCount) : rowCount;
-        return { start, end };
-    }
-
-    export function createArray(rowCount: number, params?: Column.ToArrayParams<any>) {
-        const c = params && typeof params.array !== 'undefined' ? params.array : Array;
-        const { start, end } = getArrayBounds(rowCount, params);
-        return { array: new c(end - start) as any[], start, end };
-    }
-
-    export function fillArrayValues(value: (row: number) => any, target: any[], start: number) {
-        for (let i = 0, _e = target.length; i < _e; i++) target[i] = value(start + i);
-        return target;
-    }
-
-    export function createAndFillArray(rowCount: number, value: (row: number) => any, params?: Column.ToArrayParams<any>) {
-        const { array, start } = createArray(rowCount, params);
-        return fillArrayValues(value, array, start);
-    }
-
-    export function isTypedArray(data: any): boolean {
-        return !!data.buffer && typeof data.byteLength === 'number' && typeof data.BYTES_PER_ELEMENT === 'number';
-    }
-
-    export function typedArrayWindow(data: any, params?: Column.ToArrayParams<any>): ReadonlyArray<number> {
-        const { constructor, buffer, length, byteOffset, BYTES_PER_ELEMENT } = data;
-        const { start, end } = getArrayBounds(length, params);
-        if (start === 0 && end === length) return data;
-        return new constructor(buffer, byteOffset + BYTES_PER_ELEMENT * start, Math.min(length, end - start));
-    }
 }
\ No newline at end of file
diff --git a/src/mol-base/collections/table/table.ts b/src/mol-base/collections/table/table.ts
new file mode 100644
index 000000000..d4e94d985
--- /dev/null
+++ b/src/mol-base/collections/table/table.ts
@@ -0,0 +1,121 @@
+/**
+ * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import Column from './column'
+import { sortArray } from '../sort'
+
+type Table<Schema extends Table.Schema> = { readonly _rowCount: number, readonly _columns: ReadonlyArray<string> } & Table.Columns<Schema>
+
+/** An immutable table */
+namespace Table {
+    export type Schema = { [field: string]: Column.Type }
+    export type Columns<S extends Schema> = { [C in keyof S]: Column<S[C]['T']> }
+    export type Row<S extends Schema> = { [C in keyof S]: S[C]['T'] }
+    export type Arrays<S extends Schema> = { [C in keyof S]: ArrayLike<S[C]['T']> }
+    export type PartialTable<S extends Table.Schema> = { readonly _rowCount: number, readonly _columns: ReadonlyArray<string> } & { [C in keyof S]?: Column<S[C]['T']> }
+
+    export function pickColumns<S extends Schema>(schema: S, table: PartialTable<S>, guard: Partial<Columns<S>> = {}): Table<S> {
+        const ret = Object.create(null);
+        const keys = Object.keys(schema);
+        ret._rowCount = table._rowCount;
+        ret._columns = keys;
+        for (const k of keys) {
+            if (!!table[k]) ret[k] = table[k];
+            else if (!!guard[k]) ret[k] = guard[k];
+            else throw Error(`Cannot find column '${k}'.`);
+        }
+        return ret;
+    }
+
+    export function ofColumns<S extends Schema, R extends Table<S> = Table<S>>(columns: Columns<S>): R {
+        const _columns = Object.keys(columns);
+        const _rowCount = columns[_columns[0]].rowCount;
+        return { _rowCount, _columns, ...(columns as any) };
+    }
+
+    export function ofRows<S extends Schema, R extends Table<S> = Table<S>>(schema: Schema, rows: ArrayLike<Row<S>>): R {
+        const ret = Object.create(null);
+        const rowCount = rows.length;
+        const columns = Object.keys(schema);
+        ret._rowCount = rowCount;
+        ret._columns = columns;
+        for (const k of columns) {
+            (ret as any)[k] = Column.ofLambda({
+                rowCount,
+                type: schema[k],
+                value: r => rows[r][k],
+                valueKind: r => typeof rows[r][k] === 'undefined' ? Column.ValueKind.NotPresent : Column.ValueKind.Present
+            })
+        }
+        return ret as R;
+    }
+
+    export function ofArrays<S extends Schema, R extends Table<S> = Table<S>>(schema: Schema, arrays: Arrays<S>): R {
+        const ret = Object.create(null);
+        const columns = Object.keys(schema);
+        ret._rowCount = arrays[columns[0]].length;
+        ret._columns = columns;
+        for (const k of columns) {
+            (ret as any)[k] = Column.ofArray({ array: arrays[k], type: schema[k] })
+        }
+        return ret as R;
+    }
+
+    export function view<S extends Schema, R extends Schema>(table: Table<S>, schema: R, view: ArrayLike<number>) {
+        const ret = Object.create(null);
+        const columns = Object.keys(schema);
+        ret._rowCount = view.length;
+        ret._columns = columns;
+        for (const k of columns) {
+            (ret as any)[k] = Column.view(table[k], view);
+        }
+        return ret as Table<R>;
+    }
+
+    export function columnToArray<S extends Schema>(table: Table<S>, name: keyof S, array?: Column.ArrayCtor<any>) {
+        table[name] = Column.asArrayColumn(table[name], array);
+    }
+
+    /** Sort and return a new table */
+    export function sort<T extends Table<S>, S extends Schema>(table: T, cmp: (i: number, j: number) => number) {
+        const indices = new Int32Array(table._rowCount);
+        for (let i = 0, _i = indices.length; i < _i; i++) indices[i] = i;
+        sortArray(indices, (_, i, j) => cmp(i, j));
+
+        let isIdentity = true;
+        for (let i = 0, _i = indices.length; i < _i; i++) {
+            if (indices[i] !== i) {
+                isIdentity = false;
+                break;
+            }
+        }
+        if (isIdentity) return table;
+
+        const ret = Object.create(null);
+        ret._rowCount = table._rowCount;
+        ret._columns = table._columns;
+        for (const c of table._columns) {
+            ret[c] = Column.view((table as any)[c], indices, false);
+        }
+        return ret;
+    }
+
+    export function areEqual<T extends Table<Schema>>(a: T, b: T) {
+        if (a._rowCount !== b._rowCount) return false;
+        if (a._columns.length !== b._columns.length) return false;
+        for (const c of a._columns) {
+            if (!b[c]) return false;
+        }
+
+        for (const c of a._columns) {
+            if (!Column.areEqual(a[c], b[c])) return false;
+        }
+
+        return true;
+    }
+}
+
+export default Table
\ No newline at end of file
diff --git a/src/mol-data/structure/model/builders/mmcif.ts b/src/mol-data/structure/model/builders/mmcif.ts
index 26591bf4b..40e713590 100644
--- a/src/mol-data/structure/model/builders/mmcif.ts
+++ b/src/mol-data/structure/model/builders/mmcif.ts
@@ -6,8 +6,7 @@
 
 import { mmCIF } from '../data-format'
 import Model from '../model'
-import Column from 'mol-base/collections/column'
-import Table from 'mol-base/collections/table'
+import { Column, Table } from 'mol-base/collections/table'
 import { Interval, Segmentation } from 'mol-base/collections/integer'
 import { newUUID } from 'mol-base/utils/uuid'
 import * as Hierarchy from '../properties/hierarchy'
diff --git a/src/mol-data/structure/model/properties/conformation.ts b/src/mol-data/structure/model/properties/conformation.ts
index 9014a0a93..651504d82 100644
--- a/src/mol-data/structure/model/properties/conformation.ts
+++ b/src/mol-data/structure/model/properties/conformation.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column from 'mol-base/collections/column'
+import { Column } from 'mol-base/collections/table'
 import UUID from 'mol-base/utils/uuid'
 
 interface Conformation {
diff --git a/src/mol-data/structure/model/properties/hierarchy.ts b/src/mol-data/structure/model/properties/hierarchy.ts
index fec5de265..c44ca9052 100644
--- a/src/mol-data/structure/model/properties/hierarchy.ts
+++ b/src/mol-data/structure/model/properties/hierarchy.ts
@@ -4,8 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column from 'mol-base/collections/column'
-import Table from 'mol-base/collections/table'
+import { Column, Table } from 'mol-base/collections/table'
 import { Segmentation } from 'mol-base/collections/integer'
 import { Schema as mmCIF } from 'mol-io/reader/cif/schema/mmcif'
 
diff --git a/src/mol-data/structure/model/utils/hierarchy-keys.ts b/src/mol-data/structure/model/utils/hierarchy-keys.ts
index fe4391e42..06aa40957 100644
--- a/src/mol-data/structure/model/utils/hierarchy-keys.ts
+++ b/src/mol-data/structure/model/utils/hierarchy-keys.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column from 'mol-base/collections/column'
+import { Column } from 'mol-base/collections/table'
 import { Data, Segments, Keys } from '../properties/hierarchy'
 import { Interval, Segmentation } from 'mol-base/collections/integer'
 
diff --git a/src/mol-io/reader/_spec/column.spec.ts b/src/mol-io/reader/_spec/column.spec.ts
index a0242c39f..556df5d9f 100644
--- a/src/mol-io/reader/_spec/column.spec.ts
+++ b/src/mol-io/reader/_spec/column.spec.ts
@@ -7,7 +7,7 @@
 
 import FixedColumn from '../common/text/column/fixed'
 import TokenColumn from '../common/text/column/token'
-import Column, { ColumnHelpers } from 'mol-base/collections/column'
+import { Column, ColumnHelpers } from 'mol-base/collections/table'
 
 const lines = [
     '1.123 abc',
diff --git a/src/mol-io/reader/cif/binary/field.ts b/src/mol-io/reader/cif/binary/field.ts
index 1a629ea2f..22165904c 100644
--- a/src/mol-io/reader/cif/binary/field.ts
+++ b/src/mol-io/reader/cif/binary/field.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column, { ColumnHelpers } from 'mol-base/collections/column'
+import { Column, ColumnHelpers } from 'mol-base/collections/table'
 import * as Data from '../data-model'
 import { EncodedColumn } from './encoding'
 import decode from './decoder'
diff --git a/src/mol-io/reader/cif/data-model.ts b/src/mol-io/reader/cif/data-model.ts
index bd8cf4ec7..4037ae87c 100644
--- a/src/mol-io/reader/cif/data-model.ts
+++ b/src/mol-io/reader/cif/data-model.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column from 'mol-base/collections/column'
+import { Column } from 'mol-base/collections/table'
 
 export interface File {
     readonly name?: string,
diff --git a/src/mol-io/reader/cif/schema.ts b/src/mol-io/reader/cif/schema.ts
index 7984870d7..abc78e585 100644
--- a/src/mol-io/reader/cif/schema.ts
+++ b/src/mol-io/reader/cif/schema.ts
@@ -5,8 +5,7 @@
  */
 
 import * as Data from './data-model'
-import Column, { ColumnHelpers } from 'mol-base/collections/column'
-import Table from 'mol-base/collections/table'
+import { Table, Column, ColumnHelpers } from 'mol-base/collections/table'
 
 export function toTypedFrame<Schema extends FrameSchema, Frame extends TypedFrame<Schema> = TypedFrame<Schema>>(schema: Schema, frame: Data.Frame): Frame {
     return createTypedFrame(schema, frame) as Frame;
diff --git a/src/mol-io/reader/cif/text/field.ts b/src/mol-io/reader/cif/text/field.ts
index b124fed3c..6c1ad0fe4 100644
--- a/src/mol-io/reader/cif/text/field.ts
+++ b/src/mol-io/reader/cif/text/field.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column, { ColumnHelpers } from 'mol-base/collections/column'
+import { Column, ColumnHelpers } from 'mol-base/collections/table'
 import * as TokenColumn from '../../common/text/column/token'
 import { Tokens } from '../../common/text/tokenizer'
 import * as Data from '../data-model'
diff --git a/src/mol-io/reader/common/text/column/fixed.ts b/src/mol-io/reader/common/text/column/fixed.ts
index 2644ac70a..c9d4aa6a1 100644
--- a/src/mol-io/reader/common/text/column/fixed.ts
+++ b/src/mol-io/reader/common/text/column/fixed.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column, { ColumnHelpers } from 'mol-base/collections/column'
+import { Column, ColumnHelpers } from 'mol-base/collections/table'
 import { trimStr, Tokens } from '../tokenizer'
 import { parseIntSkipLeadingWhitespace, parseFloatSkipLeadingWhitespace } from '../number-parser'
 
diff --git a/src/mol-io/reader/common/text/column/token.ts b/src/mol-io/reader/common/text/column/token.ts
index 21fd44a7a..7ed57ed1e 100644
--- a/src/mol-io/reader/common/text/column/token.ts
+++ b/src/mol-io/reader/common/text/column/token.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column, { ColumnHelpers } from 'mol-base/collections/column'
+import { Column, ColumnHelpers } from 'mol-base/collections/table'
 import { Tokens } from '../tokenizer'
 import { parseInt as fastParseInt, parseFloat as fastParseFloat } from '../number-parser'
 
diff --git a/src/mol-io/reader/gro/parser.ts b/src/mol-io/reader/gro/parser.ts
index 68f05a9df..a257e5020 100644
--- a/src/mol-io/reader/gro/parser.ts
+++ b/src/mol-io/reader/gro/parser.ts
@@ -5,9 +5,9 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
+import { Column } from 'mol-base/collections/table'
 import Tokenizer from '../common/text/tokenizer'
 import FixedColumn from '../common/text/column/fixed'
-import Column from 'mol-base/collections/column'
 import * as Schema from './schema'
 import Result from '../result'
 import Computation from 'mol-base/computation'
diff --git a/src/mol-io/reader/gro/schema.d.ts b/src/mol-io/reader/gro/schema.d.ts
index d5edb09da..fb2d454b7 100644
--- a/src/mol-io/reader/gro/schema.d.ts
+++ b/src/mol-io/reader/gro/schema.d.ts
@@ -5,7 +5,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Column from 'mol-base/collections/column'
+import { Column } from 'mol-base/collections/table'
 
 export interface Header {
     title: string,
diff --git a/src/mol-io/reader/mol2/schema.d.ts b/src/mol-io/reader/mol2/schema.d.ts
index c99074e34..f092b0736 100644
--- a/src/mol-io/reader/mol2/schema.d.ts
+++ b/src/mol-io/reader/mol2/schema.d.ts
@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import Column from 'mol-base/collections/column'
+import { Column } from 'mol-base/collections/table'
 
 // Full format http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf
 // there are many records but for now ignore (pass over) all but the following
diff --git a/src/perf-tests/column.ts b/src/perf-tests/column.ts
index d43a32a5c..2d0699c71 100644
--- a/src/perf-tests/column.ts
+++ b/src/perf-tests/column.ts
@@ -1,5 +1,5 @@
 import * as B from 'benchmark'
-import C from 'mol-base/collections/column'
+import { Column as C } from 'mol-base/collections/table'
 
 export namespace Column {
     function createData(n: number) {
-- 
GitLab