File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ class Filter extends Reactor {
9090 } else {
9191 // Potential prime found.
9292 if ( ! hasChild . get ( ) ) {
93- const n = new Filter ( this . getReactor ( ) , p , numberOfPrimes ) ;
93+ const n = this . getReactor ( ) . _uncheckedAddSibling ( Filter , p , numberOfPrimes ) ;
9494 // this.start(n)
9595 // console.log("CREATING...")
9696 // let x = this.create(Filter, [this.getReactor(), p])
Original file line number Diff line number Diff line change @@ -1555,6 +1555,27 @@ export abstract class Reactor extends Component {
15551555 toString ( ) : string {
15561556 return this . _getFullyQualifiedName ( ) ;
15571557 }
1558+
1559+ public _uncheckedAddChild < R extends Reactor , G extends unknown [ ] > (
1560+ constructor :new ( container : Reactor , ...args : G ) => R ,
1561+ ...args : G
1562+ ) : R {
1563+ const newReactor = new constructor ( this , ...args ) ;
1564+ return newReactor ;
1565+ }
1566+
1567+ public _uncheckedAddSibling < R extends Reactor , G extends unknown [ ] > (
1568+ constructor :new ( container : Reactor , ...args : G ) => R ,
1569+ ...args : G
1570+ ) : R {
1571+ if ( this . _getContainer ( ) == null ) {
1572+ throw new Error ( `Reactor ${ this } does not have a parent. Sibling is not well-defined.` ) ;
1573+ }
1574+ if ( this . _getContainer ( ) === this ) {
1575+ throw new Error ( `Reactor ${ this } is self-contained. Adding sibling creates logical issue.` ) ;
1576+ }
1577+ return this . _getContainer ( ) . _uncheckedAddChild ( constructor , ...args ) ;
1578+ }
15581579}
15591580
15601581/*
You can’t perform that action at this time.
0 commit comments