Ejemplo n.º 1
0
  /** Creates a new instance of VariationsTableModel */
  public VariationsTableModel() {
    _rows = VariationsFactory.getVariationQuantity();

    int maxAdditionalParams = 0;
    _parameters.ensureCapacity(_rows);
    _coefficients.ensureCapacity(_rows);
    for (int i = 0; i < _rows; i++) {
      _coefficients.add(Double.valueOf(0));

      IVariation tmp = VariationsFactory.getVariation(i, Double.valueOf(0));
      int parametersQuantity = tmp.getParametersQuantity();

      ArrayList<Double> parameters = new ArrayList<>(parametersQuantity);
      for (int j = 0; j < parametersQuantity; j++) {
        parameters.add(Double.valueOf(0));
      }
      _parameters.add(parameters);

      if (maxAdditionalParams < parametersQuantity) {
        maxAdditionalParams = parametersQuantity;
      }
    }

    _columns = 2 + maxAdditionalParams;
  }
Ejemplo n.º 2
0
  /**
   * Returns IVariation object corresponding to the given row.
   *
   * @param row row index
   * @return Variation object
   */
  public IVariation getVariation(int row) {
    IVariation temp = VariationsFactory.getVariation(row, _coefficients.get(row));

    temp.setCoefficient(_coefficients.get(row));

    if (temp.getParametersQuantity() > 0) {
      ArrayList<Double> parTemp = new ArrayList<>(_parameters.get(row));
      temp.setParameters(parTemp);
    }

    return temp;
  }