Stack<MessageIterator.Index> indexStack = new Stack<MessageIterator.Index>(); do { MessageIterator.Index index = MessageIterator.getIndex(pathElem.getParent(), pathElem); indexStack.push(index); pathElem = pathElem.getParent();
Stack<MessageIterator.Index> indexStack = new Stack<MessageIterator.Index>(); do { MessageIterator.Index index = MessageIterator.getIndex(pathElem.getParent(), pathElem); indexStack.push(index); pathElem = pathElem.getParent();
/** * 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; }
Position parentPos = new Position(grandparent, getIndex(grandparent, pos.parent)); matchExists = matchExistsAfterPosition(parentPos, name, firstDescendentsOnly, upToFirstRequired);
Position parentPos = new Position(grandparent, getIndex(grandparent, pos.parent)); matchExists = matchExistsAfterPosition(parentPos, name, firstDescendentsOnly, upToFirstRequired);
} else if (!makeNewSegmentIfNeeded || matchExistsAfterPosition(currPos, direction, false, true)) { Group grandparent = currPos.parent.getParent(); Index parentIndex = getIndex(grandparent, currPos.parent); Position parentPos = new Position(grandparent, parentIndex);
e.setSegmentRepetition(MessageIterator.getIndex(destination.getParent(), destination).rep); e.setSegmentName(destination.getName()); throw e;
} else if (!makeNewSegmentIfNeeded || matchExistsAfterPosition(currPos, direction, false, true)) { Group grandparent = currPos.parent.getParent(); Index parentIndex = getIndex(grandparent, currPos.parent); Position parentPos = new Position(grandparent, parentIndex);
e.setSegmentRepetition(MessageIterator.getIndex(destination.getParent(), destination).rep); e.setSegmentName(destination.getName()); throw e;