Beispiel #1
0
  /**
   * Determine the subfields of <CODE>n</CODE> and store the results there as well.
   *
   * @param n The NumberField whose subfields we are after
   */
  private void determineSubfields(NumberField n) {
    // Progress Bar
    GiANT.gui.appendConsoleText(
        "\nDetermining sub- and superfield relations for new field" + ELL, false);
    GiANT.gui.showProgressBar(true);

    // DEBUG
    // System.err.println("subfields start for " + n.getName());
    int i = 0;
    final float size = (float) allFields.size();
    final int max = GiANT.gui.getProgressMax();

    Iterator it = allFields.iterator();
    while (it.hasNext()) {
      // Progress Bar
      float index = (float) i++;
      int progress = (int) (max * (index / size));
      // DEBUG
      // System.err.println("\tprogress=" + progress);
      GiANT.gui.setProgress(progress);

      NumberField test = (NumberField) it.next();

      if (n.hasSubfield(test) || test.hasSubfield(n)) {
        // do nothing
      } else if (GiANT.gui.kash.isSubfield(test, n)) {
        n.addSubfield(test); // also adds all subfields of test to subfields of this
        if (test.getDegree() == n.getDegree()) {
          test.addSubfield(n);
        }
      } else if (GiANT.gui.kash.isSubfield(n, test)) {
        test.addSubfield(n); // also adds all subfields of n to subfields of this
      }
    }
    // Progress Bar
    GiANT.gui.showProgressBar(false);
    GiANT.gui.appendConsoleText("done.\n", false);
    // System.err.println("subfields end for " + n.getName());
  }