/** * Constructs an instance representing the entire blip content. * * @param blip the blip to represent. * @return an instance of blip references. */ public static BlipContentRefs all(Blip blip) { return new BlipContentRefs(blip, new BlipIterator.SingleshotIterator(blip, 0, blip.getContent().length())); }
/** * Constructs an instance representing an explicitly set range. * * @param blip the blip to represent. * @param start the start index of the range. * @param end the end index of the range. * @return an instance of blip references. */ public static BlipContentRefs range(Blip blip, int start, int end) { return new BlipContentRefs(blip, new BlipIterator.SingleshotIterator(blip, start, end), Parameter.of(ParamsProperty.RANGE, new Range(start, end))); }
public void testSingleshotIterator() throws Exception { Blip blip = new Blip("blip1", "\n1 1 1", null, null, wavelet); SingleshotIterator iterator = new BlipIterator.SingleshotIterator(blip, 0, 1); assertTrue(iterator.hasNext()); Range range = iterator.next(); assertEquals(0, range.getStart()); assertEquals(1, range.getEnd()); assertFalse(iterator.hasNext()); }
public void testSingleshotIterator() throws Exception { Blip blip = new Blip("blip1", "\n1 1 1", null, null, wavelet); SingleshotIterator iterator = new BlipIterator.SingleshotIterator(blip, 0, 1); assertTrue(iterator.hasNext()); Range range = iterator.next(); assertEquals(0, range.getStart()); assertEquals(1, range.getEnd()); assertFalse(iterator.hasNext()); }