/** * @param theRoot root of depth first iteration, which starts with the first child * @param structureFilter filter class * @return iterator that skips all structures that the filter does not accept */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, FilterIterator.Predicate<Structure> structureFilter) { Iterator<Structure> allIterator = new ReadOnlyMessageIterator(theRoot); Iterator<Structure> structureIterator = new FilterIterator<Structure>(allIterator, structureFilter); FilterIterator.Predicate<Structure> populatedOnly = new FilterIterator.Predicate<Structure>() { public boolean evaluate(Structure obj) { try { return !obj.isEmpty(); } catch (HL7Exception e) { return false; // no exception expected } } }; return new FilterIterator<Structure>(structureIterator, populatedOnly); }
public boolean hasNext() { if (nextObjectSet) { return true; } else { return setNextObject(); } }
FilterIterator<Structure> segmentIter = new FilterIterator<Structure>(messageIter, segmentsOnly); FilterIterator<Structure> dirIter = new FilterIterator<Structure>(segmentIter, byDirection); if (dirIter.hasNext()) { parse((Segment) dirIter.next(), segments[i], getEncodingChars(string));
FilterIterator<Structure> segmentIter = new FilterIterator<Structure>(messageIter, segmentsOnly); FilterIterator<Structure> dirIter = new FilterIterator<Structure>(segmentIter, byDirection); if (dirIter.hasNext()) { parse((Segment) dirIter.next(), segments[i], getEncodingChars(string));
public boolean hasNext() { if (nextObjectSet) { return true; } else { return setNextObject(); } }
/** * @param theRoot root of depth first iteration, which starts with the first child * @param structureFilter filter class * @return iterator that skips all structures that the filter does not accept */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, FilterIterator.Predicate<Structure> structureFilter) { Iterator<Structure> allIterator = new ReadOnlyMessageIterator(theRoot); Iterator<Structure> structureIterator = new FilterIterator<Structure>(allIterator, structureFilter); FilterIterator.Predicate<Structure> populatedOnly = new FilterIterator.Predicate<Structure>() { public boolean evaluate(Structure obj) { try { return !obj.isEmpty(); } catch (HL7Exception e) { return false; // no exception expected } } }; return new FilterIterator<Structure>(structureIterator, populatedOnly); }
public T next() { if (!nextObjectSet) { if (!setNextObject()) { throw new NoSuchElementException(); } } nextObjectSet = false; return nextObject; }
it = new FilterIterator<Structure>(it, new StructurePredicate(Segment.class));
public T next() { if (!nextObjectSet) { if (!setNextObject()) { throw new NoSuchElementException(); } } nextObjectSet = false; return nextObject; }
it = new FilterIterator<Structure>(it, new StructurePredicate(Segment.class));