protected String insert(Class<? extends Structure> c, boolean required, boolean repeating, boolean choiceElement, int index, String name) throws HL7Exception { // tryToInstantiateStructure(c, name); //may throw exception // see if there is already something by this name and make a new name if // necessary ... if (nameExists(name)) { int version = 2; String newName = name; while (nameExists(newName)) { newName = name + version++; } name = newName; } if (index > this.names.size()) { throw new HL7Exception("Invalid index " + index + " - Should be <= " + this.names.size()); } this.names.add(index, name); this.required.put(name, required); this.repeating.put(name, repeating); this.classes.put(name, c); this.structures.put(name, new ArrayList<Structure>()); if (choiceElement) { this.choiceElements.add(name); } return name; }
protected String insert(Class<? extends Structure> c, boolean required, boolean repeating, boolean choiceElement, int index, String name) throws HL7Exception { // tryToInstantiateStructure(c, name); //may throw exception // see if there is already something by this name and make a new name if // necessary ... if (nameExists(name)) { int version = 2; String newName = name; while (nameExists(newName)) { newName = name + version++; } name = newName; } if (index > this.names.size()) { throw new HL7Exception("Invalid index " + index + " - Should be <= " + this.names.size()); } this.names.add(index, name); this.required.put(name, required); this.repeating.put(name, repeating); this.classes.put(name, c); this.structures.put(name, new ArrayList<Structure>()); if (choiceElement) { this.choiceElements.add(name); } return name; }