public HapiField(final Type type) { this.value = PipeParser.encode(type, EncodingCharacters.defaultInstance()); final List<HL7Component> componentList = new ArrayList<>(); if (type instanceof Composite) { final Composite composite = (Composite) type; for (final Type component : composite.getComponents()) { componentList.add(new HapiField(component)); } } final ExtraComponents extra = type.getExtraComponents(); if (extra != null && extra.numComponents() > 0) { final String singleFieldValue; if (type instanceof Primitive) { singleFieldValue = ((Primitive) type).getValue(); } else { singleFieldValue = this.value; } componentList.add(new SingleValueField(singleFieldValue)); for (int i = 0; i < extra.numComponents(); i++) { componentList.add(new HapiField(extra.getComponent(i))); } } this.components = Collections.unmodifiableList(componentList); }
@Override public int numComponents() { return delegate.numComponents(); }
@Override public int numComponents() { return delegate.numComponents(); }
/** * Returns the number of components in the given type, i.e. the number of standard components * (e.g. 6 for CE) plus any extra components that have been added at runtime. * * @param t composite type * @return the number of components in the given type */ public static int numComponents(Type t) { if (!(t instanceof Varies)) { return numStandardComponents(t) + t.getExtraComponents().numComponents(); } return numComponents(((Varies) t).getData()); }
/** * Returns the number of components in the given type, i.e. the number of standard components * (e.g. 6 for CE) plus any extra components that have been added at runtime. * * @param t composite type * @return the number of components in the given type */ public static int numComponents(Type t) { if (!(t instanceof Varies)) { return numStandardComponents(t) + t.getExtraComponents().numComponents(); } return numComponents(((Varies) t).getData()); }
if (index != -1) { String nextSubComponent = string.substring(prevIndex, index); getExtraComponents().getComponent(getExtraComponents().numComponents()).parse(nextSubComponent); } else { String nextSubComponent = string.substring(prevIndex); if (nextSubComponent.length() > 0) { getExtraComponents().getComponent(getExtraComponents().numComponents()).parse(nextSubComponent);
if (index != -1) { String nextSubComponent = string.substring(prevIndex, index); getExtraComponents().getComponent(getExtraComponents().numComponents()).parse(nextSubComponent); } else { String nextSubComponent = string.substring(prevIndex); if (nextSubComponent.length() > 0) { getExtraComponents().getComponent(getExtraComponents().numComponents()).parse(nextSubComponent);
public boolean accept(MessageVisitor visitor, Location location) throws HL7Exception { if (visitor.start(this, location)) { Type[] types = getComponents(); for (int i = 0; i < types.length; i++) { Type t = getComponent(i); Location nextLocation = t.provideLocation(location, i + 1, location.getFieldRepetition()); if (!t.accept(visitor, nextLocation)) break; } ExtraComponents ec = getExtraComponents(); for (int i = 0; i < ec.numComponents(); i++) { Variable v = ec.getComponent(i); Location nextLocation = v.provideLocation(location, i + types.length, -1); if (!v.accept(visitor, nextLocation)) break; } } return visitor.end(this, location); }
public boolean accept(MessageVisitor visitor, Location location) throws HL7Exception { if (visitor.start(this, location)) { Type[] types = getComponents(); for (int i = 0; i < types.length; i++) { Type t = getComponent(i); Location nextLocation = t.provideLocation(location, i + 1, location.getFieldRepetition()); if (!t.accept(visitor, nextLocation)) break; } ExtraComponents ec = getExtraComponents(); for (int i = 0; i < ec.numComponents(); i++) { Variable v = ec.getComponent(i); Location nextLocation = v.provideLocation(location, i + types.length, -1); if (!v.accept(visitor, nextLocation)) break; } } return visitor.end(this, location); }