/// <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_ReservoirAccount rac = (StateMod_ReservoirAccount)_data.get(row);

            // necessary for table models that display accounts for 1+ reservoirs,
            // 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 (!__singleReservoir)
            {
                col--;
            }

            switch (col)
            {
            case COL_RESERVOIR_ID:
                return(rac.getCgoto());

            case COL_OWNER_ID:
                return(rac.getID());

            case COL_OWNER_ACCOUNT:
                return(rac.getName());

            case COL_MAX_STORAGE:
                return(new double?(rac.getOwnmax()));

            case COL_INITIAL_STORAGE:
                return(new double?(rac.getCurown()));

            case COL_PRORATE_EVAP:
                return(new double?(rac.getPcteva()));

            case COL_OWNERSHIP_TIE:
                return(new int?(rac.getN2own()));

            default:
                return("");
            }
        }
        /// <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_ReservoirAccount rac = (StateMod_ReservoirAccount)_data.get(row);

            switch (col)
            {
            case COL_RESERVOIR_ID:
                return(rac.getCgoto());

            case COL_OWNER_ID:
                return(rac.getID());

            case COL_OWNER_ACCOUNT:
                return(rac.getName());

            case COL_MAX_STORAGE:
                return(new double?(rac.getOwnmax()));

            case COL_INITIAL_STORAGE:
                return(new double?(rac.getCurown()));

            case COL_PRORATE_EVAP:
                return(new double?(rac.getPcteva()));

            case COL_OWNERSHIP_TIE:
                return(new int?(rac.getN2own()));

            default:
                return("");
            }
        }
        /// <summary>
        /// Writes a list of StateMod_ReservoirAccount objects to a list file.  A header
        /// is printed to the top of the file, containing the commands used to generate the
        /// file.  Any strings in the body of the file that contain the field delimiter will be wrapped in "...". </summary>
        /// <param name="filename"> the name of the file to which the data will be written. </param>
        /// <param name="delimiter"> the delimiter to use for separating field values. </param>
        /// <param name="update"> whether to update an existing file, retaining the current
        /// header (true) or to create a new file with a new header. </param>
        /// <param name="data"> the list of objects to write. </param>
        /// <param name="newComments"> new comments to add to the top of the file. </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 void writeListFile(String filename, String delimiter, boolean update, java.util.List data, java.util.List newComments) throws Exception
        public static void writeListFile(string filename, string delimiter, bool update, System.Collections.IList data, System.Collections.IList newComments)
        {
            string routine = "StateMod_ReservoirAccount.writeListFile";
            int    size    = 0;

            if (data != null)
            {
                size = data.Count;
            }

            System.Collections.IList fields = new List <object>();
            fields.Add("ReservoirID");
            fields.Add("OwnerID");
            fields.Add("OwnerAccount");
            fields.Add("MaxStorage");
            fields.Add("InitialStorage");
            fields.Add("ProrateEvap");
            fields.Add("OwnershipTie");
            int fieldCount = fields.Count;

            string[] names   = new string[fieldCount];
            string[] formats = new string[fieldCount];
            int      comp    = StateMod_DataSet.COMP_RESERVOIR_STATION_ACCOUNTS;
            string   s       = null;

            for (int i = 0; i < fieldCount; i++)
            {
                s          = (string)fields[i];
                names[i]   = StateMod_Util.lookupPropValue(comp, "FieldName", s);
                formats[i] = StateMod_Util.lookupPropValue(comp, "Format", s);
            }

            string oldFile = null;

            if (update)
            {
                oldFile = IOUtil.getPathUsingWorkingDir(filename);
            }

            int j = 0;
            StateMod_ReservoirAccount acct = null;

            System.Collections.IList commentIndicators = new List <object>(1);
            commentIndicators.Add("#");
            System.Collections.IList ignoredCommentIndicators = new List <object>(1);
            ignoredCommentIndicators.Add("#>");
            string[]      line   = new string[fieldCount];
            StringBuilder buffer = new StringBuilder();
            PrintWriter   @out   = null;

            try
            {
                // Add some basic comments at the top of the file.  Do this to a copy of the
                // incoming comments so that they are not modified in the calling code.
                System.Collections.IList newComments2 = null;
                if (newComments == null)
                {
                    newComments2 = new List <object>();
                }
                else
                {
                    newComments2 = new List <object>(newComments);
                }
                newComments2.Insert(0, "");
                newComments2.Insert(1, "StateMod reservoir station accounts as a delimited list file.");
                newComments2.Insert(2, "See also the associated station, precipitation station, evaporation station,");
                newComments2.Insert(3, "content/area/seepage, and collection files.");
                newComments2.Insert(4, "");
                @out = IOUtil.processFileHeaders(oldFile, IOUtil.getPathUsingWorkingDir(filename), newComments2, commentIndicators, ignoredCommentIndicators, 0);

                for (int i = 0; i < fieldCount; i++)
                {
                    buffer.Append("\"" + names[i] + "\"");
                    if (i < (fieldCount - 1))
                    {
                        buffer.Append(delimiter);
                    }
                }

                @out.println(buffer.ToString());

                for (int i = 0; i < size; i++)
                {
                    acct = (StateMod_ReservoirAccount)data[i];

                    line[0] = StringUtil.formatString(acct.getCgoto(), formats[0]).Trim();
                    line[1] = StringUtil.formatString(acct.getID(), formats[1]).Trim();
                    line[2] = StringUtil.formatString(acct.getName(), formats[2]).Trim();
                    line[3] = StringUtil.formatString(acct.getOwnmax(), formats[3]).Trim();
                    line[4] = StringUtil.formatString(acct.getCurown(), formats[4]).Trim();
                    line[5] = StringUtil.formatString(acct.getPcteva(), formats[5]).Trim();
                    line[6] = StringUtil.formatString(acct.getN2own(), formats[6]).Trim();

                    buffer = new StringBuilder();
                    for (j = 0; j < fieldCount; j++)
                    {
                        if (line[j].IndexOf(delimiter, StringComparison.Ordinal) > -1)
                        {
                            line[j] = "\"" + line[j] + "\"";
                        }
                        buffer.Append(line[j]);
                        if (j < (fieldCount - 1))
                        {
                            buffer.Append(delimiter);
                        }
                    }

                    @out.println(buffer.ToString());
                }
            }
            catch (Exception e)
            {
                Message.printWarning(3, routine, e);
                throw e;
            }
            finally
            {
                if (@out != null)
                {
                    @out.flush();
                    @out.close();
                }
            }
        }