* Initialize this pulse based on the values of another pulse. This method * is used internally by fork to initialize a new forked tuple. * The dataflow, time stamp and field modification values are copied over. * By default, new empty ADD, REM and MOD arrays are created. * @param
(src, flags)
| 108144 | * to the new pulse. Use the NO_SOURCE flag to enforce a null source. |
| 108145 | * @return {Pulse} - Returns this Pulse instance. |
| 108146 | */ init (src, flags) { |
| 108147 | const p = this; |
| 108148 | p.stamp = src.stamp; |
| 108149 | p.encode = src.encode; |
| 108150 | if (src.fields && !(flags & NO_FIELDS)) p.fields = src.fields; |
| 108151 | if (flags & ADD) { |
| 108152 | p.addF = src.addF; |
| 108153 | p.add = src.add; |
| 108154 | } else { |
| 108155 | p.addF = null; |
| 108156 | p.add = []; |
| 108157 | } |
| 108158 | if (flags & REM) { |
| 108159 | p.remF = src.remF; |
| 108160 | p.rem = src.rem; |
| 108161 | } else { |
| 108162 | p.remF = null; |
| 108163 | p.rem = []; |
| 108164 | } |
| 108165 | if (flags & MOD) { |
| 108166 | p.modF = src.modF; |
| 108167 | p.mod = src.mod; |
| 108168 | } else { |
| 108169 | p.modF = null; |
| 108170 | p.mod = []; |
| 108171 | } |
| 108172 | if (flags & NO_SOURCE) { |
| 108173 | p.srcF = null; |
| 108174 | p.source = null; |
| 108175 | } else { |
| 108176 | p.srcF = src.srcF; |
| 108177 | p.source = src.source; |
| 108178 | if (src.cleans) p.cleans = src.cleans; |
| 108179 | } |
| 108180 | return p; |
| 108181 | }, |
| 108182 | /** |
| 108183 | * Schedules a function to run after pulse propagation completes. |
| 108184 | * @param {function} func - The function to run. |
no test coverage detected