grab/grap? is a strange name -- maybe call this replaceAndReturnScanNode -- and this looks like it should be another method on AbstractPlanNode -- or maybe on AbstractJoinPlanNode if that's the only kind of node you expect to be traversing.