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, -1);
if (!t.accept(visitor, nextLocation)) break;
}
ExtraComponents ec = getExtraComponents();
for (int i = 0; i < ec.numComponents(); i++) {
Varies v = ec.getComponent(i);
Location nextLocation = v.provideLocation(location, i + types.length, -1);
if (!v.accept(visitor, nextLocation)) break;
}
}
return visitor.end(this, location);
}