"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapSharedRefArrayInterface = wrapSharedRefArrayInterface;
exports.wrapArray = wrapArray;
exports.wrapUint8Array = wrapUint8Array;
const _1 = require("../Class/$");
const MethodNotImplementedError_1 = require("../exception/MethodNotImplementedError");
function wrapSharedRefArrayInterface(data) {
    return {
        append(a) {
            data.current.push(a);
            return;
        },
        put(i, data) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        },
        at(i) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        },
        length() {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        },
        indexOf(a) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        },
    };
}
function wrapArray(array, system) {
    const _array = new (class Array extends _1.$ {
        constructor() {
            super(...arguments);
            this.__ = ['A'];
        }
        async append(a) {
            array.push(a);
        }
        put(i, data) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        }
        async at(i) {
            return array[i];
        }
        async length() {
            return array.length;
        }
        indexOf(a) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        }
    })(system);
    return _array;
}
function wrapUint8Array(array, system) {
    const _array = new (class Array extends _1.$ {
        constructor() {
            super(...arguments);
            this.__ = ['A'];
        }
        buffer() {
            return array.buffer;
        }
        async read() {
            return [...array];
        }
        async write(data) {
            throw array.set(data);
        }
        append(a) {
            array[array.length] = a;
            return;
        }
        async put(i, data) {
            array[i] = data;
        }
        async at(i) {
            return array[i];
        }
        async length() {
            return array.length;
        }
        indexOf(a) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        }
        set(array_, offset) {
            array.set(array_, offset);
        }
        raw() {
            return array;
        }
    })(system);
    return _array;
}
//# sourceMappingURL=Array.js.map