stream: node count
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-07-17 13:29:03 +02:00
parent 040e421d9b
commit de5810d368
4 changed files with 19 additions and 3 deletions

View File

@ -21,6 +21,7 @@ interface Stringable {
}
export class GraphStream extends Transform {
private _node_count = 0;
private _path: string[] = [];
private _state: (GraphStreamCommand | '')[] = [
'',
@ -33,6 +34,10 @@ export class GraphStream extends Transform {
return this._path.join ('_');
}
public get node_count (): number {
return this._node_count;
}
private get level (): string {
return ' '.repeat (this._path.length);
}
@ -114,6 +119,7 @@ export class GraphStream extends Transform {
case 'cn': // create node
this.finish_node ();
this.push (`${this.level}${this.path}_${instr.args[0]}`);
this._node_count++;
break;
case 'at': // add attributes
if ([