NXFHSO7QRL6QWEPDEK4E25UIYLH2HQX4BDWA5IHXSZQCGM6LV2YAC
3J7QNHQ4F2VBYCK6SWKPO3AW3YYAJZNWOW6XNSURSRDZOE2ZIGQAC
Z3E7XJOW6NSBDYRDKSGTOAEJSPATAUX4JUFCL4DIL3372GL4K52QC
HUH4SI4HXIP72KQSJP2I4ELHX5KUQZM7FFGKZZGJ33DF7E3JHMYQC
DFFMZSJOCLTBA3IGRYS2ZIJNO2MC3VLBBU42QL5DFY2SMCNFXPIAC
TQ57VE45BHV7MOZ6GKTYZEAMAOTXLPQ3ROCWJ2FUCITQWOYVMUIAC
FEYZALRNZQFN7QWCJGGTHHAYUN2OSSWD7SITQMOZIGQFUMWRFFCQC
3UFL673QX2JG7KHTAM7DFH4BBYVHDNMXBS2RW45G3JBNFZFLSRRQC
CZPLX4O4R7K3TF3NSAL5PT7NO3CUOLDY3OR332GBIYYNKMZTW24AC
/**
* Intended as a typescript-friendly replacement for {[k: string]: boolean} that allows us to specify what the key type should be (
* rather than allowing any keyType.toString() to be a valid key, and without going through the trouble of declaring distinguishable
* types for each key type we want to use). Also serves as a slightly different version of ES6 native Set(), which is hardcoded
* to use === for object referential equality.
*
* NOTE: this assume hash() is a strong test for equality, i.e. 2 objects are considered equal if and only if their hashes are the same!!!
* TODO: write StrictHashSet<K extends {hash(): string, equals(k: K): boolean}> to handle custom equality checks
*/
*[Symbol.iterator]() {
// construct a new iterator. note that as usual
for (let key of Object.keys(this._values)) {
yield key;
}
}
// *[Symbol.iterator]() {
// // construct a new iterator. note that as usual
// for (let key of Object.keys(this._values)) {
// yield key;
// }
// }
/**
* Intended as a typescript-friendly replacement for {[k: string]: V} that allows us to specify what the key type should be (
* rather than allowing any keyType.toString() to be a valid key, and without going through the trouble of declaring distinguishable
* types for each key type we want to use). Also serves as a slightly different version of ES6 native Map(), which is hardcoded
* to use === for object referential equality.
*
* NOTE: this assume hash() is a strong test for equality, i.e. 2 objects are considered equal if and only if their hashes are the same!!!
* TODO: write StrictHashMap<K extends {hash(): string, equals(K): boolean}> to handle custom equality checks
*/
*[Symbol.iterator]() {
// construct a new iterator. note that as usual
for (let key of Object.keys(this._values)) {
yield key;
}
}
// *[Symbol.iterator]() {
// // construct a new iterator. note that as usual editing the object during iteration is not supported
// for (let key of Object.keys(this._values)) {
// yield key;
// }
// }
hashKeyset(): string {
const hashes: number[] = Object.keys(this._values).map(s => hashCode(s));
let code: number = hashes.reduce((pv, cv) => pv + cv);
return code.toString();
}
// hashKeyset(): string {
// const hashes: number[] = Object.keys(this._values).map(s => hashCode(s));
// let code: number = hashes.reduce((pv, cv) => pv + cv);
// return code.toString();
// }