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M,CAAC,CAAC,CAAC;SACnF;QACD,OAAO,wBAAwB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IASD,IAAW,UAAU,KAAK,OAAmB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7D,aAAa,CAAC,KAAQ,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,CAAC,GAAW,IAA2B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5E,QAAQ,CAAC,GAAW,IAAwB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9E,MAAM,CAAC,GAAW,EAAE,GAA0B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACtF,QAAQ,CAAC,GAAW,EAAE,KAAyB,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACtG;AAEA,gBAAgB,CAAC,SAAiB,CAAC,OAAO,GAAG,IAAI,CAAC","file":"dictionary.js","sourcesContent":["// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Vector } from '../vector';\nimport { BaseVector } from './base';\nimport { VectorType as V } from '../interfaces';\nimport { VectorBuilderOptions } from './index';\nimport { vectorFromValuesWithType } from './index';\nimport { VectorBuilderOptionsAsync } from './index';\nimport { DataType, Dictionary, TKeys } from '../type';\n\n/** @ignore */\ntype FromArgs<T extends DataType = any, TKey extends TKeys = TKeys> = [Vector<T>, TKey, ArrayLike<number> | TKey['TArray']];\n\n/** @ignore */\nexport class DictionaryVector<T extends DataType = any, TKey extends TKeys = TKeys> extends BaseVector<Dictionary<T, TKey>> {\n public static from<T extends DataType = any, TKey extends TKeys = TKeys>(...args: FromArgs<T, TKey>): V<Dictionary<T, TKey>>;\n public static from<T extends DataType = any, TKey extends TKeys = TKeys>(input: VectorBuilderOptions<Dictionary<T, TKey>>): Vector<Dictionary<T, TKey>>;\n public static from<T extends DataType = any, TKey extends TKeys = TKeys>(input: VectorBuilderOptionsAsync<Dictionary<T, TKey>>): Promise<Vector<Dictionary<T, TKey>>>;\n /** @nocollapse */\n public static from<T extends DataType = any, TKey extends TKeys = TKeys>(...args: any[]) {\n if (args.length === 3) {\n const [values, indices, keys] = args as FromArgs<T, TKey>;\n const type = new Dictionary(values.type, indices, null, null);\n return Vector.new(Data.Dictionary(type, 0, keys.length, 0, null, keys, values));\n }\n return vectorFromValuesWithType(() => args[0].type, args[0]);\n }\n\n constructor(data: Data<Dictionary<T, TKey>>) {\n super(data);\n this.indices = Vector.new(data.clone(this.type.indices));\n }\n\n public readonly indices: V<TKey>;\n\n public get dictionary() { return <Vector<T>> this.data.dictionary; }\n public reverseLookup(value: T) { return this.dictionary.indexOf(value); }\n public getKey(idx: number): TKey['TValue'] | null { return this.indices.get(idx); }\n public getValue(key: number): T['TValue'] | null { return this.dictionary.get(key); }\n public setKey(idx: number, key: TKey['TValue'] | null) { return this.indices.set(idx, key); }\n public setValue(key: number, value: T['TValue'] | null) { return this.dictionary.set(key, value); }\n}\n\n(DictionaryVector.prototype as any).indices = null;\n"]} |