/// <summary> /// Sets up the data to be displayed in the table. /// </summary> private void setupData() { int num = 0; int size = _data.size(); StateMod_Well well = null; string id = null; double total = 0; int rowCount = 0; __data = new System.Collections.IList[__COLUMNS]; for (int i = 0; i < __COLUMNS; i++) { __data[i] = new List <object>(); } __rowMap = new List <object>(); StateMod_ReturnFlow rf = null; System.Collections.IList returnFlows = null; for (int i = 0; i < size; i++) { total = 0; well = (StateMod_Well)_data.get(i); id = well.getID(); if (__isDepletion) { num = well.getNrtnw2(); returnFlows = well.getDepletions(); } else { num = well.getNrtnw(); returnFlows = well.getReturnFlows(); } for (int j = 0; j < num; j++) { rf = (StateMod_ReturnFlow)returnFlows[j]; __data[__COL_ID].Add(id); __data[__COL_NODE_ID].Add(rf.getCrtnid()); __data[__COL_PERCENT].Add(new double?(rf.getPcttot())); __data[__COL_DELAY_ID].Add("" + rf.getIrtndl()); total += rf.getPcttot(); __rowMap.Add(new int?(rowCount)); rowCount++; } __data[__COL_ID].Add(id); __data[__COL_NODE_ID].Add("TOTAL"); __data[__COL_PERCENT].Add(new double?(total)); __data[__COL_DELAY_ID].Add(""); rowCount++; } _rows = rowCount; }
/// <summary> /// Helper method to check that well rights sum to the well station capacity. This /// is called by the well right and well station checks. The check is performed /// by formatting the capacity and decree sum to .NN precision. /// </summary> private void checkWellRights_CapacityData() { // get component data System.Collections.IList wes_Vector = (System.Collections.IList)getComponentData(StateMod_DataSet.COMP_WELL_STATIONS); System.Collections.IList wer_Vector = (System.Collections.IList)getComponentData(StateMod_DataSet.COMP_WELL_RIGHTS); if (wes_Vector == null || wer_Vector == null) { return; } System.Collections.IList data = new List <object>(); int size = 0; // initialize some info for the check file string[] header = StateMod_Well.getCapacityHeader(); string title = "Well Station Capacity"; // check that there data available StateMod_Well wes_i = null; if (wes_Vector == null) { return; } // loop through the vector of data and perform specific // data checks size = wes_Vector.Count; for (int i = 0; i < size; i++) { wes_i = (StateMod_Well)wes_Vector[i]; if (wes_i == null) { continue; } string[] checks = wes_i.checkComponentData_Capacity(wer_Vector, i); // add the data to the data vector if (checks != null && checks.Length > 0) { data.Add(checks); } } // add the data and checks to the check file if (data.Count > 0) { // provides basic header information for this data table string info = "The following well stations (" + data.Count + " out of " + size + ") have capacity different\nfrom the sum of well rights for " + "the station.\n" + "Parcel count and area in the following table are available " + "only if well rights are read from HydroBase.\n"; // create data models for Check file CheckFile_DataModel dm = new CheckFile_DataModel(data, header, title, info, data.Count, size); __check_file.addData(dm, null); } }
/// <summary> /// Creates backups of all the data objects in the Vector so that changes can later be cancelled if necessary. /// </summary> protected internal override void createDataBackup() { StateMod_Well well = null; int size = _data.Count; for (int i = 0; i < size; i++) { well = (StateMod_Well)_data[i]; well.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_Well well = null; int size = _data.Count; for (int i = 0; i < size; i++) { well = (StateMod_Well)_data[i]; well.restoreOriginal(); } }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the data is contained. </param> /// <param name="well"> the well for which to shown depletion data. </param> /// <param name="editable"> whether the gui data is editable or not </param> public StateMod_Well_Depletion_JFrame(StateMod_DataSet dataset, StateMod_Well well, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, well.getName() + " - Well Depletion Information", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __currentWell = well; __dataset = dataset; __editable = editable; setupGUI(); }
/// <summary> /// Performs general and specific data checks on well station data. </summary> /// <param name="props"> A property list for specific properties </param> /// <param name="wes_Vector"> Vector of data to check. /// on checking this data. </param> private void checkWellStationData(PropList props, System.Collections.IList wes_Vector) { // create elements for the checks and check file string[] header = StateMod_Well.getDataHeader(); string title = "Well Station"; // first do the general data validation // using this components data table model StateMod_Data_TableModel tm = new StateMod_Well_Data_TableModel(wes_Vector, false); System.Collections.IList @checked = performDataValidation(tm, title); //String [] columnHeader = getDataTableModelColumnHeader( tm ); string[] columnHeader = getColumnHeader(tm); // do specific checks int size = 0; if (wes_Vector != null) { size = wes_Vector.Count; } System.Collections.IList data = new List <object>(); data = doSpecificDataChecks(wes_Vector, props); // add the data and checks to the check file // provides basic header information for this data check table string info = "The following well stations (" + data.Count + " out of " + size + ") have no irrigated parcels served by wells.\n" + "Data may be OK if the station is an M&I or has no wells.\n" + "Parcel count and area in the following table are available " + "only if well stations are read from HydroBase.\n"; // create data models for Check file CheckFile_DataModel dm = new CheckFile_DataModel(data, header, title, info, data.Count, size); CheckFile_DataModel gen_dm = new CheckFile_DataModel(@checked, columnHeader, title + " Missing or Invalid Data", "", __gen_problems, size); __check_file.addData(dm, gen_dm); // Check to make sure the sum of well rights equals the well station // capacity.. checkWellRights_CapacityData(); }
/// <summary> /// Connect all water rights to the corresponding wells. /// This routines doesn't add an element to an array - the array /// already exists. This method just connects next and previous pointers. </summary> /// <param name="wells"> all wells </param> /// <param name="rights"> all rights </param> public static void connectAllRights(IList <StateMod_Well> wells, IList <StateMod_WellRight> rights) { if ((wells == null) || (rights == null)) { return; } int num_wells = wells.Count; StateMod_Well well = null; for (int i = 0; i < num_wells; i++) { well = wells[i]; if (well == null) { continue; } well.connectRights(rights); } }
/// <summary> /// Read a well input file. </summary> /// <param name="filename"> name of file containing well information </param> /// <returns> status(always 0 since exception handling is now used) </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static java.util.List<StateMod_Well> readStateModFile(String filename) throws Exception public static IList <StateMod_Well> readStateModFile(string filename) { string routine = "StateMod_Well.readStateModFile"; IList <StateMod_Well> theWellStations = new List <StateMod_Well>(); int[] format_1 = new int[] { StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_INTEGER, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_SPACE, StringUtil.TYPE_DOUBLE }; int[] format_1w = new int[] { 12, 24, 12, 8, 8, 1, 12, 1, 12 }; int[] format_2 = new int[] { StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_INTEGER, StringUtil.TYPE_INTEGER, StringUtil.TYPE_INTEGER, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_INTEGER, StringUtil.TYPE_INTEGER }; int[] format_2w = new int[] { 36, 12, 8, 8, 8, 8, 8, 8, 8 }; int[] format_4 = new int[] { StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_INTEGER }; int[] format_4w = new int[] { 36, 12, 8, 8 }; string iline = null; string s = null; IList <object> v = new List <object>(9); StreamReader @in = null; StateMod_Well aWell = null; StateMod_ReturnFlow aReturnNode = null; IList <string> effv = null; int nrtn, ndepl; Message.printStatus(1, routine, "Reading well file: " + filename); try { @in = new StreamReader(IOUtil.getPathUsingWorkingDir(filename)); while (!string.ReferenceEquals((iline = @in.ReadLine()), null)) { if (iline.StartsWith("#", StringComparison.Ordinal) || iline.Trim().Length == 0) { continue; } aWell = new StateMod_Well(); StringUtil.fixedRead(iline, format_1, format_1w, v); if (Message.isDebugOn) { Message.printDebug(50, routine, "iline: " + iline); } aWell.setID(((string)v[0]).Trim()); aWell.setName(((string)v[1]).Trim()); aWell.setCgoto(((string)v[2]).Trim()); aWell.setSwitch((int?)v[3]); aWell.setDivcapw((double?)v[4]); aWell.setCdividyw(((string)v[5]).Trim()); aWell.setPrimary((double?)v[6]); // user data iline = @in.ReadLine(); StringUtil.fixedRead(iline, format_2, format_2w, v); if (Message.isDebugOn) { Message.printDebug(50, routine, "iline: " + iline); } aWell.setIdvcow2(((string)v[0]).Trim()); aWell.setIdvcomw((int?)v[1]); // Don't set the number of return flow data get(2) or depletion data get(3) because // those will be calculated nrtn = ((int?)v[2]).Value; ndepl = ((int?)v[3]).Value; aWell.setDivefcw((double?)v[4]); aWell.setAreaw((double?)v[5]); aWell.setIrturnw((int?)v[6]); aWell.setDemsrcw((int?)v[7]); if (aWell.getDivefcw() >= 0) { // Efficiency line won't be included - set each value to the average for (int i = 0; i < 12; i++) { aWell.setDiveff(i, aWell.getDivefcw()); } } else { // 12 efficiency values iline = @in.ReadLine(); effv = StringUtil.breakStringList(iline, " ", StringUtil.DELIM_SKIP_BLANKS); for (int i = 0; i < 12; i++) { aWell.setDiveff(i, (string)effv[i]); } } // return flow data if (Message.isDebugOn) { Message.printDebug(50, routine, "Number of return flows: " + nrtn); } for (int i = 0; i < nrtn; i++) { iline = @in.ReadLine(); StringUtil.fixedRead(iline, format_4, format_4w, v); if (Message.isDebugOn) { Message.printDebug(50, routine, "Fixed read returned " + v.Count + " elements"); } aReturnNode = new StateMod_ReturnFlow(StateMod_DataSet.COMP_WELL_STATIONS); s = ((string)v[0]).Trim(); if (s.Length <= 0) { aReturnNode.setCrtnid(s); Message.printWarning(2, routine, "Return node for structure \"" + aWell.getID() + "\" is blank. "); } else { aReturnNode.setCrtnid(s); } aReturnNode.setPcttot(((double?)v[1])); aReturnNode.setIrtndl(((int?)v[2])); aWell.addReturnFlow(aReturnNode); } // depletion data for (int i = 0; i < ndepl; i++) { iline = @in.ReadLine(); StringUtil.fixedRead(iline, format_4, format_4w, v); aReturnNode = new StateMod_ReturnFlow(StateMod_DataSet.COMP_WELL_STATIONS); s = ((string)v[0]).Trim(); if (s.Length <= 0) { aReturnNode.setCrtnid(s); Message.printWarning(2, routine, "Return node for structure \"" + aWell.getID() + "\" is blank. "); } else { aReturnNode.setCrtnid(s); } aReturnNode.setPcttot(((double?)v[1])); aReturnNode.setIrtndl(((int?)v[2])); aWell.addDepletion(aReturnNode); } theWellStations.Add(aWell); } } catch (Exception e) { routine = null; format_1 = null; format_1w = null; format_2 = null; format_2w = null; format_4 = null; format_4w = null; s = null; v = null; if (@in != null) { @in.Close(); } @in = null; aWell = null; aReturnNode = null; effv = null; Message.printWarning(2, routine, e); throw e; } routine = null; format_1 = null; format_1w = null; format_2 = null; format_2w = null; format_4 = null; format_4w = null; iline = null; s = null; v = null; if (@in != null) { @in.Close(); } @in = null; aWell = null; aReturnNode = null; effv = null; return(theWellStations); }
/// <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]; } StateMod_Well smw = (StateMod_Well)_data.get(row); switch (col) { case COL_ID: smw.setID((string)value); break; case COL_NAME: smw.setName((string)value); break; case COL_RIVER_NODE_ID: smw.setCgoto((string)value); break; case COL_SWITCH: smw.setSwitch(((int?)value).Value); break; case COL_DAILY_ID: smw.setCdividyw((string)value); break; case COL_CAPACITY: smw.setDivcapw(((double?)value).Value); break; case COL_DIVERSION_ID: smw.setIdvcow2((string)value); break; case COL_DEMAND_TYPE: smw.setIdvcomw(((int?)value).Value); break; case COL_EFF_ANNUAL: smw.setDivefcw(((double?)value).Value); break; case COL_AREA: smw.setAreaw(((double?)value).Value); break; case COL_USE_TYPE: smw.setIrturnw(((int?)value).Value); break; case COL_DEMAND_SOURCE: smw.setDemsrcw(((int?)value).Value); break; case COL_PRIMARY: smw.setPrimary(((double?)value).Value); break; case COL_EFF_01: smw.setDiveff(0, (double?)value); break; case COL_EFF_02: smw.setDiveff(1, (double?)value); break; case COL_EFF_03: smw.setDiveff(2, (double?)value); break; case COL_EFF_04: smw.setDiveff(3, (double?)value); break; case COL_EFF_05: smw.setDiveff(4, (double?)value); break; case COL_EFF_06: smw.setDiveff(5, (double?)value); break; case COL_EFF_07: smw.setDiveff(6, (double?)value); break; case COL_EFF_08: smw.setDiveff(7, (double?)value); break; case COL_EFF_09: smw.setDiveff(8, (double?)value); break; case COL_EFF_10: smw.setDiveff(9, (double?)value); break; case COL_EFF_11: smw.setDiveff(10, (double?)value); break; case COL_EFF_12: smw.setDiveff(11, (double?)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_Well well = (StateMod_Well)_data.get(row); switch (col) { case COL_ID: return(well.getID()); case COL_NAME: return(well.getName()); case COL_RIVER_NODE_ID: return(well.getCgoto()); case COL_SWITCH: return(new int?(well.getSwitch())); case COL_DAILY_ID: return(well.getCdividyw()); case COL_CAPACITY: return(new double?(well.getDivcapw())); case COL_DIVERSION_ID: return(well.getIdvcow2()); case COL_DEMAND_TYPE: return(new int?(well.getIdvcomw())); case COL_EFF_ANNUAL: /* * double d = well.getDivefcw(); * double d2 = 0; * if (d != 0 && d < 0) { * d2 = d * -1; * } * if (d == 0) { * d2 = 0; * } * return new Double(d2); */ // this is done to prevent -0.00 values /* * double d = well.getDivefcw(); * double d2 = 0; * if (d == 0) { * d2 = 0; * } * return new Double(d2); */ return(new double?(well.getDivefcw())); case COL_AREA: return(new double?(well.getAreaw())); case COL_USE_TYPE: return(new int?(well.getIrturnw())); case COL_DEMAND_SOURCE: return(new int?(well.getDemsrcw())); case COL_PRIMARY: return(new double?(well.getPrimary())); case COL_EFF_01: return(new double?(well.getDiveff(0))); case COL_EFF_02: return(new double?(well.getDiveff(1))); case COL_EFF_03: return(new double?(well.getDiveff(2))); case COL_EFF_04: return(new double?(well.getDiveff(3))); case COL_EFF_05: return(new double?(well.getDiveff(4))); case COL_EFF_06: return(new double?(well.getDiveff(5))); case COL_EFF_07: return(new double?(well.getDiveff(6))); case COL_EFF_08: return(new double?(well.getDiveff(7))); case COL_EFF_09: return(new double?(well.getDiveff(8))); case COL_EFF_10: return(new double?(well.getDiveff(9))); case COL_EFF_11: return(new double?(well.getDiveff(10))); case COL_EFF_12: return(new double?(well.getDiveff(11))); 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> /// Sets up the data lists to display the reservoir collection data in the GUI. /// </summary> private void setupData() { int[] years = null; int yearArrayLen = 0; int nwell = _data.size(); int nParts = 0; int nIdTypes = 0; StateMod_Well well = null; string colType = null; string id = null; string partType = null; System.Collections.IList ids = null; System.Collections.IList idTypes = null; string idType = null; __data = new System.Collections.IList[__COLUMNS]; for (int i = 0; i < __COLUMNS; i++) { __data[i] = new List <object>(); } int rows = 0; for (int i = 0; i < nwell; i++) { well = (StateMod_Well)_data.get(i); id = well.getID(); years = well.getCollectionYears(); colType = well.getCollectionType(); partType = well.getCollectionPartType(); if (years == null) { yearArrayLen = 1; // Cause the loop below to go through once } else { yearArrayLen = years.Length; } for (int j = 0; j < yearArrayLen; j++) { // Part IDs for the year if ((years == null) || (years.Length == 0)) { ids = well.getCollectionPartIDs(0); } else { ids = well.getCollectionPartIDs(years[j]); } if (ids == null) { nParts = 0; } else { nParts = ids.Count; } // Part ID types for the year. idTypes = well.getCollectionPartIDTypes(); if (idTypes == null) { nIdTypes = 0; } else { nIdTypes = idTypes.Count; } for (int k = 0; k < nParts; k++) { __data[__COL_ID].Add(id); __data[__COL_YEAR].Add(new int?(years[j])); __data[__COL_COL_TYPE].Add(colType); __data[__COL_PART_TYPE].Add(partType); __data[__COL_PART_ID].Add(ids[k]); idType = ""; if (nIdTypes != 0) { idType = (string)idTypes[k]; // Should align with ids.get(k) } __data[__COL_PART_ID_TYPE].Add(idType); rows++; } } } _rows = rows; }
/// <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_Well well = (StateMod_Well)_data.get(row); switch (col) { case COL_ID: return(well.getID()); case COL_NAME: return(well.getName()); case COL_DAILY_ID: return(well.getCdividyw()); case COL_CAPACITY: return(new double?(well.getDivcapw())); case COL_DIVERSION_ID: return(well.getIdvcow2()); case COL_DEMAND_TYPE: return(new int?(well.getIdvcomw())); case COL_EFF_ANNUAL: return(new double?(well.getDivefcw())); case COL_AREA: return(new double?(well.getAreaw())); case COL_USE_TYPE: return(new int?(well.getIrturnw())); case COL_DEMAND_SOURCE: return(new int?(well.getDemsrcw())); case COL_PRIMARY: return(new double?(well.getPrimary())); case COL_EFF_01: return(new double?(well.getDiveff(0))); case COL_EFF_02: return(new double?(well.getDiveff(1))); case COL_EFF_03: return(new double?(well.getDiveff(2))); case COL_EFF_04: return(new double?(well.getDiveff(3))); case COL_EFF_05: return(new double?(well.getDiveff(4))); case COL_EFF_06: return(new double?(well.getDiveff(5))); case COL_EFF_07: return(new double?(well.getDiveff(6))); case COL_EFF_08: return(new double?(well.getDiveff(7))); case COL_EFF_09: return(new double?(well.getDiveff(8))); case COL_EFF_10: return(new double?(well.getDiveff(9))); case COL_EFF_11: return(new double?(well.getDiveff(10))); case COL_EFF_12: return(new double?(well.getDiveff(11))); default: return(""); } }