private BranchTuples getBranchTuples ( LeftTupleSink sink , LeftTuple leftTuple ) { BranchTuples branchTuples = new BranchTuples ( ) ; LeftTuple child = leftTuple . getFirstChild ( ) ; if ( child != null ) { // assigns the correct main or rtn LeftTuple based on the identified sink if ( child . getTupleSink ( ) == sink ) { branchTuples . mainLeftTuple = child ; } else { branchTuples . rtnLeftTuple = child ; } child = child . getHandleNext ( ) ; if ( child != null ) { if ( child . getTupleSink ( ) == sink ) { branchTuples . mainLeftTuple = child ; } else { branchTuples . rtnLeftTuple = child ; } } } return branchTuples ; }
A branch has two potential sinks . rtnSink is for the sink if the contained logic returns true . mainSink is for propagations after the branch node if they are allowed . it may have one or the other or both . there is no state that indicates whether one or the other or both are present so all tuple children must be inspected and references coalesced from that . when handling updates and deletes it must search the child tuples to colasce the references . This is done by checking the tuple sink with the known main or rtn sink .