/// <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]; } double dval; int ival; StateMod_InstreamFlowRight ifr = (StateMod_InstreamFlowRight)_data.get(row); switch (col) { case COL_RIGHT_ID: ifr.setID((string)value); break; case COL_RIGHT_NAME: ifr.setName((string)value); break; case COL_STRUCT_ID: ifr.setCgoto((string)value); break; case COL_ADMIN_NUM: ifr.setIrtem((string)value); break; case COL_DCR_AMT: dval = ((double?)value).Value; ifr.setDcrifr(dval); break; case COL_ON_OFF: if (value is int?) { ival = ((int?)value).Value; ifr.setSwitch(ival); } else if (value is string) { string onOff = (string)value; int index = onOff.IndexOf(" -", StringComparison.Ordinal); ival = (Convert.ToInt32(onOff.Substring(0, index))); ifr.setSwitch(ival); } /* * ival = ((Integer)value).intValue(); * ifr.setSwitch(ival); * break; */ break; } base.setValueAt(value, row, col); }
/// <summary> /// Read instream flow rights information in and store in a list. </summary> /// <param name="filename"> Name of file to read. </param> /// <exception cref="Exception"> if there is an error reading the file. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static java.util.List<StateMod_InstreamFlowRight> readStateModFile(String filename) throws Exception public static IList <StateMod_InstreamFlowRight> readStateModFile(string filename) { string routine = "StateMod_InstreamFlowRight.readStateModFile"; IList <StateMod_InstreamFlowRight> theInsfRights = new List <StateMod_InstreamFlowRight>(); int[] format_0 = new int[] { StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_INTEGER }; int[] format_0w = new int[] { 12, 24, 12, 16, 8, 8 }; string iline; StateMod_InstreamFlowRight aRight = null; IList <object> v = new List <object>(6); Message.printStatus(1, routine, "Reading Instream Flow Rights File: " + filename); StreamReader @in = null; try { @in = new StreamReader(filename); while (!string.ReferenceEquals((iline = @in.ReadLine()), null)) { // check for comments if (iline.StartsWith("#", StringComparison.Ordinal) || iline.Trim().Length == 0) { continue; } aRight = new StateMod_InstreamFlowRight(); StringUtil.fixedRead(iline, format_0, format_0w, v); aRight.setID(((string)v[0]).Trim()); aRight.setName(((string)v[1]).Trim()); aRight.setCgoto(((string)v[2]).Trim()); aRight.setIrtem(((string)v[3]).Trim()); aRight.setDcrifr((double?)v[4]); aRight.setSwitch((int?)v[5]); theInsfRights.Add(aRight); } } catch (Exception e) { Message.printWarning(3, routine, e); throw e; } finally { if (@in != null) { @in.Close(); } } return(theInsfRights); }