Group group = structure.getParent(); Group rootGroup = structure.getMessage();
public Group getParent() { return unmodifiableStructure(getDelegate().getParent()); }
public Group getParent() { return unmodifiableStructure(getDelegate().getParent()); }
Stack<MessageIterator.Index> indexStack = new Stack<MessageIterator.Index>(); do { MessageIterator.Index index = MessageIterator.getIndex(pathElem.getParent(), pathElem); indexStack.push(index); pathElem = pathElem.getParent(); pathStack.push(pathElem); } while (!root.equals(pathElem) && !Message.class.isAssignableFrom(pathElem.getClass()));
Stack<MessageIterator.Index> indexStack = new Stack<MessageIterator.Index>(); do { MessageIterator.Index index = MessageIterator.getIndex(pathElem.getParent(), pathElem); indexStack.push(index); pathElem = pathElem.getParent(); pathStack.push(pathElem); } while (!root.equals(pathElem) && !Message.class.isAssignableFrom(pathElem.getClass()));
/** * 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; }
private Structure getStructure(String namePattern, int rep) throws HL7Exception { Structure s = null; if (getCurrentStructure(0).equals(this.getRoot())) drillDown(0); String[] names = getCurrentStructure(0).getParent().getNames(); for (int i = 0; i < names.length && s == null; i++) { if (matches(namePattern, names[i])) { toChild(i); s = getCurrentStructure(rep); } } if (s == null) throw new HL7Exception("Can't find " + namePattern + " as a direct child"); return s; }
private Structure getStructure(String namePattern, int rep) throws HL7Exception { Structure s = null; if (getCurrentStructure(0).equals(this.getRoot())) drillDown(0); String[] names = getCurrentStructure(0).getParent().getNames(); for (int i = 0; i < names.length && s == null; i++) { if (matches(namePattern, names[i])) { toChild(i); s = getCurrentStructure(rep); } } if (s == null) throw new HL7Exception("Can't find " + namePattern + " as a direct child"); return s; }