import type { Sheet } from './sheet'; /** * we spend a lot of time looking up sheets by name, or id, or * sometimes index. it makes sense to have a class that can * support all of these, ideally without looping. * * we just have to make sure that no one is assigning to the * array, or we'll lose track. * * also there are some operations -- rename, in particular -- that * require updating indexes. * * * FIXME: new file (1 class per file) */ export declare class SheetCollection { /** * returns a read-only copy of the list. useful for indexing or * functional-style calls. it's not actually read-only, but it's a * copy, so changes will be ignored. */ get list(): Sheet[]; /** * length of list */ get length(): number; /** map of (normalized) name -> sheet */ protected names: Map; /** map of id -> sheet */ protected ids: Map; /** the actual list */ private sheets_; /** * remove any existing sheets and add the passed list. updates indexes. */ Assign(sheets: Sheet[]): void; /** * add a new sheet to the end of the list (push). updates indexes. */ Add(sheet: Sheet): void; /** * wrapper for array splice. updates indexes. */ Splice(insert_index: number, delete_count: number, ...items: Sheet[]): void; /** * so our new strategy is to add lookup methods first -- then * we can fix the underlying storage implementation. * * NOTE we normalize strings here so you do not need to do it (don't) */ Find(id: string | number): Sheet | undefined; /** get name for sheet with given id */ Name(id: number): string | undefined; /** get ID for sheet with given name */ ID(name: string): number | undefined; /** not sure why this is private, makes it a little more complicated */ UpdateIndexes(): void; }