UNPKG

@firebase/firestore

Version:

This is the [Cloud Firestore](https://firebase.google.com/docs/firestore/) component of the [Firebase JS SDK](https://www.npmjs.com/package/firebase).

101 lines (100 loc) 4.02 kB
/** * @license * Copyright 2017 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export declare type Comparator<K> = (key1: K, key2: K) => number; export interface Entry<K, V> { key: K; value: V; } export declare class SortedMap<K, V> { comparator: Comparator<K>; root: LLRBNode<K, V> | LLRBEmptyNode<K, V>; constructor(comparator: Comparator<K>, root?: LLRBNode<K, V> | LLRBEmptyNode<K, V>); insert(key: K, value: V): SortedMap<K, V>; remove(key: K): SortedMap<K, V>; get(key: K): V | null; indexOf(key: K): number; isEmpty(): boolean; get size(): number; minKey(): K | null; maxKey(): K | null; inorderTraversal<T>(action: (k: K, v: V) => T): T; forEach(fn: (k: K, v: V) => void): void; toString(): string; reverseTraversal<T>(action: (k: K, v: V) => T): T; getIterator(): SortedMapIterator<K, V>; getIteratorFrom(key: K): SortedMapIterator<K, V>; getReverseIterator(): SortedMapIterator<K, V>; getReverseIteratorFrom(key: K): SortedMapIterator<K, V>; } export declare class SortedMapIterator<K, V> { private isReverse; private nodeStack; constructor(node: LLRBNode<K, V> | LLRBEmptyNode<K, V>, startKey: K | null, comparator: Comparator<K>, isReverse: boolean); getNext(): Entry<K, V>; hasNext(): boolean; peek(): Entry<K, V> | null; } export declare class LLRBNode<K, V> { key: K; value: V; readonly color: boolean; readonly left: LLRBNode<K, V> | LLRBEmptyNode<K, V>; readonly right: LLRBNode<K, V> | LLRBEmptyNode<K, V>; readonly size: number; static EMPTY: LLRBEmptyNode<any, any>; static RED: boolean; static BLACK: boolean; constructor(key: K, value: V, color?: boolean, left?: LLRBNode<K, V> | LLRBEmptyNode<K, V>, right?: LLRBNode<K, V> | LLRBEmptyNode<K, V>); copy(key: K | null, value: V | null, color: boolean | null, left: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null, right: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null): LLRBNode<K, V>; isEmpty(): boolean; inorderTraversal<T>(action: (k: K, v: V) => T): T; reverseTraversal<T>(action: (k: K, v: V) => T): T; private min; minKey(): K | null; maxKey(): K | null; insert(key: K, value: V, comparator: Comparator<K>): LLRBNode<K, V>; private removeMin; remove(key: K, comparator: Comparator<K>): LLRBNode<K, V> | LLRBEmptyNode<K, V>; isRed(): boolean; private fixUp; private moveRedLeft; private moveRedRight; private rotateLeft; private rotateRight; private colorFlip; checkMaxDepth(): boolean; protected check(): number; } export declare class LLRBEmptyNode<K, V> { get key(): never; get value(): never; get color(): never; get left(): never; get right(): never; size: number; copy(key: K | null, value: V | null, color: boolean | null, left: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null, right: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null): LLRBEmptyNode<K, V>; insert(key: K, value: V, comparator: Comparator<K>): LLRBNode<K, V>; remove(key: K, comparator: Comparator<K>): LLRBEmptyNode<K, V>; isEmpty(): boolean; inorderTraversal(action: (k: K, v: V) => boolean): boolean; reverseTraversal(action: (k: K, v: V) => boolean): boolean; minKey(): K | null; maxKey(): K | null; isRed(): boolean; checkMaxDepth(): boolean; protected check(): 0; }