/// <summary>
        /// Helper method to check well rights component data.  The following are checked:
        /// <ol>
        /// <li>	Well stations without at least one right are listed.  This requires that
        /// the dataset include well stations.</li>
        /// <li>	Well rights with yield <= 0.0</li>
        /// <li>	Well rights summary for a station is not equal to the well capacity.
        /// This requires that the dataset include well stations.<li>
        /// </ol>
        /// </summary>
        private void checkWellStationRights(PropList props, System.Collections.IList wer_Vector)
        {
            int size = 0;

            // create elements for the checks and check file
            string[] header = StateMod_WellRight.getDataHeader();
            System.Collections.IList data = new List <object>();
            string title = "Well Rights";

            // Do the general data validation
            // using this components data table model
            StateMod_Data_TableModel tm = new StateMod_WellRight_Data_TableModel(wer_Vector, false);

            System.Collections.IList @checked = performDataValidation(tm, title);
            //String [] columnHeader = getDataTableModelColumnHeader( tm );
            string[] columnHeader = getColumnHeader(tm);

            // check Well Station data
            PropList props_rights = new PropList("Well Rights");

            props_rights.add("checkRights=true");
            System.Collections.IList wes_Vector = getComponentData(StateMod_DataSet.COMP_WELL_STATIONS);
            if (wes_Vector != null && wes_Vector.Count > 0)
            {
                checkWellStationData(props_rights, wes_Vector);
            }
            props_rights = null;     // cleanup

            // Check to make sure the sum of well rights equals the well station
            // capacity...
            checkWellRights_CapacityData();

            // Since well rights are determined from parcel data, print a list of
            // well rights that do not have associated yield (decree)...
            size = 0;
            if (wer_Vector != null)
            {
                size = wer_Vector.Count;
            }
            // Do data checks listed in the StateMod_WellRight class
            // Remove all previous checks from StateMod_Well
            data.Clear();
            data = doSpecificDataChecks(wer_Vector, props);
            // provides basic header information for this data check table
            string info = "The following well rights (" + data.Count +
                          " out of " + size +
                          ") have no decree (checked to StateMod file .XX precision).\n" +
                          "Well yield data may not be available.";

            // 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);
        }
        /// <summary>
        /// Called when the Apply button is pressed. This commits any changes to the data objects.
        /// </summary>
        protected internal override void apply()
        {
            StateMod_WellRight right = null;
            int size = _data.Count;

            for (int i = 0; i < size; i++)
            {
                right = (StateMod_WellRight)_data[i];
                right.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_WellRight right = null;
            int size = _data.Count;

            for (int i = 0; i < size; i++)
            {
                right = (StateMod_WellRight)_data[i];
                right.restoreOriginal();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a list of references to rights for this well. </summary>
        /// <param name="rights"> all rights </param>
        public virtual void connectRights(IList <StateMod_WellRight> rights)
        {
            if (rights == null)
            {
                return;
            }

            int num_rights = rights.Count;

            StateMod_WellRight right = null;

            for (int i = 0; i < num_rights; i++)
            {
                right = rights[i];
                if (right == null)
                {
                    continue;
                }
                if (_id.Equals(right.getCgoto(), StringComparison.OrdinalIgnoreCase))
                {
                    _rights.Add(right);
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Saves the input back into the dataset. </summary>
        /// <returns> true if the data was saved successfuly.  False if not. </returns>
        private bool saveData()
        {
            string routine = "StateMod_Well_Right_JFrame.saveData";

            if (!__worksheet.stopEditing())
            {
                // don't save if there are errors.
                Message.printWarning(1, routine, "There are errors in the data " + "that must be corrected before data can be saved.", this);
                return(false);
            }

            if (checkInput() > 0)
            {
                return(false);
            }

            // now only save data if any are different.
            bool needToSave = false;

            // if the Vectors are differently-sized, they're different
//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> wv = (java.util.List<StateMod_WellRight>)__worksheet.getAllData();
            IList <StateMod_WellRight> wv = (IList <StateMod_WellRight>)__worksheet.getAllData();   // w for worksheet
            IList <StateMod_WellRight> lv = (IList <StateMod_WellRight>)__currentWell.getRights();  // l for welL

            needToSave = !(StateMod_WellRight.Equals(wv, lv));

            Message.printStatus(1, routine, "Saving? .........[" + needToSave + "]");

            if (!needToSave)
            {
                // there's nothing different -- users may even have deleted
                // some rights and added back in identical values
                return(true);
            }

            // at this point, remove the old diversion rights from the original
            // component Vector
//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>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_RIGHTS)).getData();
            IList <StateMod_WellRight> wellRights = (IList <StateMod_WellRight>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_RIGHTS)).getData();
            int size = lv.Count;
            StateMod_WellRight wr;

            for (int i = 0; i < size; i++)
            {
                wr = lv[i];
                StateMod_Util.removeFromVector(wellRights, wr);
            }

            // now add the elements from the new Vector to the wellRights
            // Vector.
            size = wv.Count;
            StateMod_WellRight cwr = null;

            for (int i = 0; i < size; i++)
            {
                wr           = (StateMod_WellRight)wv[i];
                cwr          = (StateMod_WellRight)wr.clone();
                cwr._isClone = false;
                wellRights.Add(cwr);
            }

            // sort the wellRights Vector
            // REVISIT (JTS - 2003-10-10)
            // here we are sorting the full data array -- may be a performance
            // issue
            IList <StateMod_WellRight> sorted = StateMod_Util.sortStateMod_DataVector(wellRights);

            __dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_RIGHTS).setData(sorted);
            __currentWell.disconnectRights();
            __currentWell.connectRights(sorted);
            __dataset.setDirty(StateMod_DataSet.COMP_WELL_RIGHTS, true);
            return(true);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Checks the data to make sure that all the data are valid. </summary>
        /// <returns> 0 if the data are valid, 1 if errors exist and -1 if non-fatal errors
        /// exist. </returns>
        private int checkInput()
        {
            string routine = "StateMod_Well_Right_JFrame.checkInput";
//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> v = (java.util.List<StateMod_WellRight>)__worksheet.getAllData();
            IList <StateMod_WellRight> v = (IList <StateMod_WellRight>)__worksheet.getAllData();

            int size = v.Count;
            StateMod_WellRight right   = null;
            string             warning = "";
            string             id;
            string             name;
            string             wellID;
            string             adminNum;
            int fatalCount = 0;

            for (int i = 0; i < size; i++)
            {
                right = (StateMod_WellRight)(v[i]);

                id       = right.getID();
                name     = right.getName();
                wellID   = right.getCgoto();
                adminNum = right.getIrtem();

                if (id.Length > 12)
                {
                    warning += "\nWell right ID (" + id + ") is "
                               + "longer than 12 characters.";
                    fatalCount++;
                }

                if (id.IndexOf(" ", StringComparison.Ordinal) > -1 || id.IndexOf("-", StringComparison.Ordinal) > -1)
                {
                    warning += "\nWell right ID (" + id + ") cannot "
                               + "contain spaces or dashes.";
                    fatalCount++;
                }

                if (name.Length > 24)
                {
                    warning += "\nWell name (" + name + ") is "
                               + "longer than 24 characters.";
                    fatalCount++;
                }

                if (wellID.Length > 12)
                {
                    warning += "\nWell ID associated with right ("
                               + wellID + ") is longer than 12 characters.";
                }

                if (!StringUtil.isDouble(adminNum))
                {
                    warning += "\nAdministration number (" + adminNum + ") is not a number.";
                    fatalCount++;
                }

                // the rest are handled by the worksheet
            }
            // REVISIT - if daily time series are supplied, check for time series
            // and allow creation if not available.
            if (warning.Length > 0)
            {
                warning += "\nCorrect or Cancel.";
                Message.printWarning(1, routine, warning, this);
                if (fatalCount > 0)
                {
                    // Fatal errors...
                    Message.printStatus(1, routine, "Returning 1 from checkInput()");
                    return(1);
                }
                else
                {         // Nonfatal errors...
                    Message.printStatus(1, routine, "Returning -1 from checkInput()");
                    return(-1);
                }
            }
            else
            {     // No errors...
                Message.printStatus(1, routine, "Returning 0 from checkInput()");
                return(0);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Responds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that happened. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string routine = "StateMod_Well_Right_JFrame.actionPerformed";

            string action = e.getActionCommand();

            if (action.Equals(__BUTTON_ADD_RIGHT))
            {
                StateMod_WellRight aRight = new StateMod_WellRight();
                aRight._isClone = true;
                StateMod_WellRight last = (StateMod_WellRight)__worksheet.getLastRowData();

                if (last == null)
                {
                    aRight.setID(StateMod_Util.createNewID(__currentWell.getID()));
                    aRight.setCgoto(__currentWell.getID());
                }
                else
                {
                    aRight.setID(StateMod_Util.createNewID(last.getID()));
                    aRight.setCgoto(last.getCgoto());
                }
                __worksheet.addRow(aRight);
                __worksheet.scrollToLastRow();
                __worksheet.selectLastRow();
                __deleteRight.setEnabled(true);
            }
            else if (action.Equals(__BUTTON_DEL_RIGHT))
            {
                int row = __worksheet.getSelectedRow();
                if (row != -1)
                {
                    int x = (new ResponseJDialog(this, "Delete right", "Delete well right?", ResponseJDialog.YES | ResponseJDialog.NO)).response();
                    if (x == ResponseJDialog.NO)
                    {
                        return;
                    }

                    __worksheet.cancelEditing();
                    __worksheet.deleteRow(row);
                    __deleteRight.setEnabled(false);
                }
                else
                {
                    Message.printWarning(1, routine, "Must select desired right to delete.");
                }
            }
            else if (action.Equals(__BUTTON_HELP))
            {
                // REVISIT HELP (JTS - 2003-06-10)
            }
            else if (action.Equals(__BUTTON_CLOSE))
            {
                if (saveData())
                {
                    setVisible(false);
                    dispose();
                }
            }
            else if (action.Equals(__BUTTON_APPLY))
            {
                saveData();
            }
            else if (action.Equals(__BUTTON_CANCEL))
            {
                setVisible(false);
                dispose();
            }
        }
        /// <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];
            }
            double dval;
            int    ival;

            StateMod_WellRight wellr = (StateMod_WellRight)_data.get(row);

            // necessary for table models that display rights for 1+ wells so that
            // the -1st column (ID) can also be displayed.  By doing it this way,
            // code can be shared between the two kinds of table models and less
            // maintenance is necessary.
            if (!__singleWell)
            {
                col--;
            }

            switch (col)
            {
            case COL_WELL_ID:
                wellr.setCgoto((string)value);
                break;

            case COL_RIGHT_ID:
                wellr.setID((string)value);
                break;

            case COL_RIGHT_NAME:
                wellr.setName((string)value);
                break;

            case COL_STRUCT_ID:
                wellr.setCgoto((string)value);
                break;

            case COL_ADMIN_NUM:
                wellr.setIrtem((string)value);
                break;

            case COL_DCR_AMT:
                if (value is string)
                {
                    try
                    {
                        dval = (Convert.ToDouble((string)value));
                    }
                    catch (Exception e)
                    {
                        Message.printWarning(2, "setValue", e);
                        return;
                    }
                }
                else
                {
                    dval = ((double?)value).Value;
                }
                wellr.setDcrdivw(dval);
                break;

            case COL_ON_OFF:
                if (value is int?)
                {
                    ival = ((int?)value).Value;
                    wellr.setSwitch(ival);
                }
                else if (value is string)
                {
                    string onOff = (string)value;
                    int    index = onOff.IndexOf(" -", StringComparison.Ordinal);
                    ival = (Convert.ToInt32(onOff.Substring(0, index)));
                    wellr.setSwitch(ival);
                }
                break;
            }

            if (!__singleWell)
            {
                col++;
            }

            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_WellRight wellr = (StateMod_WellRight)_data.get(row);

            // necessary for table models that display rights for 1+ wells so that
            // the -1st column (ID) can also be displayed.  By doing it this way,
            // code can be shared between the two kinds of table models and less
            // maintenance is necessary.
            if (!__singleWell)
            {
                col--;
            }

            switch (col)
            {
            case COL_WELL_ID:
                return(wellr.getCgoto());

            case COL_RIGHT_ID:
                return(wellr.getID());

            case COL_RIGHT_NAME:
                return(wellr.getName());

            case COL_STRUCT_ID:
                return(wellr.getCgoto());

            case COL_ADMIN_NUM:
                return(wellr.getIrtem());

            case COL_DCR_AMT:
                return(new double?(wellr.getDcrdivw()));

            case COL_ON_OFF:
                return(new int?(wellr.getSwitch()));

            case COL_PARCEL_YEAR:
                return(new int?(wellr.getParcelYear()));

            case COL_PARCEL_CLASS:
                return(new int?(wellr.getParcelMatchClass()));

            case COL_PARCEL_ID:
                return(Convert.ToInt32(wellr.getParcelID()));

            case COL_COLLECTION_TYPE:
                return(wellr.getCollectionType());

            case COL_COLLECTION_PART_TYPE:
                return(wellr.getCollectionPartType());

            case COL_COLLECTION_PART_ID:
                return(wellr.getCollectionPartId());

            case COL_COLLECTION_PART_ID_TYPE:
                return(wellr.getCollectionPartIdType());

            case COL_X_RIGHT_WDID:
                return(wellr.getXWDID());

            case COL_X_RIGHT_APPROPRIATION_DATE:
                if (wellr.getXApproDate() == null)
                {
                    return(null);
                }
                else
                {
                    DateTime dt = new DateTime(wellr.getXApproDate());
                    return(dt.ToString());
                }

            case COL_X_RIGHT_ADMIN_NUMBER:
                return(wellr.getXApproDateAdminNumber());

            case COL_X_PERMIT_RECEIPT:
                return(wellr.getXPermitReceipt());

            case COL_X_PERMIT_DATE:
                if (wellr.getXPermitDate() == null)
                {
                    return(null);
                }
                else
                {
                    DateTime dt = new DateTime(wellr.getXPermitDate());
                    return(dt.ToString());
                }

            case COL_X_PERMIT_ADMIN_NUMBER:
                return(wellr.getXPermitDateAdminNumber());

            case COL_X_WELL_YIELD_GPM:
                return(wellr.getXYieldGPM());

            case COL_X_WELL_YIELD_CFS:
                return(wellr.getXYieldGPM() * .002228);

            case COL_X_APEX_GPM:
                return(wellr.getXYieldApexGPM());

            case COL_X_APEX_CFS:
                return(wellr.getXYieldApexGPM() * .002228);

            case COL_X_WELL_FRACTION:
                return(wellr.getXFractionYield());

            case COL_X_DITCH_FRACTION:
                return(wellr.getXDitchFraction());

            case COL_X_YIELD_PRORATED_GPM:
                return(new double?(wellr.getDcrdivw() / .002228));

            default:
                return("");
            }
        }
Ejemplo n.º 10
0
        /// <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];
            }
            double dval;
            int    ival;

            StateMod_WellRight wellr = (StateMod_WellRight)_data.get(row);

            switch (col)
            {
            case COL_RIGHT_ID:
                wellr.setID((string)value);
                break;

            case COL_RIGHT_NAME:
                wellr.setName((string)value);
                break;

            case COL_STRUCT_ID:
                wellr.setCgoto((string)value);
                break;

            case COL_ADMIN_NUM:
                wellr.setIrtem((string)value);
                break;

            case COL_DCR_AMT:
                if (value is string)
                {
                    try
                    {
                        dval = (Convert.ToDouble((string)value));
                    }
                    catch (Exception e)
                    {
                        Message.printWarning(2, "setValue", e);
                        return;
                    }
                }
                else
                {
                    dval = ((double?)value).Value;
                }
                wellr.setDcrdivw(dval);
                break;

            case COL_ON_OFF:
                if (value is int?)
                {
                    ival = ((int?)value).Value;
                    wellr.setSwitch(ival);
                }
                else if (value is string)
                {
                    string onOff = (string)value;
                    int    index = onOff.IndexOf(" -", StringComparison.Ordinal);
                    ival = (Convert.ToInt32(onOff.Substring(0, index)));
                    wellr.setSwitch(ival);
                }
                break;
            }

            base.setValueAt(value, row, col);
        }
Ejemplo n.º 11
0
        /// <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_WellRight wellr = (StateMod_WellRight)_data.get(row);

            switch (col)
            {
            case COL_RIGHT_ID:
                return(wellr.getID());

            case COL_RIGHT_NAME:
                return(wellr.getName());

            case COL_STRUCT_ID:
                return(wellr.getCgoto());

            case COL_ADMIN_NUM:
                return(wellr.getIrtem());

            case COL_DCR_AMT:
                return(new double?(wellr.getDcrdivw()));

            case COL_ON_OFF:
                return(new int?(wellr.getSwitch()));

            case COL_PARCEL_YEAR:
                return(new int?(wellr.getParcelYear()));

            case COL_PARCEL_CLASS:
                return(new int?(wellr.getParcelMatchClass()));

            case COL_PARCEL_ID:
                return(wellr.getParcelID());

            case COL_COLLECTION_TYPE:
                return(wellr.getCollectionType());

            case COL_COLLECTION_PART_TYPE:
                return(wellr.getCollectionPartType());

            case COL_COLLECTION_PART_ID:
                return(wellr.getCollectionPartId());

            case COL_COLLECTION_PART_ID_TYPE:
                return(wellr.getCollectionPartIdType());

            case COL_X_RIGHT_WDID:
                return(wellr.getXWDID());

            case COL_X_RIGHT_APPROPRIATION_DATE:
                if (wellr.getXApproDate() == null)
                {
                    return(null);
                }
                else
                {
                    DateTime dt = new DateTime(wellr.getXApproDate());
                    return(dt.ToString());
                }

            case COL_X_RIGHT_ADMIN_NUMBER:
                return(wellr.getXApproDateAdminNumber());

            case COL_X_RIGHT_USE:
                return(wellr.getXUse());

            case COL_X_PERMIT_RECEIPT:
                return(wellr.getXPermitReceipt());

            case COL_X_PERMIT_DATE:
                if (wellr.getXPermitDate() == null)
                {
                    return(null);
                }
                else
                {
                    DateTime dt = new DateTime(wellr.getXPermitDate());
                    return(dt.ToString());
                }

            case COL_X_PERMIT_ADMIN_NUMBER:
                return(wellr.getXPermitDateAdminNumber());

            case COL_X_WELL_YIELD_GPM:
                return(wellr.getXYieldGPM());

            case COL_X_WELL_YIELD_CFS:
                return(wellr.getXYieldGPM() * .002228);

            case COL_X_APEX_GPM:
                return(wellr.getXYieldApexGPM());

            case COL_X_APEX_CFS:
                return(wellr.getXYieldApexGPM() * .002228);

            case COL_X_WELL_FRACTION:
                return(wellr.getXFractionYield());

            case COL_X_DITCH_FRACTION:
                return(wellr.getXDitchFraction());

            case COL_X_YIELD_PRORATED_GPM:
                return(new double?(wellr.getDcrdivw() / .002228));

            default:
                return("");
            }
        }
Ejemplo n.º 12
0
//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");
        }