| 12 | } |
| 13 | |
| 14 | export class StringIterator implements IKeyIterator<string> { |
| 15 | |
| 16 | private _value = ''; |
| 17 | private _pos = 0; |
| 18 | |
| 19 | reset(key: string): this { |
| 20 | this._value = key; |
| 21 | this._pos = 0; |
| 22 | return this; |
| 23 | } |
| 24 | |
| 25 | next(): this { |
| 26 | this._pos += 1; |
| 27 | return this; |
| 28 | } |
| 29 | |
| 30 | hasNext(): boolean { |
| 31 | return this._pos < this._value.length - 1; |
| 32 | } |
| 33 | |
| 34 | cmp(a: string): number { |
| 35 | const aCode = a.charCodeAt(0); |
| 36 | const thisCode = this._value.charCodeAt(this._pos); |
| 37 | return aCode - thisCode; |
| 38 | } |
| 39 | |
| 40 | value(): string { |
| 41 | return this._value[this._pos]; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | export class PathIterator implements IKeyIterator<string> { |
| 46 |
nothing calls this directly
no outgoing calls
no test coverage detected