/// <summary> /// Sets the value at the specified position to the specified value. </summary> /// <param name="value"> the value to set the cell to. </param> /// <param name="row"> the row of the cell for which to set the value. </param> /// <param name="col"> the col of the cell for which to set the value. </param> public virtual void setValueAt(object value, int row, int col) { if (_sortOrder != null) { row = _sortOrder[row]; } double dval; StateMod_ReservoirAreaCap ra = (StateMod_ReservoirAreaCap)_data.get(row); switch (col) { case COL_RESERVOIR_ID: ra.setCgoto((string)value); break; case COL_CAPACITY: dval = ((double?)value).Value; ra.setConten(dval); break; case COL_AREA: dval = ((double?)value).Value; ra.setSurarea(dval); break; case COL_SEEPAGE: dval = ((double?)value).Value; ra.setSeepage(dval); break; } base.setValueAt(value, row, col); }
/// <summary> /// Clones the data object. </summary> /// <returns> a cloned object. </returns> public override object clone() { StateMod_ReservoirAreaCap ac = (StateMod_ReservoirAreaCap)base.clone(); ac._isClone = true; return(ac); }
/// <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_ReservoirAreaCap ra = (StateMod_ReservoirAreaCap)_data.get(row); switch (col) { case COL_RESERVOIR_ID: return(ra.getCgoto()); case COL_CAPACITY: return(new double?(ra.getConten())); case COL_AREA: return(new double?(ra.getSurarea())); case COL_SEEPAGE: return(new double?(ra.getSeepage())); default: return(""); } }
/// <summary> /// Responds to action performed events. </summary> /// <param name="e"> the ActionEvent that happened. </param> public virtual void actionPerformed(ActionEvent e) { string action = e.getActionCommand(); if (action.Equals(__GraphArea_String)) { graph(__GraphArea_String); } else if (action.Equals(__GraphSeepage_String)) { graph(__GraphSeepage_String); } else if (action.Equals(__BUTTON_ADD_AREA_CAPACITY)) { StateMod_ReservoirAreaCap anAreaCapNode = new StateMod_ReservoirAreaCap(); anAreaCapNode._isClone = true; __worksheet.addRow(anAreaCapNode); __worksheet.scrollToLastRow(); __worksheet.selectLastRow(); __deleteAreaCap.setEnabled(true); } else if (action.Equals(__BUTTON_DEL_AREA_CAPACITY)) { int row = __worksheet.getSelectedRow(); if (row != -1) { int x = (new ResponseJDialog(this, "Delete Content/Area/Seepage line?", "Delete Content/Area/Seepage line?", ResponseJDialog.YES | ResponseJDialog.NO)).response(); if (x == ResponseJDialog.NO) { return; } __worksheet.deleteRow(row); __deleteAreaCap.setEnabled(false); } } 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(); } else if (action.Equals(__BUTTON_HELP)) { // REVISIT HELP (JTS - 2003-06-09) } }
/// <summary> /// Called when the cancel button is pressed. This discards any changes made to the data objects. /// </summary> protected internal override void cancel() { StateMod_ReservoirAreaCap ac = null; int size = _data.Count; for (int i = 0; i < size; i++) { ac = (StateMod_ReservoirAreaCap)_data[i]; ac.restoreOriginal(); } }
/// <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_ReservoirAreaCap ac = null; int size = _data.Count; for (int i = 0; i < size; i++) { ac = (StateMod_ReservoirAreaCap)_data[i]; ac.createBackup(); } }
/// <summary> /// Cancels any changes made to this object within a GUI since createBackup() /// was called and sets _original to null. /// </summary> public override void restoreOriginal() { StateMod_ReservoirAreaCap ac = (StateMod_ReservoirAreaCap)_original; base.restoreOriginal(); _conten = ac._conten; _surarea = ac._surarea; _seepage = ac._seepage; _isClone = false; _original = null; }
/// <summary> /// Add AreaCap. </summary> /// <param name="areacap"> StateMod_ReservoirAreaCap to add. </param> public virtual void addAreaCap(StateMod_ReservoirAreaCap areacap) { if (areacap != null) { _areacapvals.Add(areacap); setDirty(true); if (!_isClone && _dataset != null) { _dataset.setDirty(StateMod_DataSet.COMP_RESERVOIR_STATIONS, true); } } }
/// <summary> /// Tests to see if two diversion rights are equal. Strings are compared with case sensitivity. </summary> /// <param name="ac"> the ac to compare. </param> /// <returns> true if they are equal, false otherwise. </returns> public virtual bool Equals(StateMod_ReservoirAreaCap ac) { if (!base.Equals(ac)) { return(false); } if (_conten == ac._conten && _surarea == ac._surarea && _seepage == ac._seepage) { return(true); } return(false); }
/// <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_Reservoir_AreaCap_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_ReservoirAreaCap> wv = (java.util.List<StateMod_ReservoirAreaCap>)__worksheet.getAllData(); IList <StateMod_ReservoirAreaCap> wv = (IList <StateMod_ReservoirAreaCap>)__worksheet.getAllData(); // w for worksheet IList <StateMod_ReservoirAreaCap> rv = __currentRes.getAreaCaps(); needToSave = !(StateMod_ReservoirAreaCap.Equals(wv, rv)); 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); } // now add the elements from the new Vector to the reservoirRights // Vector. int size = wv.Count; IList <StateMod_ReservoirAreaCap> clone = new List <StateMod_ReservoirAreaCap>(); for (int i = 0; i < size; i++) { clone.Add((StateMod_ReservoirAreaCap)wv[i].clone()); } __currentRes.setAreaCaps(clone); __dataset.setDirty(StateMod_DataSet.COMP_DIVERSION_STATIONS, true); return(true); }
/// <summary> /// Sets the value at the specified position to the specified value. </summary> /// <param name="value"> the value to set the cell to. </param> /// <param name="row"> the row of the cell for which to set the value. </param> /// <param name="col"> the col of the cell for which to set the value. </param> public virtual void setValueAt(object value, int row, int col) { if (_sortOrder != null) { row = _sortOrder[row]; } double dval; StateMod_ReservoirAreaCap ra = (StateMod_ReservoirAreaCap)_data.get(row); // necessary for worksheets that display area capacities 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: ra.setCgoto((string)value); break; case COL_CAPACITY: dval = ((double?)value).Value; ra.setConten(dval); break; case COL_AREA: dval = ((double?)value).Value; ra.setSurarea(dval); break; case COL_SEEPAGE: dval = ((double?)value).Value; ra.setSeepage(dval); break; } if (!__singleReservoir) { col++; } base.setValueAt(value, row, col); }
/// <summary> /// Compares this object to another StateMod_Data object based on the sorted /// order from the StateMod_Data variables, and then by conten, surarea and seepage, in that order. </summary> /// <param name="data"> the object to compare against. </param> /// <returns> 0 if they are the same, 1 if this object is greater than the other /// object, or -1 if it is less. </returns> public virtual int CompareTo(StateMod_Data data) { int res = base.CompareTo(data); if (res != 0) { return(res); } StateMod_ReservoirAreaCap ac = (StateMod_ReservoirAreaCap)data; if (_conten < ac._conten) { return(-1); } else if (_conten > ac._conten) { return(1); } if (_surarea < ac._surarea) { return(-1); } else if (_surarea > ac._surarea) { return(1); } if (_seepage < ac._seepage) { return(-1); } else if (_seepage > ac._seepage) { return(1); } return(0); }
/// <summary> /// Constructor. </summary> /// <param name="data"> the data to display in the worksheet. Can be null or empty, in /// which case an empty worksheet is shown. </param> /// <param name="titleString"> the String to display as the GUI title. </param> /// <param name="editable"> whether the data in the JFrame can be edited or not. If true /// the data can be edited, if false they can not. </param> /// <exception cref="Exception"> if there is an error building the worksheet. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public StateMod_ReservoirAreaCap_Data_JFrame(java.util.List data, String titleString, boolean editable) throws Exception public StateMod_ReservoirAreaCap_Data_JFrame(System.Collections.IList data, string titleString, bool editable) : base() { int j = 0; int size = 0; int size2 = 0; StateMod_Reservoir r = null; StateMod_ReservoirAreaCap a = null; System.Collections.IList areacaps = null; System.Collections.IList v = new List <object>(); if (data != null) { size = data.Count; } for (int i = 0; i < size; i++) { r = (StateMod_Reservoir)data[i]; areacaps = r.getAreaCaps(); if (areacaps == null) { continue; } size2 = areacaps.Count; for (j = 0; j < size2; j++) { a = (StateMod_ReservoirAreaCap)areacaps[j]; a.setCgoto(r.getID()); v.Add(a); } } initialize(v, titleString, editable); setSize(400, getHeight()); }
/// <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_ReservoirAreaCap ra = (StateMod_ReservoirAreaCap)_data.get(row); // necessary for worksheets that display area capacities 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(ra.getCgoto()); case COL_CAPACITY: return(new double?(ra.getConten())); case COL_AREA: return(new double?(ra.getSurarea())); case COL_SEEPAGE: return(new double?(ra.getSeepage())); default: return(""); } }
/// <summary> /// Writes a list of StateMod_ReservoirAreaCap 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 at 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<StateMod_ReservoirAreaCap> data, java.util.List<String> newComments) throws Exception public static void writeListFile(string filename, string delimiter, bool update, IList <StateMod_ReservoirAreaCap> data, IList <string> newComments) { string routine = "StateMod_ReservoirAreaCap.writeListFile"; int size = 0; if (data != null) { size = data.Count; } IList <string> fields = new List <string>(); fields.Add("ReservoirID"); fields.Add("Content"); fields.Add("Area"); fields.Add("Seepage"); int fieldCount = fields.Count; string[] names = new string[fieldCount]; string[] formats = new string[fieldCount]; int comp = StateMod_Util.COMP_RESERVOIR_AREA_CAP; 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; PrintWriter @out = null; StateMod_ReservoirAreaCap area = null; string[] line = new string[fieldCount]; IList <string> commentIndicators = new List <string>(1); commentIndicators.Add("#"); IList <string> ignoredCommentIndicators = new List <string>(1); ignoredCommentIndicators.Add("#>"); StringBuilder buffer = new StringBuilder(); 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. IList <string> newComments2 = null; if (newComments == null) { newComments2 = new List <string>(); } else { newComments2 = new List <string>(newComments); } newComments2.Insert(0, ""); newComments2.Insert(1, "StateMod reservoir content/area/seepage data as a delimited list file."); newComments2.Insert(2, "See also the associated station, account, precipitation station,"); newComments2.Insert(3, "evaporation station, and collection files."); newComments2.Insert(4, ""); @out = IOUtil.processFileHeaders(oldFile, IOUtil.getPathUsingWorkingDir(filename), newComments2, commentIndicators, ignoredCommentIndicators, 0); for (int i = 0; i < fieldCount; i++) { if (i > 0) { buffer.Append(delimiter); } buffer.Append("\"" + names[i] + "\""); } @out.println(buffer.ToString()); for (int i = 0; i < size; i++) { area = (StateMod_ReservoirAreaCap)data[i]; line[0] = StringUtil.formatString(area.getCgoto(), formats[0]).Trim(); line[1] = StringUtil.formatString(area.getConten(), formats[1]).Trim(); line[2] = StringUtil.formatString(area.getSurarea(), formats[2]).Trim(); line[3] = StringUtil.formatString(area.getSeepage(), formats[3]).Trim(); buffer = new StringBuilder(); for (j = 0; j < fieldCount; j++) { if (j > 0) { buffer.Append(delimiter); } if (line[j].IndexOf(delimiter, StringComparison.Ordinal) > -1) { line[j] = "\"" + line[j] + "\""; } buffer.Append(line[j]); } @out.println(buffer.ToString()); } } catch (Exception e) { Message.printWarning(3, routine, e); throw e; } finally { if (@out != null) { @out.flush(); @out.close(); } } }
/// <summary> /// Check the GUI state. In particular, indicate whether the graph buttons should /// be enabled. /// </summary> private void checkGUIState() { IList <StateMod_ReservoirAreaCap> rv = __currentRes.getAreaCaps(); if ((rv != null) && (rv.Count > 0)) { bool area_ok = true, seepage_ok = true; // Check for data all one value... int size = rv.Count; StateMod_ReservoirAreaCap ac = null; double value; // REVISIT SAM 2006-08-20 // JFreeChart has a problem when the values are the same as // the previous values. However, for now, increment the values // slightly when graphing rather than disabling the graph. // Go ahead and disable if all values are the same. double area0 = 0.0, seepage0 = 0.0; bool area_all_same = true, seepage_all_same = true; for (int i = 0; i < size; i++) { ac = (StateMod_ReservoirAreaCap)rv[i]; value = ac.getSurarea(); /* * if ( value == value_prev ) { * area_ok = false; * break; * } */ if (i == 0) { area0 = value; } else { if (value != area0) { area_all_same = false; } } } for (int i = 0; i < size; i++) { ac = (StateMod_ReservoirAreaCap)rv[i]; value = ac.getSeepage(); /* * if ( value == value_prev ) { * seepage_ok = false; * break; * } */ if (i == 0) { seepage0 = value; } else { if (value != seepage0) { seepage_all_same = false; } } } if (area_all_same) { area_ok = false; } if (seepage_all_same) { seepage_ok = false; } JGUIUtil.setEnabled(__GraphArea_JButton, area_ok); JGUIUtil.setEnabled(__GraphSeepage_JButton, seepage_ok); } else { JGUIUtil.setEnabled(__GraphArea_JButton, false); JGUIUtil.setEnabled(__GraphSeepage_JButton, false); } // Only enable the graph buttons if the new charting package is in the // path. This will allow for some graceful transition to distribution // of the new software. if (!IOUtil.classCanBeLoaded("org.jfree.chart.ChartPanel")) { JGUIUtil.setEnabled(__GraphArea_JButton, false); JGUIUtil.setEnabled(__GraphSeepage_JButton, false); } }
/// <summary> /// Read reservoir information in and store in a Vector. </summary> /// <param name="filename"> Name of file to read. </param> /// <exception cref="Exception"> if there is an error reading the file. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static java.util.List<StateMod_Reservoir> readStateModFile(String filename) throws Exception public static IList <StateMod_Reservoir> readStateModFile(string filename) { string routine = "StateMod_Reservoir.readStateModFile"; IList <StateMod_Reservoir> theReservoirs = new List <StateMod_Reservoir>(); string iline = null; IList <object> v = new List <object>(9); int[] format_0 = new int[] { StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_INTEGER, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING }; int[] format_0w = new int[] { 12, 24, 12, 8, 8, 1, 12 }; int[] format_1 = new int[] { StringUtil.TYPE_SPACE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_INTEGER, StringUtil.TYPE_INTEGER, StringUtil.TYPE_INTEGER, StringUtil.TYPE_INTEGER }; int[] format_1w = new int[] { 24, 8, 8, 8, 8, 8, 8, 8, 8 }; int[] format_2 = new int[] { StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_INTEGER }; int[] format_2w = new int[] { 12, 12, 8, 8, 8, 8 }; int[] format_3 = new int[] { StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_DOUBLE }; int[] format_3w = new int[] { 24, 12, 8 }; int[] format_4 = new int[] { StringUtil.TYPE_SPACE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_DOUBLE }; int[] format_4w = new int[] { 24, 8, 8, 8 }; StreamReader @in = null; StateMod_Reservoir aReservoir = null; StateMod_ReservoirAccount anAccount = null; StateMod_ReservoirClimate anEvap = null; StateMod_ReservoirClimate aPtpx = null; int i = 0; if (Message.isDebugOn) { Message.printDebug(10, routine, "in SMParseResFile reading file: " + filename); } int line_count = 0; try { @in = new StreamReader(IOUtil.getPathUsingWorkingDir(filename)); while (!string.ReferenceEquals((iline = @in.ReadLine()), null)) { ++line_count; // check for comments if (iline.StartsWith("#", StringComparison.Ordinal) || iline.Trim().Length == 0) { continue; } // allocate new reservoir node aReservoir = new StateMod_Reservoir(); // line 1 if (Message.isDebugOn) { Message.printDebug(50, routine, "line 1: " + iline); } StringUtil.fixedRead(iline, format_0, format_0w, v); aReservoir.setID(((string)v[0]).Trim()); aReservoir.setName(((string)v[1]).Trim()); aReservoir.setCgoto(((string)v[2]).Trim()); aReservoir.setSwitch((int?)v[3]); aReservoir.setRdate((double?)v[4]); aReservoir.setCresdy(((string)v[5]).Trim()); // line 2 iline = @in.ReadLine(); ++line_count; if (Message.isDebugOn) { Message.printDebug(50, routine, "line 2: " + iline); } StringUtil.fixedRead(iline, format_1, format_1w, v); aReservoir.setVolmin(((double?)v[0])); aReservoir.setVolmax(((double?)v[1])); aReservoir.setFlomax(((double?)v[2])); aReservoir.setDeadst(((double?)v[3])); int nowner = ((int?)v[4]).Value; int nevap = ((int?)v[5]).Value; int nptpx = ((int?)v[6]).Value; int nrange = ((int?)v[7]).Value; // get the owner's information if (Message.isDebugOn) { Message.printDebug(50, routine, "Number of owners: " + nowner); } for (i = 0; i < nowner; i++) { iline = @in.ReadLine(); ++line_count; StringUtil.fixedRead(iline, format_2, format_2w, v); anAccount = new StateMod_ReservoirAccount(); // Account ID is set to the numerical count (StateMod uses the number) anAccount.setID("" + (i + 1)); anAccount.setName(((string)v[0]).Trim()); anAccount.setOwnmax(((double?)v[1])); anAccount.setCurown(((double?)v[2])); anAccount.setPcteva(((double?)v[3])); anAccount.setN2own(((int?)v[4])); aReservoir.addAccount(anAccount); } // get the evaporation information for (i = 0; i < nevap; i++) { iline = @in.ReadLine(); ++line_count; StringUtil.fixedRead(iline, format_3, format_3w, v); anEvap = new StateMod_ReservoirClimate(); anEvap.setID(((string)v[0]).Trim()); anEvap.setType(StateMod_ReservoirClimate.CLIMATE_EVAP); anEvap.setWeight(((double?)v[1])); aReservoir.addClimate(anEvap); } // get the precipitation information for (i = 0; i < nptpx; i++) { iline = @in.ReadLine(); ++line_count; StringUtil.fixedRead(iline, format_3, format_3w, v); aPtpx = new StateMod_ReservoirClimate(); aPtpx.setID(((string)v[0]).Trim()); aPtpx.setType(StateMod_ReservoirClimate.CLIMATE_PTPX); aPtpx.setWeight(((double?)v[1])); aReservoir.addClimate(aPtpx); } // get the area capacity information for (i = 0; i < nrange; i++) { iline = @in.ReadLine(); ++line_count; StringUtil.fixedRead(iline, format_4, format_4w, v); StateMod_ReservoirAreaCap anAreaCap = new StateMod_ReservoirAreaCap(); anAreaCap.setConten(((double?)v[0])); anAreaCap.setSurarea(((double?)v[1])); anAreaCap.setSeepage(((double?)v[2])); aReservoir.addAreaCap(anAreaCap); } // add the reservoir to the vector of reservoirs theReservoirs.Add(aReservoir); } } catch (Exception e) { Message.printWarning(3, routine, "Error reading reservoir stations in line " + line_count); throw e; } finally { if (@in != null) { @in.Close(); } } return(theReservoirs); }
/// <summary> /// Create a dataset to display in the chart. Extract the values from the /// StateMod_Reservoir curve data. /// </summary> private DefaultTableXYDataset createDataset() { string routine = "StateMod_Reservoir_AreaCap_Graph_JFrame.createDataSet"; DefaultTableXYDataset dataset = new DefaultTableXYDataset(); IList <StateMod_ReservoirAreaCap> v = __res.getAreaCaps(); int size = 0; if (v != null) { size = v.Count; } XYSeries series = new XYSeries("Reservoir " + __res.getID() + " (" + __res.getName() + ") Content/" + __type + " Curve", false, false); StateMod_ReservoirAreaCap ac = null; // Speed up checks in loop... bool do_area = true; if (__type.Equals("Seepage", StringComparison.OrdinalIgnoreCase)) { do_area = false; } double value_prev = -10000000.0, value = 0.0, value2 = 0.0; double content = 0.0; int match_count = 0; for (int i = 0; i < size; i++) { ac = (StateMod_ReservoirAreaCap)v[i]; // Curves will often have a very large content to protect // against out of bounds for interpolation. However, if this // point is graphed, it causes the other values to appear // miniscule. Therefore, omit the last point if it is much // larger than the previous value. if ((size > 4) && (i == (size - 1)) && ac.getConten() > 9000000.0) { Message.printStatus(2, routine, "Skipping last point. Seems to be very large bounding" + " value and might skew the graph."); continue; } // Add X first, then Y... if (do_area) { value = ac.getSurarea(); } else { value = ac.getSeepage(); } if (value == value_prev) { // This is needed because JFreeChart will not allow // adjacent X values to be the same. ++match_count; value2 = value + match_count * .00001; } else { value2 = value; } content = ac.getConten(); // REVISIT SAM 2006-08-20 // Not sure if content needs to be checked the same way for // duplicates. Message.printStatus(2, routine, "X=" + value2 + " y=" + content); series.add(value2, content); value_prev = value; } dataset.addSeries(series); return(dataset); }