/** * Returns true if another object exists in the iteration sequence. */ public boolean hasNext() { boolean has = true; if (next == null) { if (Group.class.isAssignableFrom(currentStructure.getClass())) { groupNext((Group) currentStructure); } else { Group parent = currentStructure.getParent(); Index i = getIndex(parent, currentStructure); Position currentPosition = new Position(parent, i); try { if (parent.isRepeating(i.name) && currentStructure.getName().equals(direction)) { nextRep(currentPosition); } else { has = nextPosition(currentPosition, this.direction, this.handleUnexpectedSegments); } } catch (HL7Exception e) { throw new Error("HL7Exception arising from bad index: " + e.getMessage()); } } } log.debug("MessageIterator.hasNext() in direction {}? {}", direction, has); return has; }
/** * Returns true if another object exists in the iteration sequence. */ public boolean hasNext() { boolean has = true; if (next == null) { if (Group.class.isAssignableFrom(currentStructure.getClass())) { groupNext((Group) currentStructure); } else { Group parent = currentStructure.getParent(); Index i = getIndex(parent, currentStructure); Position currentPosition = new Position(parent, i); try { if (parent.isRepeating(i.name) && currentStructure.getName().equals(direction)) { nextRep(currentPosition); } else { has = nextPosition(currentPosition, this.direction, this.handleUnexpectedSegments); } } catch (HL7Exception e) { throw new Error("HL7Exception arising from bad index: " + e.getMessage()); } } } log.debug("MessageIterator.hasNext() in direction {}? {}", direction, has); return has; }
boolean parentRepeats = parentPos.parent.isRepeating(parentPos.index.name); if (parentRepeats && contains(parentPos.parent.get(parentPos.index.name, 0), direction, false, true)) { nextRep(parentPos); } else { nextExists = nextPosition(parentPos, direction, makeNewSegmentIfNeeded);
boolean parentRepeats = parentPos.parent.isRepeating(parentPos.index.name); if (parentRepeats && contains(parentPos.parent.get(parentPos.index.name, 0), direction, false, true)) { nextRep(parentPos); } else { nextExists = nextPosition(parentPos, direction, makeNewSegmentIfNeeded);