import { Point } from '../core/Components' ; /**
 * A simple data structure that keeps track of whether keys have been added to it
 */ export class HashSet { private map : { [ key ] : boolean | undefined ; } = { } ; add ( key ) { this . map [ key ] = true ; } remove ( key ) { this . map [ key ] = undefined ; } has ( key ) { return this . map [ key ] !== undefined ; } clear ( ) { this . map = { } ; } } /**
 * A simple data structure that stores a type at a key
 */ export class HashTable < Value > { private map : { [ key ] : Value | undefined ; } = { } ; add ( key , data ) { this . map [ key ] = data ; } remove ( key ) { this . map [ key ] = undefined ; } get ( key ) { return this . map [ key ] ; } has ( key ) { return this . map [ key ] !== undefined ; } values ( ) { const values = [ ] ; for ( const i in this . map ) { if ( this . map [ i ] !== undefined ) { values . push ( this . map [ i ] ! ) ; } } return values ; } clone ( ) { const table = new HashTable < Value > ( ) ; table . map = Object . assign ( { } , this . map ) ; return table ; } clear ( ) { this . map = { } ; } } param point export function stringify ( point ) { return 'x' + point . x + 'y' + point . y ; }