Esempio n. 1
0
  private Plate[] domainToPlates(FDDomain domain) {
    LOGGER.finest("<creating plates >");
    int n = domain.getNumberOfXPlate() + domain.getNumberOfYPlate() + domain.getNumberOfZPlate();
    LOGGER.finest("number of plates in domain is " + n);
    Plate[] plates = new Plate[n];

    Iterator<int[]> it = domain.getXPlateIterator();
    int i = 0;
    while (it.hasNext()) {
      int[] indices = it.next();
      Plate p = new PlateX();
      p.position = indices[0];
      p.min1 = indices[1];
      p.min2 = indices[2];
      p.max1 = indices[3];
      p.max2 = indices[4];
      plates[i] = p;
      i++;
    }

    if (i != domain.getNumberOfXPlate())
      throw new IllegalStateException(i + "!=" + domain.getNumberOfXPlate());

    it = domain.getYPlateIterator();
    while (it.hasNext()) {
      int[] indices = it.next();
      Plate p = new PlateY();
      p.position = indices[0];
      p.min1 = indices[1];
      p.min2 = indices[2];
      p.max1 = indices[3];
      p.max2 = indices[4];
      plates[i] = p;
      i++;
    }

    if (i != domain.getNumberOfXPlate() + domain.getNumberOfYPlate())
      throw new IllegalStateException(
          i + "!=" + domain.getNumberOfXPlate() + domain.getNumberOfYPlate());

    it = domain.getZPlateIterator();
    while (it.hasNext()) {
      int[] indices = it.next();
      Plate p = new PlateZ();
      p.position = indices[0];
      p.min1 = indices[1];
      p.min2 = indices[2];
      p.max1 = indices[3];
      p.max2 = indices[4];
      plates[i] = p;
      i++;
    }

    if (i != n) throw new IllegalStateException(i + "!=" + n);

    LOGGER.finest("</creating plates>");
    return plates;
  }