MCPcopy Create free account
hub / github.com/BirolLab/RNA-Bloom / hasDepthLeft

Method hasDepthLeft

src/rnabloom/graph/Kmer.java:447–486  ·  view source on GitHub ↗
(int k, int numHash, BloomFilterDeBruijnGraph graph, int depth)

Source from the content-addressed store, hash-verified

445 }
446
447 public boolean hasDepthLeft(int k, int numHash, BloomFilterDeBruijnGraph graph, int depth) {
448 ArrayDeque<PredecessorsNTHashIterator> stack = new ArrayDeque<>(depth);
449 PredecessorsNTHashIterator itr = new PredecessorsNTHashIterator(k, numHash);
450
451 itr.start(fHashVal, bytes[k-1]);
452 stack.add(itr);
453
454 byte[] extension = new byte[depth];
455 int extensionLength = 1;
456 while (extensionLength > 0) {
457 if (extensionLength >= depth) {
458 return true;
459 }
460
461 itr = stack.getLast();
462
463 if (itr.hasNext()) {
464 itr.next();
465 extension[extensionLength-1] = itr.currentChar();
466
467 PredecessorsNTHashIterator nextItr = new PredecessorsNTHashIterator(k, numHash);
468
469 if (extensionLength < k) {
470 nextItr.start(itr.hVals[0], bytes[k-1-extensionLength]);
471 }
472 else {
473 nextItr.start(itr.hVals[0], extension[extensionLength-k]);
474 }
475
476 stack.addLast(nextItr);
477 ++extensionLength;
478 }
479 else {
480 stack.pollLast();
481 --extensionLength;
482 }
483 }
484
485 return false;
486 }
487}

Callers 3

naiveExtendLeftMethod · 0.95
extendLeftMethod · 0.95

Calls 5

startMethod · 0.95
hasNextMethod · 0.95
nextMethod · 0.95
currentCharMethod · 0.95
addMethod · 0.65

Tested by

no test coverage detected