/// <summary> /// Creates backups of all the data objects in the Vector so that changes can later be canceled if necessary. /// </summary> protected internal override void createDataBackup() { StateMod_Plan plan = null; int size = _data.Count; for (int i = 0; i < size; i++) { plan = (StateMod_Plan)_data[i]; plan.createBackup(); } }
/// <summary> /// Called when the cancel button is pressed. This discards any changes made to the data objects. /// </summary> protected internal override void cancel() { StateMod_Plan plan = null; int size = _data.Count; for (int i = 0; i < size; i++) { plan = (StateMod_Plan)_data[i]; plan.restoreOriginal(); } }
/// <summary> /// Copy constructor. </summary> /// <param name="deep_copy"> If true, make a deep copy including secondary vectors of data. /// Currently only false is recognized, in which primitive data are copied. This is /// suitable to allow the StateMod_Plan_JFrame class to know when changes have /// been made to data on the main screen. </param> public StateMod_Plan(StateMod_Plan plan, bool deep_copy) : this() { // Base class... // TODO // Local data members... _iPlnTyp = plan._iPlnTyp; _PeffFlag = plan._PeffFlag; _iPrf = plan._iPrf; _iPfail = plan._iPfail; _Psto1 = plan._Psto1; _Psource = plan._Psource; //_georecord = plan._georecord; }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the data is contained. </param> /// <param name="plan"> the plan for which to display return information. </param> /// <param name="editable"> whether the gui data is editable or not. </param> public StateMod_Plan_Return_JFrame(StateMod_DataSet dataset, StateMod_Plan plan, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, plan.getName() + " - Plan Return Flow Table Assignment", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __currentPlan = plan; IList <StateMod_ReturnFlow> allReturns = (IList <StateMod_ReturnFlow>)dataset.getComponentForComponentType(StateMod_DataSet.COMP_PLAN_RETURN).getData(); __currentPlanReturnList = (IList <StateMod_ReturnFlow>)StateMod_Util.getDataList(allReturns, plan.getID()); Message.printStatus(2, "", "Have " + __currentPlanReturnList.Count + " return records for plan \"" + __currentPlan.getID() + "\" uniquetempvar."); __dataset = dataset; // TODO SAM 2011-01-02 For now editing is disabled... editable = false; __editable = editable; setupGUI(); }
/// <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]; } StateMod_Plan smp = (StateMod_Plan)_data.get(row); switch (col) { case COL_ID: return(smp.getID()); case COL_NAME: return(smp.getName()); case COL_RIVER_NODE_ID: return(smp.getCgoto()); case COL_ON_OFF: return(new int?(smp.getSwitch())); case COL_TYPE: return(new int?(smp.getIPlnTyp())); case COL_EFFICIENCY: return(new int?(smp.getPeffFlag())); case COL_RETURN_FLOW_TABLE: return(new int?(smp.getIPrf())); case COL_FAILURE_SWITCH: return(new int?(smp.getIPfail())); case COL_INITIAL_STORAGE: return(new double?(smp.getPsto1())); case COL_SOURCE: return(smp.getPsource()); default: return(""); } }
/// <summary> /// Read plan information in and store in a list. </summary> /// <param name="filename"> filename containing plan information </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> readStateModFile(String filename) throws Exception public static IList <StateMod_Plan> readStateModFile(string filename) { string routine = "StateMod_Plan.readStateModFile"; string iline = null; IList <string> v = new List <string>(9); IList <StateMod_Plan> thePlans = new List <StateMod_Plan>(); int linecount = 0; StateMod_Plan aPlan = null; StreamReader @in = null; Message.printStatus(2, routine, "Reading plan file: " + filename); int size = 0; int errorCount = 0; try { @in = new StreamReader(IOUtil.getPathUsingWorkingDir(filename)); IList <string> commentsBeforeData = new List <string>(); 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; } else if (iline.StartsWith("#", StringComparison.Ordinal)) { // Comment prior to a plan - do not trim so that input/output comparisons can be made but // do remove the initial comment character commentsBeforeData.Add(iline.Substring(1)); 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 < 11) { Message.printStatus(2, routine, "Ignoring line " + linecount + " not enough data values. Have " + size + " expecting " + 11); ++errorCount; continue; } // Uncomment if testing... //Message.printStatus ( 2, routine, "" + v ); // Allocate new plan node and set the values aPlan = new StateMod_Plan(); aPlan.setID(v[0].Trim()); aPlan.setName(v[1].Trim()); aPlan.setCgoto(v[2].Trim()); aPlan.setSwitch(v[3].Trim()); aPlan.setIPlnTyp(v[4].Trim()); aPlan.setPeffFlag(v[5].Trim()); int peffFlag = aPlan.getPeffFlag(); aPlan.setIPrf(v[6].Trim()); aPlan.setIPfail(v[7].Trim()); aPlan.setPsto1(v[8].Trim()); aPlan.setPsource(v[9].Trim()); aPlan.setIPAcc(v[10].Trim()); // Read the efficiencies... if (peffFlag == 1) { iline = @in.ReadLine(); ++linecount; if (string.ReferenceEquals(iline, null)) { throw new IOException("Unexpected end of file after line " + linecount + " - expecting 12 efficiency values."); } v = StringUtil.breakStringList(iline, " \t", StringUtil.DELIM_ALLOW_STRINGS | StringUtil.DELIM_SKIP_BLANKS); size = 0; if (v != null) { size = v.Count; } if (size != 12) { Message.printStatus(2, routine, "Ignoring line " + linecount + " not enough data values. Have " + size + " expecting " + 12); ++errorCount; } else { for (int iEff = 0; iEff < 12; iEff++) { string val = v[0].Trim(); try { aPlan.setPeff(iEff, double.Parse(val)); } catch (Exception) { Message.printStatus(2, routine, "Efficiencies on line " + linecount + " value \"" + val + "\" is not a number."); ++errorCount; } } } } // Set the comments if (commentsBeforeData.Count > 0) { // Set comments that have been read previous to this line. First, attempt to discard // comments that do not below with the operational right. For now, search backward for // "EndHeader" and "--e" which indicate the end of the header. If found, discard the comments prior // to this because they are assumed to be file header comments, not comments for a specific right. // Only do this for the first right because the user may actually want to include the header // information in their file periodically to help with formatting string comment; if (thePlans.Count == 0) { for (int iComment = commentsBeforeData.Count - 1; iComment >= 0; --iComment) { comment = commentsBeforeData[iComment].ToUpper(); if ((comment.IndexOf("ENDHEADER", StringComparison.Ordinal) >= 0) || (comment.IndexOf("--E", StringComparison.Ordinal) >= 0)) { // Remove the comments above the position. while (iComment >= 0) { commentsBeforeData.RemoveAt(iComment--); } break; } } } aPlan.setCommentsBeforeData(commentsBeforeData); } // Always clear out for next right... commentsBeforeData = new List <string>(1); // Set the plan to not dirty because it was just initialized... aPlan.setDirty(false); // Add the plan to the vector of plans thePlans.Add(aPlan); } } 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(thePlans); }
/// <summary> /// Inserts the specified value into the table at the given position. </summary> /// <param name="value"> the object to store in the table cell. </param> /// <param name="row"> the row of the cell in which to place the object. </param> /// <param name="col"> the column of the cell in which to place the object. </param> public virtual void setValueAt(object value, int row, int col) { if (_sortOrder != null) { row = _sortOrder[row]; } int ival; int index; StateMod_Plan smd = (StateMod_Plan)_data.get(row); switch (col) { case COL_ID: smd.setID((string)value); break; case COL_NAME: smd.setName((string)value); break; case COL_RIVER_NODE_ID: smd.setCgoto((string)value); break; case COL_ON_OFF: if (value is int?) { ival = ((int?)value).Value; smd.setSwitch(ival); } else if (value is string) { string onOff = (string)value; index = onOff.IndexOf(" -", StringComparison.Ordinal); ival = (Convert.ToInt32(onOff.Substring(0, index))); smd.setSwitch(ival); } break; case COL_TYPE: smd.setIPlnTyp((int?)value); break; case COL_RETURN_TYPE: smd.setIPrf((int?)value); break; case COL_FAILURE_SWITCH: smd.setIPfail((int?)value); break; case COL_INITIAL_STORAGE: smd.setPsto1((double?)value); break; case COL_SOURCE_ID: smd.setPsource((string)value); break; case COL_SOURCE_ACCOUNT: smd.setIPAcc((string)value); break; case COL_EFF_FLAG: smd.setPeffFlag((int?)value); break; case COL_EFF_01: case COL_EFF_02: case COL_EFF_03: case COL_EFF_04: case COL_EFF_05: case COL_EFF_06: case COL_EFF_07: case COL_EFF_08: case COL_EFF_09: case COL_EFF_10: case COL_EFF_11: case COL_EFF_12: smd.setPeff((col - COL_EFF_01), (double?)value.Value); break; } base.setValueAt(value, row, col); }
/// <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]; } StateMod_Plan smd = (StateMod_Plan)_data.get(row); switch (col) { case COL_ID: return(smd.getID()); case COL_NAME: return(smd.getName()); case COL_RIVER_NODE_ID: return(smd.getCgoto()); case COL_ON_OFF: return(new int?(smd.getSwitch())); case COL_TYPE: return(new int?(smd.getIPlnTyp())); case COL_RETURN_TYPE: return(new int?(smd.getIPrf())); case COL_FAILURE_SWITCH: return(new int?(smd.getIPfail())); case COL_INITIAL_STORAGE: return(new double?(smd.getPsto1())); case COL_SOURCE_ID: return(smd.getPsource()); case COL_SOURCE_ACCOUNT: return(smd.getIPAcc()); case COL_EFF_FLAG: return(new int?(smd.getPeffFlag())); case COL_EFF_01: case COL_EFF_02: case COL_EFF_03: case COL_EFF_04: case COL_EFF_05: case COL_EFF_06: case COL_EFF_07: case COL_EFF_08: case COL_EFF_09: case COL_EFF_10: case COL_EFF_11: case COL_EFF_12: int peffFlag = smd.getPeffFlag(); if (peffFlag == 1) { return(new double?(smd.getPeff(col - COL_EFF_01))); } else { return(""); } default: return(""); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void saveComponent(RTi.Util.IO.DataSetComponent comp, String oldFilename,String newFilename, java.util.List<String> comments) throws Exception private void saveComponent(DataSetComponent comp, string oldFilename, string newFilename, IList <string> comments) { bool daily = false; int type = comp.getComponentType(); object data = comp.getData(); string name = null; switch (type) { //////////////////////////////////////////////////////// // StateMod_* classes case StateMod_DataSet.COMP_CONTROL: StateMod_DataSet.writeStateModControlFile(__dataset, oldFilename, newFilename, comments); name = "Control"; break; case StateMod_DataSet.COMP_DELAY_TABLES_DAILY: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayTablesDaily = (java.util.List<StateMod_DelayTable>)data; IList <StateMod_DelayTable> delayTablesDaily = (IList <StateMod_DelayTable>)data; StateMod_DelayTable.writeStateModFile(oldFilename, newFilename, delayTablesDaily, comments, __dataset.getInterv(), -1); name = "Delay Tables Daily"; break; case StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayTablesMonthly = (java.util.List<StateMod_DelayTable>)data; IList <StateMod_DelayTable> delayTablesMonthly = (IList <StateMod_DelayTable>)data; StateMod_DelayTable.writeStateModFile(oldFilename, newFilename, delayTablesMonthly, comments, __dataset.getInterv(), -1); name = "Delay Tables Monthly"; break; case StateMod_DataSet.COMP_DIVERSION_STATIONS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Diversion> diversionStations = (java.util.List<StateMod_Diversion>)data; IList <StateMod_Diversion> diversionStations = (IList <StateMod_Diversion>)data; StateMod_Diversion.writeStateModFile(oldFilename, newFilename, diversionStations, comments, daily); name = "Diversion"; break; case StateMod_DataSet.COMP_DIVERSION_RIGHTS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DiversionRight> diversionRights = (java.util.List<StateMod_DiversionRight>)data; IList <StateMod_DiversionRight> diversionRights = (IList <StateMod_DiversionRight>)data; StateMod_DiversionRight.writeStateModFile(oldFilename, newFilename, diversionRights, comments, daily); name = "Diversion Rights"; break; case StateMod_DataSet.COMP_INSTREAM_STATIONS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_InstreamFlow> instreamFlow = (java.util.List<StateMod_InstreamFlow>)data; IList <StateMod_InstreamFlow> instreamFlow = (IList <StateMod_InstreamFlow>)data; StateMod_InstreamFlow.writeStateModFile(oldFilename, newFilename, instreamFlow, comments, daily); name = "Instream"; break; case StateMod_DataSet.COMP_INSTREAM_RIGHTS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_InstreamFlowRight> instreamFlowRights = (java.util.List<StateMod_InstreamFlowRight>)data; IList <StateMod_InstreamFlowRight> instreamFlowRights = (IList <StateMod_InstreamFlowRight>)data; StateMod_InstreamFlowRight.writeStateModFile(oldFilename, newFilename, instreamFlowRights, comments); name = "Instream Rights"; break; case StateMod_DataSet.COMP_OPERATION_RIGHTS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_OperationalRight> operationalRights = (java.util.List<StateMod_OperationalRight>)data; IList <StateMod_OperationalRight> operationalRights = (IList <StateMod_OperationalRight>)data; // 2 is the file version (introduced for StateMod version 12 change) StateMod_OperationalRight.writeStateModFile(oldFilename, newFilename, 2, operationalRights, comments, __dataset); name = "Operational Rights"; break; case StateMod_DataSet.COMP_PLANS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Plan> planStations = (java.util.List<StateMod_Plan>)data; IList <StateMod_Plan> planStations = (IList <StateMod_Plan>)data; StateMod_Plan.writeStateModFile(oldFilename, newFilename, planStations, comments); name = "Plan"; break; case StateMod_DataSet.COMP_RESERVOIR_STATIONS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Reservoir> reservoirStations = (java.util.List<StateMod_Reservoir>)data; IList <StateMod_Reservoir> reservoirStations = (IList <StateMod_Reservoir>)data; StateMod_Reservoir.writeStateModFile(oldFilename, newFilename, reservoirStations, comments, daily); name = "Reservoir"; break; case StateMod_DataSet.COMP_RESERVOIR_RIGHTS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_ReservoirRight> reservoirRights = (java.util.List<StateMod_ReservoirRight>)data; IList <StateMod_ReservoirRight> reservoirRights = (IList <StateMod_ReservoirRight>)data; StateMod_ReservoirRight.writeStateModFile(oldFilename, newFilename, reservoirRights, comments); name = "Reservoir Rights"; break; case StateMod_DataSet.COMP_RESPONSE: StateMod_DataSet.writeStateModFile(__dataset, oldFilename, newFilename, comments); name = "Response"; break; case StateMod_DataSet.COMP_RIVER_NETWORK: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_RiverNetworkNode> riverNodes = (java.util.List<StateMod_RiverNetworkNode>)data; IList <StateMod_RiverNetworkNode> riverNodes = (IList <StateMod_RiverNetworkNode>)data; StateMod_RiverNetworkNode.writeStateModFile(oldFilename, newFilename, riverNodes, comments, true); name = "River Network"; break; case StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamEstimate> streamEstimateStations = (java.util.List<StateMod_StreamEstimate>)data; IList <StateMod_StreamEstimate> streamEstimateStations = (IList <StateMod_StreamEstimate>)data; StateMod_StreamEstimate.writeStateModFile(oldFilename, newFilename, streamEstimateStations, comments, daily); name = "Stream Estimate"; break; case StateMod_DataSet.COMP_STREAMESTIMATE_COEFFICIENTS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamEstimate_Coefficients> streamEstimateCoefficients = (java.util.List<StateMod_StreamEstimate_Coefficients>)data; IList <StateMod_StreamEstimate_Coefficients> streamEstimateCoefficients = (IList <StateMod_StreamEstimate_Coefficients>)data; StateMod_StreamEstimate_Coefficients.writeStateModFile(oldFilename, newFilename, streamEstimateCoefficients, comments); name = "Stream Estimate Coefficients"; break; case StateMod_DataSet.COMP_STREAMGAGE_STATIONS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamGage> streamGageStations = (java.util.List<StateMod_StreamGage>)data; IList <StateMod_StreamGage> streamGageStations = (IList <StateMod_StreamGage>)data; StateMod_StreamGage.writeStateModFile(oldFilename, newFilename, streamGageStations, comments, daily); name = "Streamgage Stations"; break; case StateMod_DataSet.COMP_WELL_STATIONS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Well> wellStations = (java.util.List<StateMod_Well>)data; IList <StateMod_Well> wellStations = (IList <StateMod_Well>)data; StateMod_Well.writeStateModFile(oldFilename, newFilename, wellStations, comments); name = "Well"; break; case StateMod_DataSet.COMP_WELL_RIGHTS: //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_WellRight> wellRights = (java.util.List<StateMod_WellRight>)data; IList <StateMod_WellRight> wellRights = (IList <StateMod_WellRight>)data; StateMod_WellRight.writeStateModFile(oldFilename, newFilename, wellRights, comments, (PropList)null); name = "Well Rights"; break; ////////////////////////////////////////////////////// // StateMod Time Series case StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_DAILY: case StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_MONTHLY: case StateMod_DataSet.COMP_DEMAND_TS_DAILY: case StateMod_DataSet.COMP_DEMAND_TS_AVERAGE_MONTHLY: case StateMod_DataSet.COMP_DEMAND_TS_MONTHLY: case StateMod_DataSet.COMP_DEMAND_TS_OVERRIDE_MONTHLY: case StateMod_DataSet.COMP_DIVERSION_TS_DAILY: case StateMod_DataSet.COMP_DIVERSION_TS_MONTHLY: case StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY: case StateMod_DataSet.COMP_INSTREAM_DEMAND_TS_AVERAGE_MONTHLY: case StateMod_DataSet.COMP_INSTREAM_DEMAND_TS_DAILY: case StateMod_DataSet.COMP_INSTREAM_DEMAND_TS_MONTHLY: case StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY: case StateMod_DataSet.COMP_RESERVOIR_CONTENT_TS_DAILY: case StateMod_DataSet.COMP_RESERVOIR_CONTENT_TS_MONTHLY: case StateMod_DataSet.COMP_RESERVOIR_TARGET_TS_DAILY: case StateMod_DataSet.COMP_RESERVOIR_TARGET_TS_MONTHLY: case StateMod_DataSet.COMP_STREAMESTIMATE_NATURAL_FLOW_TS_DAILY: case StateMod_DataSet.COMP_STREAMESTIMATE_NATURAL_FLOW_TS_MONTHLY: case StateMod_DataSet.COMP_STREAMGAGE_NATURAL_FLOW_TS_DAILY: case StateMod_DataSet.COMP_STREAMGAGE_NATURAL_FLOW_TS_MONTHLY: case StateMod_DataSet.COMP_STREAMGAGE_HISTORICAL_TS_DAILY: case StateMod_DataSet.COMP_STREAMGAGE_HISTORICAL_TS_MONTHLY: case StateMod_DataSet.COMP_WELL_DEMAND_TS_DAILY: case StateMod_DataSet.COMP_WELL_DEMAND_TS_MONTHLY: case StateMod_DataSet.COMP_WELL_PUMPING_TS_DAILY: case StateMod_DataSet.COMP_WELL_PUMPING_TS_MONTHLY: double missing = -999.0; YearType yearType = null; if (__dataset.getCyrl() == YearType.CALENDAR) { yearType = YearType.CALENDAR; } else if (__dataset.getCyrl() == YearType.WATER) { yearType = YearType.WATER; } else if (__dataset.getCyrl() == YearType.NOV_TO_OCT) { yearType = YearType.NOV_TO_OCT; } int precision = 2; // Do the following to avoid warnings IList <TS> tslist = null; if (data != null) { //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<RTi.TS.TS> tslist0 = (java.util.List<RTi.TS.TS>)data; IList <TS> tslist0 = (IList <TS>)data; if (tslist0.Count > 0) { TS ts = tslist0[0]; missing = ts.getMissing(); } tslist = tslist0; } StateMod_TS.writeTimeSeriesList(oldFilename, newFilename, comments, tslist, null, null, yearType, missing, precision); name = "TS (" + type + ")"; break; default: name = "(something: " + type + ")"; break; } comp.setDirty(false); Message.printStatus(1, "", "Component '" + name + "' written"); }
/// <summary> /// Inserts the specified value into the table at the given position. </summary> /// <param name="value"> the object to store in the table cell. </param> /// <param name="row"> the row of the cell in which to place the object. </param> /// <param name="col"> the column of the cell in which to place the object. </param> public virtual void setValueAt(object value, int row, int col) { if (_sortOrder != null) { row = _sortOrder[row]; } int ival; int index; StateMod_Plan smp = (StateMod_Plan)_data.get(row); switch (col) { case COL_ID: smp.setID((string)value); break; case COL_NAME: smp.setName((string)value); break; case COL_RIVER_NODE_ID: smp.setCgoto((string)value); break; case COL_ON_OFF: if (value is int?) { ival = ((int?)value).Value; smp.setSwitch(ival); } else if (value is string) { string onOff = (string)value; index = onOff.IndexOf(" -", StringComparison.Ordinal); ival = (Convert.ToInt32(onOff.Substring(0, index))); smp.setSwitch(ival); } break; case COL_TYPE: if (value is int?) { ival = ((int?)value).Value; smp.setIPlnTyp(ival); } else if (value is string) { string iPlnTyp = (string)value; index = iPlnTyp.IndexOf(" -", StringComparison.Ordinal); ival = (Convert.ToInt32(iPlnTyp.Substring(0, index))); smp.setIPlnTyp(ival); } break; case COL_EFFICIENCY: smp.setPeffFlag((int?)value); break; case COL_RETURN_FLOW_TABLE: if (value is int?) { ival = ((int?)value).Value; smp.setIPrf(ival); } else if (value is string) { string iPrf = (string)value; index = iPrf.IndexOf(" -", StringComparison.Ordinal); ival = (Convert.ToInt32(iPrf.Substring(0, index))); smp.setIPrf(ival); } break; case COL_FAILURE_SWITCH: if (value is int?) { ival = ((int?)value).Value; smp.setIPfail(ival); } else if (value is string) { string iPfail = (string)value; index = iPfail.IndexOf(" -", StringComparison.Ordinal); ival = (Convert.ToInt32(iPfail.Substring(0, index))); smp.setIPfail(ival); } break; case COL_INITIAL_STORAGE: smp.setPsto1((double?)value); break; case COL_SOURCE: smp.setPsource((string)value); break; } base.setValueAt(value, row, col); }