Package avrora.core

Examples of avrora.core.Program$Location


    for (Iterator<Structure> iter = ReadOnlyMessageIterator
        .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) {
      String segmentName = iter.next().getName();
      ValidationException ve = new ValidationException("Found unknown segment: " + segmentName);
      Location location = new Location();
      location.setSegmentName(segmentName);
      ve.setLocation(location);
      exceptions.add(ve);
    }
    return exceptions.toArray(new ValidationException[exceptions.size()]);
  }
View Full Code Here


  private void testComponent(Type type, ValidationExceptionHandler<R> handler, Location l) {
    if (type instanceof Composite) {
      Type[] component = ((Composite) type).getComponents();
      for (int sub = 0; sub < component.length; sub++) {
        Location location = new Location(l).withSubcomponent(sub + 1);
        testSubComponent(component[sub], handler, location);
      }
    } else if (type instanceof Varies) {
      testComponent(((Varies) type).getData(), handler, l);
    } else {
View Full Code Here

        .createPopulatedSegmentIterator(message); iter.hasNext();) {
      Segment s = (Segment) iter.next();
      for (int field = 1; field <= s.numFields(); field++) {
        Type[] t = s.getField(field);
        for (int rep = 0; rep < t.length; rep++) {
          Location location = new Location();
          location
              .withSegmentName(s.getName())
              .withField(field)
              .withFieldRepetition(rep);
          testType(t[rep], handler, location);
        }
View Full Code Here

  private void testType(Type type, ValidationExceptionHandler<R> handler, Location l) {
    if (type instanceof Composite) {
      Type[] components = ((Composite) type).getComponents();
      for (int comp = 0; comp < components.length; comp++) {
        Location location = new Location(l).withComponent(comp + 1);
        testComponent(components[comp], handler, location);
      }
    } else if (type instanceof Varies) {
      testType(((Varies) type).getData(), handler, l);
    } else {
View Full Code Here

 
  public ValidationException[] apply(Message msg) {
    List<ValidationException> exceptions = new ArrayList<ValidationException>();

    ValidationException ve = new ValidationException("Invalid version: " + msg.getVersion());
    Location location = new Location()
        .withSegmentName("MSH")
        .withField(12);
    ve.setLocation(location);
    ve.setError(ErrorCode.UNSUPPORTED_VERSION_ID);
    exceptions.add(ve);
View Full Code Here

    public Location getLocation(Message msg) throws HL7Exception {
      Terser t = new Terser(msg);
      StringTokenizer tok = new StringTokenizer(expression, "-", false);
      Segment segment = t.getSegment(tok.nextToken());
      Location location = new Location()
          .withSegmentName(segment.getName())
          .withFieldIndizes(Terser.getIndices(expression));
      return location;
    }
View Full Code Here

    for (Iterator<Structure> iter = ReadOnlyMessageIterator
        .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) {
      String segmentName = iter.next().getName();
      ValidationException ve = new ValidationException("Found unknown segment: " + segmentName);
      Location location = new Location().withSegmentName(segmentName);
      ve.setLocation(location);
      exceptions.add(ve);
    }
    return exceptions.toArray(new ValidationException[exceptions.size()]);
  }
View Full Code Here

        }
        return visitor.end(this, currentLocation);
    }

    public Location provideLocation(Location parentLocation, int index, int repetition) {
        return new Location(parentLocation).withField(index);
    }
View Full Code Here

    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);
    }
View Full Code Here

        }
        return visitor.end(this, location);
    }
   
    public Location provideLocation(Location location, int index, int repetition) {
        return new Location(location).pushGroup(getName(), repetition);
    }   
View Full Code Here

TOP

Related Classes of avrora.core.Program$Location

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.