const TracerType = { ArrayTracer: 'ArrayTracer', StackTracer: 'StackTracer', QueueTracer: 'QueueTracer', MatrixTracer: 'MatrixTracer', SortTracer: 'SortTracer', LinkTracer: 'LinkTracer', TreeTracer: 'TreeTracer', GraphTracer: 'GraphTracer', } as const; type TracerTypeKey = keyof typeof TracerType; type TracerTypeVal = (typeof TracerType)[TracerTypeKey]; const ArrayTracerAction = { Define: 'define', Preset: 'preset', Expand: 'expand', Reduce: 'reduce', Pick: 'pick', Drop: 'drop', Patch: 'patch', Reset: 'reset', } as const; type ArrayTracerActionKey = keyof typeof ArrayTracerAction; type ArrayTracerActionVal = (typeof ArrayTracerAction)[ArrayTracerActionKey]; const Action = { ...ArrayTracerAction, } as const; type ActionKey = keyof typeof Action; type ActionVal = (typeof Action)[ActionKey]; class TracerRegistry { private tracers: Record; private constructor() { this.tracers = { ArrayTracer: [], StackTracer: [], QueueTracer: [], MatrixTracer: [], SortTracer: [], LinkTracer: [], TreeTracer: [], GraphTracer: [], }; } public register(tracerType: TracerTypeVal, tracerId: string) { this.tracers[tracerType].push(tracerId); } } interface Command { tracer: string; action: ActionVal; params: any; } class Commander { private commands: Command[]; private constructor() { this.commands = []; } public static command() {} public static serialize() {} } export interface ArrayTracerOption { description: string; serializeFn?: (value: T) => string; } export class ArrayTracer { private tracerId: string; private serializeFn?: (value: T) => string; private constructor(option: ArrayTracerOption) { this.tracerId = crypto.randomUUID(); this.serializeFn = option.serializeFn; } public static define(option: ArrayTracerOption): ArrayTracer { return new ArrayTracer(option); } public preset(array: T[]) {} public expand(size: number) {} public reduce(size: number) {} public pick(index: number) {} public drop(index: number) {} public patch(index: number, value: T) {} public reset(index: number) {} }