boolean betterChain(struct indexedChain *ixc, int start, int end, int* blockStarts, int *blockSizes, int blockCount, struct indexedChain **bestIxc, int *bestCover) /* Return TRUE if chain is a better fit than bestChain. If TRUE fill in bestChain and bestCover. */ { int blocksCovered = 0; boolean better = FALSE; /* Check for easy case. */ if (ixc == NULL) return FALSE; struct chain *chain = ixc->chain; if(chain == NULL || chain->tStart > end || chain->tStart + chain->tSize < start) return FALSE; blocksCovered = chainBlockCoverage(ixc, start, end, blockStarts, blockSizes, blockCount); if(blocksCovered > (*bestCover)) { *bestIxc = ixc; *bestCover = blocksCovered; better = TRUE; } return better; }
boolean betterChain(struct chain *chain, int start, int end, int* blockStarts, int *blockSizes, int blockCount, struct chain **bestChain, int *bestCover) /* Return TRUE if chain is a better fit than bestChain. If TRUE fill in bestChain and bestCover. */ { struct chain *subChain=NULL, *toFree=NULL; int blocksCovered = 0; boolean better = FALSE; /* Check for easy case. */ if(chain == NULL || chain->tStart > end || chain->tStart + chain->tSize < start) return FALSE; blocksCovered = chainBlockCoverage(chain, start, end, blockStarts, blockSizes, blockCount); if(blocksCovered > (*bestCover)) { *bestChain = chain; *bestCover = blocksCovered; better = TRUE; } return better; }