Alignments { public static List<Range<Long>> gaps(final GappedSymbolList gappedSymbols) { checkNotNull(gappedSymbols); List<Range<Long>> gaps = new ArrayList<Range<Long>>(); int gapStart = -1; for (int i = 1, length = gappedSymbols.length() + 1; i < length; i++) { if (isGapSymbol(gappedSymbols.symbolAt(i))) { if (gapStart < 0) { gapStart = i; } } else { if (gapStart > 0) { gaps.add(Range.closedOpen(Long.valueOf(gapStart - 1L), Long.valueOf(i - 1L))); gapStart = -1; } } } if (gapStart > 0) { gaps.add(Range.closedOpen(Long.valueOf(gapStart - 1L), Long.valueOf(gappedSymbols.length()))); } return gaps; } private  Alignments(); static long length(final Range<Long> range); static List<Long> lengths(final Iterable<Range<Long>> ranges); static long length(final Iterable<Range<Long>> ranges); static long maximumLength(final Iterable<Range<Long>> ranges); static int count(final Iterable<Range<Long>> ranges); static List<Long> starts(final Iterable<Range<Long>> ranges); static List<Long> ends(final Iterable<Range<Long>> ranges); static List<Range<Long>> gaps(final GappedSymbolList gappedSymbols); static List<Range<Long>> matches(final AlignmentPair alignmentPair); static List<Range<Long>> mismatches(final AlignmentPair alignmentPair);  }
@Test(expected=NullPointerException.class) public void testGapsNull() { gaps(null); }
@Test public void testGapsNoGaps() { assertEquals(Collections.<Range<Long>>emptyList(), gaps(subject)); }
@Test public void testGapsAllGaps() throws Exception { GappedSequence allGaps = DNATools.createGappedDNASequence("--------------------", "all gaps"); List<Range<Long>> gaps = gaps(allGaps); assertEquals(1, gaps.size()); assertEquals(Range.closedOpen(0L, 20L), gaps.get(0)); }
@Test public void testGaps() { List<Range<Long>> gaps = gaps(query); assertEquals(1, gaps.size()); assertEquals(Range.closedOpen(12L, 16L), gaps.get(0)); }