MCPcopy Create free account
hub / github.com/SeaOfNodes/Simple / popN

Method popN

chapter14/src/main/java/com/seaofnodes/simple/node/Node.java:220–228  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

218 // Shortcut for "popping" n nodes. A "pop" is basically a
219 // setDef(last,null) followed by lowering the nIns() count.
220 void popN(int n) {
221 unlock();
222 for( int i=0; i<n; i++ ) {
223 Node old_def = _inputs.removeLast();
224 if( old_def != null && // If it exists and
225 old_def.delUse(this) ) // If we removed the last use, the old def is now dead
226 old_def.kill(); // Kill old def
227 }
228 }
229
230 /**
231 * Kill a Node with no <em>uses</em>, by setting all of its <em>defs</em>

Callers 1

popMethod · 0.45

Calls 4

unlockMethod · 0.95
delUseMethod · 0.95
killMethod · 0.95
removeLastMethod · 0.45

Tested by

no test coverage detected