/// <summary> /// Sets up the data to be displayed in the table. </summary> /// <param name="data"> a Vector of StateMod_StreamEstimate_Coefficients objects from /// which the data to be be displayed in the table will be gathered. </param> private void setupData(System.Collections.IList data) { int num = 0; int size = data.Count; StateMod_StreamEstimate_Coefficients coeff = null; __data = new System.Collections.IList[__COLUMNS]; for (int i = 0; i < __COLUMNS; i++) { __data[i] = new List <object>(); } string id = null; int rowCount = 0; int M = 0; int N = 0; for (int i = 0; i < size; i++) { coeff = (StateMod_StreamEstimate_Coefficients)data[i]; id = coeff.getID(); M = coeff.getM(); N = coeff.getN(); num = M < N ? N : M; for (int j = 0; j < num; j++) { __data[COL_ID].Add(id); if (j < N) { __data[COL_STREAM_NAME].Add(new double?(coeff.getCoefn(j))); __data[COL_UPSTREAM_GAGE].Add(coeff.getUpper(j)); } else { __data[COL_STREAM_NAME].Add(new double?(-999)); __data[COL_UPSTREAM_GAGE].Add(""); } if (j < M) { __data[COL_GAIN_TERM_PRO].Add(new double?(coeff.getProratnf())); __data[COL_GAIN_TERM_WT].Add(new double?(coeff.getCoefm(j))); __data[COL_GAIN_TERM_GAGE_ID].Add(coeff.getFlowm(j)); } else { __data[COL_GAIN_TERM_PRO].Add(new double?(-999)); __data[COL_GAIN_TERM_WT].Add(new double?(-999)); __data[COL_GAIN_TERM_GAGE_ID].Add(""); } rowCount++; } } _rows = rowCount; }
/// <summary> /// Returns the data that should be placed in the JTable /// at the given row and column. </summary> /// <param name="row"> the row for which to return data. </param> /// <param name="col"> the column for which to return data. </param> /// <returns> the data that should be placed in the JTable at the given row and col. </returns> public virtual object getValueAt(int row, int col) { if (_sortOrder != null) { row = _sortOrder[row]; } if (__coeff == null) { return(""); } switch (col) { case COL_STREAM_NAME: case COL_UPSTREAM_GAGE: case COL_GAIN_TERM_WT: case COL_GAIN_TERM_GAGE_ID: int M = __coeff.getM(); int N = __coeff.getN(); switch (col) { case COL_STREAM_NAME: if (row < N) { return(new double?(__coeff.getCoefn(row))); } return(""); case COL_UPSTREAM_GAGE: if (row < N) { return(__coeff.getUpper(row)); } return(""); case COL_GAIN_TERM_WT: if (row < M) { return(new double?(__coeff.getCoefm(row))); } return(""); case COL_GAIN_TERM_GAGE_ID: if (row < M) { return(__coeff.getFlowm(row)); } return(""); } default: return(""); } }