/// <summary> /// From AbstractTableMode. 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]; } object o = (object)_data.get(row); if (o is TS) { TS ts = (TS)o; switch (col) { case COL_ID: return(ts.getIdentifier().ToString()); case COL_NAME: return(ts.getDescription()); default: return(""); } } else if ((__component.getComponentType() == StateMod_DataSet.COMP_IRRIGATION_PRACTICE_TS_YEARLY) || (__component.getComponentType() == StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_MONTHLY) || (__component.getComponentType() == StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_DAILY) || (__component.getComponentType() == StateMod_DataSet.COMP_STATECU_STRUCTURE)) { // StateCU_Data... StateCU_Data data = (StateCU_Data)_data.get(row); switch (col) { case COL_ID: return(data.getID()); case COL_NAME: return(data.getName()); default: return(""); } } else { // StateMod_Data... StateMod_Data data = (StateMod_Data)_data.get(row); switch (col) { case COL_ID: return(data.getID()); case COL_NAME: return(data.getName()); default: return(""); } } }
/// <summary> /// Returns the appropriate ID Vector for the given structure type. </summary> /// <param name="type"> the structure type for which to return the ID Vector. </param> /// <returns> the ID Vector for the structure type. </returns> private System.Collections.IList getTypeIDVector(string type) { int size = __riverNetwork.Count; StateMod_Data node = null; string name = null; System.Collections.IList v = new List <object>(); // loops through to (num - 1) because the last element of the network Vector is "END" for (int i = 0; i < size; i++) { node = (StateMod_Data)__riverNetwork[i]; name = node.getName(); if (type.Equals(__OTHtype) || name.EndsWith(type, StringComparison.Ordinal)) { v.Add(node); } } return(v); }
/// <summary> /// Find the position of a StateMod_Data object in the data Vector, using the /// identifier. The position for the first match is returned. </summary> /// <returns> the position, or -1 if not found. </returns> /// <param name="id"> StateMod_Data identifier. </param> public static int indexOf(System.Collections.IList data, string id) { int size = 0; if (string.ReferenceEquals(id, null)) { return(-1); } if (data != null) { size = data.Count; } StateMod_Data d = null; for (int i = 0; i < size; i++) { d = (StateMod_Data)data[i]; if (id.Equals(d._id, StringComparison.OrdinalIgnoreCase)) { return(i); } } return(-1); }