/** * @param theRoot root of depth first iteration, which starts with the first child * @return an iterator that skips groups and empty segments, returning only populated * segments */ public static Iterator<Structure> createPopulatedSegmentIterator(Group theRoot) { return createPopulatedStructureIterator(theRoot, Segment.class); }
/** * @param theRoot root of depth first iteration, which starts with the first child * @return an iterator that skips groups and empty segments, returning only populated * segments */ public static Iterator<Structure> createPopulatedSegmentIterator(Group theRoot) { return createPopulatedStructureIterator(theRoot, Segment.class); }
/** * @param theRoot root of depth first iteration, which starts with the first child * @param c structure class to look for * @return an iterator that skips all structures that do not match the parameter */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, Class<? extends Structure> c) { return createPopulatedStructureIterator(theRoot, new StructurePredicate(c)); }
/** * @param theRoot root of depth first iteration, which starts with the first child * @param c structure class to look for * @return an iterator that skips all structures that do not match the parameter */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, Class<? extends Structure> c) { return createPopulatedStructureIterator(theRoot, new StructurePredicate(c)); }
/** * @param theRoot root of depth first iteration, which starts with the first child * @param structureName structure name to look for * @return an iterator that skips all structures that do not match the parameter */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, String structureName) { return createPopulatedStructureIterator(theRoot, new StructureNamePredicate(structureName)); }
/** * @param theRoot root of depth first iteration, which starts with the first child * @param structureName structure name to look for * @return an iterator that skips all structures that do not match the parameter */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, String structureName) { return createPopulatedStructureIterator(theRoot, new StructureNamePredicate(structureName)); }
public ValidationException[] apply(Message msg) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); for (Iterator<Structure> iter = ReadOnlyMessageIterator .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) { String segmentName = iter.next().getName(); ValidationException ve = new ValidationException("Found unknown segment: " + segmentName); Location location = new Location().withSegmentName(segmentName); ve.setLocation(location); exceptions.add(ve); } return exceptions.toArray(new ValidationException[exceptions.size()]); }
public ValidationException[] apply(Message msg) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); for (Iterator<Structure> iter = ReadOnlyMessageIterator .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) { String segmentName = iter.next().getName(); ValidationException ve = new ValidationException("Found unknown segment: " + segmentName); Location location = new Location().withSegmentName(segmentName); ve.setLocation(location); exceptions.add(ve); } return exceptions.toArray(new ValidationException[exceptions.size()]); }