public InvariantStatus add_modified(double[] a, int count) {
    // System.out.println ("common: " + ArraysMDE.toString (a));
    if (a == null) {
      return InvariantStatus.FALSIFIED;
    } else if (intersect == null) {
      intersect = a;
      return InvariantStatus.NO_CHANGE;
    } else {
      double[] tmp = new double[intersect.length];
      int size = 0;
      for (int i = 0; i < a.length; i++) {
        // if (a[i] in intersect) && !(a[i] in tmp), add a[i] to tmp
        int ii = Global.fuzzy.indexOf(intersect, a[i]);
        if ((ii != -1) && (Global.fuzzy.indexOf(ArraysMDE.subarray(tmp, 0, size), a[i]) == -1)) {
          // System.out.println ("adding " + intersect[ii] + " at " + size);

          // Carefully add the existing intersect value and not a[i].  These
          // are not necessarily the same when fuzzy floating point
          // comparisons are active.
          tmp[size++] = intersect[ii];
        }
      }
      if (size == 0) {
        return InvariantStatus.FALSIFIED;
      }

      intersect = ArraysMDE.subarray(tmp, 0, size);
    }

    intersect = Intern.intern(intersect);
    elts++;
    return InvariantStatus.NO_CHANGE;
  }
 public ValueAndModified computeValueAndModifiedImpl(ValueTuple vt) {
   int source_mod = base.getModified(vt);
   if (source_mod == ValueTuple.MISSING_NONSENSICAL) return ValueAndModified.MISSING_NONSENSICAL;
   Object val = base.getValue(vt);
   if (val == null) return ValueAndModified.MISSING_NONSENSICAL;
   if (base.rep_type == ProglangType.DOUBLE_ARRAY) {
     double[] val_array = (double[]) val;
     if (val_array.length < minLength) return ValueAndModified.MISSING_NONSENSICAL;
     int real_index = (index < 0 ? val_array.length + index : index);
     return new ValueAndModified(Intern.internedDouble(val_array[real_index]), source_mod);
   } else {
     Object[] val_array = (Object[]) val;
     if (val_array.length < minLength) return ValueAndModified.MISSING_NONSENSICAL;
     int real_index = (index < 0 ? val_array.length + index : index);
     return new ValueAndModified(val_array[real_index], source_mod);
   }
 }
  /**
   * The method that really does the constructing of the AllAPIsSpecification. It gets two {@link
   * Intern} Objects that contain the input parameters and the output columns of all APIs. Then it
   * constructs all {@linkplain APISpecification APISpecifications} from that information, and adds
   * them to itself (itself being a HashMap<Integer,APISpecification>) Each {@link APISpecification}
   * is addressable via its API_FUNCTION_ID.
   *
   * @param InpPar An Intern containing all input parameters with their respective API. Should be
   *     aquired from the Meta-API(see {@link Utils#INITIALISE_INPUT_PARAMS_LINK}
   * @param OutCol An Intern containing all output columns with their respective API. Should be
   *     aquired from the Meta-API(see {@link Utils#INITIALISE_OUTPUT_COLS_LINK}
   * @return The finished AllAPIsSpecification containing all information about the APIs which can
   *     be requested with the tool.
   */
  public static AllAPIsSpecification buildSpecification(Intern InpPar, Intern OutCol) {
    AllAPIsSpecification result = new AllAPIsSpecification();
    // Output
    for (int i = 0; i < OutCol.size(); i++) {
      // check, whether the current entry describes an API already in the Map
      int idOfCurrentEntry = -1;
      try {
        idOfCurrentEntry = Integer.parseInt(OutCol.get(i).get("API_FUNCTION_ID"));
      } catch (NumberFormatException exc) {
        System.err.println(
            "This should never occur. API_FUNCTION_ID is not a number in AllApiSpecification.buildSpecification().");
        exc.printStackTrace();
      }

      if (result.containsKey(idOfCurrentEntry)) {
        result.get(idOfCurrentEntry).addOutput(OutCol.get(i)); // just add the new Column
      } else { // construct a new APISpec
        APISpecification temp = new APISpecification(OutCol.get(i));
        temp.addOutput(OutCol.get(i));
        result.put(idOfCurrentEntry, temp);
      }
    }
    // Input; all APIs are initialized now, so we do not need to check the IDs, but just add all
    // InputPars;
    // It is important to first add Output, for if we did it the other way round, there could be
    // APIs which are not yet initialized
    try {
      for (int i = 0; i < InpPar.size(); i++) {
        int idOfCurrentEntry = Integer.parseInt(InpPar.get(i).get("API_FUNCTION_ID"));
        result.get(idOfCurrentEntry).addInput(InpPar.get(i));
      }
    } catch (NumberFormatException exc) {
      System.err.println(
          "This should never occur. API_FUNCTION_ID is not a number in AllApiSpecification.buildSpecification().");
      exc.printStackTrace();
    }
    return result;
  }