/// <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_WellAugmentation wellAug = (StateMod_Plan_WellAugmentation)_data.get(row);

            switch (col)
            {
            case COL_PLAN_ID:
                return(wellAug.getID());

            case COL_WELL_RIGHT_ID:
                return(wellAug.getCistatW());

            case COL_WELL_STRUCTURE_ID:
                return(wellAug.getCistatS());

            case COL_COMMENT:
                return(wellAug.getComment());

            default:
                return("");
            }

            /*
             * if (!__showTotals) {
             *      row = ((Integer)__rowMap.get(row)).intValue();
             * }
             * return __data[col].get(row);
             */
        }
Exemple #2
0
        /// <summary>
        /// Write well augmentation data to a StateMod file.  History header information
        /// is also maintained by calling this routine. </summary>
        /// <param name="instrfile"> input file from which previous history should be taken </param>
        /// <param name="outstrfile"> output file to which to write </param>
        /// <param name="wellAugList"> list of plans to write. </param>
        /// <param name="newComments"> addition comments which should be included in history </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 writeStateModFile(String instrfile, String outstrfile, java.util.List<StateMod_Plan_WellAugmentation> wellAugList, java.util.List<String> newComments) throws Exception
        public static void writeStateModFile(string instrfile, string outstrfile, IList <StateMod_Plan_WellAugmentation> wellAugList, IList <string> newComments)
        {
            string         routine           = "StateMod_Plan_WellAugmentation.writeStateModFile";
            IList <string> commentIndicators = new List <string>(1);

            commentIndicators.Add("#");
            IList <string> ignoredCommentIndicators = new List <string>(1);

            ignoredCommentIndicators.Add("#>");
            PrintWriter @out = null;
            string      comment;

            try
            {
                @out = IOUtil.processFileHeaders(IOUtil.getPathUsingWorkingDir(instrfile), IOUtil.getPathUsingWorkingDir(outstrfile), newComments, commentIndicators, ignoredCommentIndicators, 0);

                int    i;
                string iline;
                string cmnt = "#>";
                // This format follows historical conventions found in example files, limited by StateMod ID lengths
                string formatLine1 = "%-12.12s %-12.12s %-12.12s"; // Comment only written if not blank
                StateMod_Plan_WellAugmentation wellAug = null;
                IList <object> v = new List <object>(11);          // Reuse for all output lines.

                @out.println(cmnt);
                @out.println(cmnt + "*************************************************");
                @out.println(cmnt + "  StateMod Well Augmentation Plan Data");
                @out.println(cmnt);
                @out.println(cmnt + "  Free format; however historical format based on StateMod");
                @out.println(cmnt + "               identifier string lengths is used for consistency.");
                @out.println(cmnt);
                @out.println(cmnt + "  Plan ID      cistatP :  Plan identifier");
                @out.println(cmnt + "  WellRightID  cistatW :  Well right identifier");
                @out.println(cmnt + "  Well ID      cistatS :  Well (structure) identifier");
                @out.println(cmnt + "  Comment              :  Optional comments");
                @out.println(cmnt + "                          Double quote to faciliate free-format processing.");
                @out.println(cmnt);
                @out.println(cmnt + " Plan ID    WellRightID    Well ID        Comment");
                @out.println(cmnt + "---------exb----------exb----------exb-------------------------------e");
                @out.println(cmnt + "EndHeader");

                int num = 0;
                if (wellAugList != null)
                {
                    num = wellAugList.Count;
                }
                for (i = 0; i < num; i++)
                {
                    wellAug = wellAugList[i];
                    if (wellAug == null)
                    {
                        continue;
                    }

                    // line 1
                    v.Clear();
                    v.Add(wellAug.getID());
                    v.Add(wellAug.getCistatW());
                    v.Add(wellAug.getCistatS());
                    comment = wellAug.getComment().Trim();
                    if (comment.Length > 0)
                    {
                        comment = " \"" + comment + "\"";
                    }
                    iline = StringUtil.formatString(v, formatLine1) + comment;
                    @out.println(iline);
                }
            }
            catch (Exception e)
            {
                Message.printWarning(3, routine, e);
                throw e;
            }
            finally
            {
                if (@out != null)
                {
                    @out.flush();
                    @out.close();
                }
            }
        }