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yB,GAAG,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,wBAAwB,GAAI,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,SAAS,GAAmB,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,eAAe,GAAa,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,oBAAoB,GAAQ,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,oBAAoB,GAAQ,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,mBAAmB,GAAS,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,YAAY,GAAgB,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,SAAS,GAAmB,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,WAAW,GAAiB,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,UAAU,GAAkB,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,eAAe,GAAa,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,gBAAgB,GAAY,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,eAAe,GAAa,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,aAAa,GAAe,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,oBAAoB,GAAQ,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,sBAAsB,GAAM,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,kBAAkB,GAAU,YAAY,CAAC;AAClE,cAAc,CAAC,SAAS,CAAC,QAAQ,GAAoB,YAAY,CAAC;AAElE,cAAc;AACd,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC","file":"indexof.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 { Type } from '../enum';\nimport { Visitor } from '../visitor';\nimport { VectorType } from '../interfaces';\nimport { getBool, iterateBits } from '../util/bit';\nimport { createElementComparator } from '../util/vector';\nimport {\n DataType, Dictionary,\n Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary, List, FixedSizeList, Map_, Struct,\n Float, Float16, Float32, Float64,\n Int, Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64,\n Date_, DateDay, DateMillisecond,\n Interval, IntervalDayTime, IntervalYearMonth,\n Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n Union, DenseUnion, SparseUnion,\n} from '../type';\n\n/** @ignore */\nexport interface IndexOfVisitor extends Visitor {\n visit (node: T, value: T['TValue'] | null, index?: number): number;\n visitMany (nodes: T[], values: (T['TValue'] | null)[], indices: (number | undefined)[]): number[];\n getVisitFn (node: T): (vector: VectorType, value: VectorType['TValue'] | null, index?: number) => number;\n getVisitFn(node: VectorType | Data | T): (vector: VectorType, value: T['TValue'] | null, index?: number) => number;\n visitNull (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitBool (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt8 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt16 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt32 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt64 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUint8 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUint16 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUint32 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUint64 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFloat (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFloat16 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFloat32 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFloat64 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUtf8 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitBinary (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFixedSizeBinary (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDate (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDateDay (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDateMillisecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestamp (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestampSecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestampMillisecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestampMicrosecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestampNanosecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTime (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimeSecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimeMillisecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimeMicrosecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimeNanosecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDecimal (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitList (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitStruct (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUnion (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDenseUnion (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitSparseUnion (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDictionary (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInterval (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitIntervalDayTime (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitIntervalYearMonth (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFixedSizeList (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitMap (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n}\n\n/** @ignore */\nexport class IndexOfVisitor extends Visitor {}\n\n/** @ignore */\nfunction nullIndexOf(vector: VectorType, searchElement?: null) {\n // if you're looking for nulls and the vector isn't empty, we've got 'em!\n return searchElement === null && vector.length > 0 ? 0 : -1;\n}\n\n/** @ignore */\nfunction indexOfNull(vector: VectorType, fromIndex?: number): number {\n const { nullBitmap } = vector;\n if (!nullBitmap || vector.nullCount <= 0) {\n return -1;\n }\n let i = 0;\n for (const isValid of iterateBits(nullBitmap, vector.data.offset + (fromIndex || 0), vector.length, nullBitmap, getBool)) {\n if (!isValid) { return i; }\n ++i;\n }\n return -1;\n}\n\n/** @ignore */\nfunction indexOfValue(vector: VectorType, searchElement?: T['TValue'] | null, fromIndex?: number): number {\n if (searchElement === undefined) { return -1; }\n if (searchElement === null) { return indexOfNull(vector, fromIndex); }\n const compare = createElementComparator(searchElement);\n for (let i = (fromIndex || 0) - 1, n = vector.length; ++i < n;) {\n if (compare(vector.get(i))) {\n return i;\n }\n }\n return -1;\n}\n\n/** @ignore */\nfunction indexOfUnion(vector: VectorType, searchElement?: T['TValue'] | null, fromIndex?: number): number {\n // Unions are special -- they do have a nullBitmap, but so can their children.\n // If the searchElement is null, we don't know whether it came from the Union's\n // bitmap or one of its childrens'. So we don't interrogate the Union's bitmap,\n // since that will report the wrong index if a child has a null before the Union.\n const compare = createElementComparator(searchElement);\n for (let i = (fromIndex || 0) - 1, n = vector.length; ++i < n;) {\n if (compare(vector.get(i))) {\n return i;\n }\n }\n return -1;\n}\n\nIndexOfVisitor.prototype.visitNull = nullIndexOf;\nIndexOfVisitor.prototype.visitBool = indexOfValue;\nIndexOfVisitor.prototype.visitInt = indexOfValue;\nIndexOfVisitor.prototype.visitInt8 = indexOfValue;\nIndexOfVisitor.prototype.visitInt16 = indexOfValue;\nIndexOfVisitor.prototype.visitInt32 = indexOfValue;\nIndexOfVisitor.prototype.visitInt64 = indexOfValue;\nIndexOfVisitor.prototype.visitUint8 = indexOfValue;\nIndexOfVisitor.prototype.visitUint16 = indexOfValue;\nIndexOfVisitor.prototype.visitUint32 = indexOfValue;\nIndexOfVisitor.prototype.visitUint64 = indexOfValue;\nIndexOfVisitor.prototype.visitFloat = indexOfValue;\nIndexOfVisitor.prototype.visitFloat16 = indexOfValue;\nIndexOfVisitor.prototype.visitFloat32 = indexOfValue;\nIndexOfVisitor.prototype.visitFloat64 = indexOfValue;\nIndexOfVisitor.prototype.visitUtf8 = indexOfValue;\nIndexOfVisitor.prototype.visitBinary = indexOfValue;\nIndexOfVisitor.prototype.visitFixedSizeBinary = indexOfValue;\nIndexOfVisitor.prototype.visitDate = indexOfValue;\nIndexOfVisitor.prototype.visitDateDay = indexOfValue;\nIndexOfVisitor.prototype.visitDateMillisecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimestamp = indexOfValue;\nIndexOfVisitor.prototype.visitTimestampSecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimestampMillisecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimestampMicrosecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimestampNanosecond = indexOfValue;\nIndexOfVisitor.prototype.visitTime = indexOfValue;\nIndexOfVisitor.prototype.visitTimeSecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimeMillisecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimeMicrosecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimeNanosecond = indexOfValue;\nIndexOfVisitor.prototype.visitDecimal = indexOfValue;\nIndexOfVisitor.prototype.visitList = indexOfValue;\nIndexOfVisitor.prototype.visitStruct = indexOfValue;\nIndexOfVisitor.prototype.visitUnion = indexOfValue;\nIndexOfVisitor.prototype.visitDenseUnion = indexOfUnion;\nIndexOfVisitor.prototype.visitSparseUnion = indexOfUnion;\nIndexOfVisitor.prototype.visitDictionary = indexOfValue;\nIndexOfVisitor.prototype.visitInterval = indexOfValue;\nIndexOfVisitor.prototype.visitIntervalDayTime = indexOfValue;\nIndexOfVisitor.prototype.visitIntervalYearMonth = indexOfValue;\nIndexOfVisitor.prototype.visitFixedSizeList = indexOfValue;\nIndexOfVisitor.prototype.visitMap = indexOfValue;\n\n/** @ignore */\nexport const instance = new IndexOfVisitor();\n"]}