/// <summary> /// Sets up the data to be displayed in the table. </summary> /// <param name="data"> a Vector of StateMod_DelayTable objects from which the data to b /// be displayed in the table will be gathered. </param> /* * private void setupData(List data) { * int num = 0; * int size = data.size(); * StateMod_DelayTable dt = null; * String id = null; * __data = new List[__COLUMNS]; * for (int i = 0; i < __COLUMNS; i++) { * __data[i] = new Vector(); * } * * __rowMap = new Vector(); * * double total = 0; * int rowCount = 0; * for (int i = 0; i < size; i++) { * total = 0; * dt = (StateMod_DelayTable)data.get(i); * id = dt.getID(); * num = dt.getNdly(); * for (int j = 0; j < num; j++) { * __data[COL_PLAN_ID].add(id); * __data[COL_RIVER_NODE_ID].add(new Integer(j + 1)); * __data[COL_PERCENT_RETURN].add( new Double(dt.getRet_val(j))); * total += dt.getRet_val(j); * __rowMap.add(new Integer(rowCount)); * rowCount++; * } * * __data[COL_PLAN_ID].add("TOTAL " + id); * __data[COL_RIVER_NODE_ID].add(new Integer(-999)); * __data[COL_PERCENT_RETURN].add(new Double(total)); * * rowCount++; * } * _rows = rowCount; * } */ /// <summary> /// Sets the value at the specified position to the specified value. </summary> /// <param name="value"> the value to set the cell to. </param> /// <param name="row"> the row of the cell for which to set the value. </param> /// <param name="col"> the col of the cell for which to set the value. </param> public virtual void setValueAt(object value, int row, int col) { if (_sortOrder != null) { row = _sortOrder[row]; } StateMod_Plan_WellAugmentation wellAug = (StateMod_Plan_WellAugmentation)_data.get(row); switch (col) { case COL_PLAN_ID: wellAug.setID((string)value); break; case COL_WELL_RIGHT_ID: wellAug.setCistatW((string)value); break; case COL_WELL_STRUCTURE_ID: wellAug.setCistatS((string)value); break; case COL_COMMENT: wellAug.setComment((string)value); break; } base.setValueAt(value, row, col); }
/// <summary> /// Read return information in and store in a list. </summary> /// <param name="filename"> filename for data file to read </param> /// <exception cref="Exception"> if an error occurs </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static java.util.List<StateMod_Plan_WellAugmentation> readStateModFile(String filename) throws Exception public static IList <StateMod_Plan_WellAugmentation> readStateModFile(string filename) { string routine = "StateMod_Plan_WellAugmentation.readStateModFile"; string iline = null; IList <string> v = new List <string>(9); IList <StateMod_Plan_WellAugmentation> theWellAugs = new List <StateMod_Plan_WellAugmentation>(); int linecount = 0; StateMod_Plan_WellAugmentation aWellAug = null; StreamReader @in = null; Message.printStatus(2, routine, "Reading well augmentation plan file: " + filename); int size = 0; int errorCount = 0; try { @in = new StreamReader(IOUtil.getPathUsingWorkingDir(filename)); while (!string.ReferenceEquals((iline = @in.ReadLine()), null)) { ++linecount; // check for comments if (iline.StartsWith("#", StringComparison.Ordinal) || (iline.Trim().Length == 0)) { // Special dynamic header comments written by software and blank lines - no need to keep continue; } if (Message.isDebugOn) { Message.printDebug(50, routine, "line: " + iline); } // Break the line using whitespace, while allowing for quoted strings... v = StringUtil.breakStringList(iline, " \t", StringUtil.DELIM_ALLOW_STRINGS | StringUtil.DELIM_SKIP_BLANKS); size = 0; if (v != null) { size = v.Count; } if (size < 3) { Message.printStatus(2, routine, "Ignoring line " + linecount + " not enough data values. Have " + size + " expecting 3"); ++errorCount; continue; } // Uncomment if testing... //Message.printStatus ( 2, routine, "" + v ); // Allocate new plan node and set the values aWellAug = new StateMod_Plan_WellAugmentation(); aWellAug.setID(v[0].Trim()); aWellAug.setName(v[0].Trim()); // Same as ID aWellAug.setCistatW(v[1].Trim()); aWellAug.setCistatS(v[2].Trim()); if (v.Count > 3) { aWellAug.setComment(v[3].Trim()); } // Set the return to not dirty because it was just initialized... aWellAug.setDirty(false); // Add the return to the list of returns theWellAugs.Add(aWellAug); } } catch (Exception e) { Message.printWarning(3, routine, "Error reading line " + linecount + " \"" + iline + "\" uniquetempvar."); Message.printWarning(3, routine, e); throw e; } finally { if (@in != null) { @in.Close(); } } if (errorCount > 0) { throw new Exception("There were " + errorCount + " errors processing the data - refer to log file."); } return(theWellAugs); }