/// <summary> /// Clones the data object. </summary> /// <returns> a cloned object. </returns> public override object clone() { StateCU_Supply supply = (StateCU_Supply)base.clone(); supply._isClone = true; return(supply); }
/// <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() { StateCU_Supply supply = (StateCU_Supply)_original; base.restoreOriginal(); __amount = supply.__amount; __is_ground = supply.__is_ground; __is_surface = supply.__is_surface; _isClone = false; _original = null; }
// TODO SAM 2007-05-15 // Not sure if something like this is needed. /// <summary> /// Compare two rights Vectors and see if they are the same. </summary> /// <param name="v1"> the first Vector of StateMod_ReservoirAreaCap s to check. Can not /// be null. </param> /// <param name="v2"> the second Vector of StateMod_ReservoirAreaCap s to check. Can not /// be null. </param> /// <returns> true if they are the same, false if not. </returns> /* * public static boolean equals(Vector v1, Vector v2) { * String routine = "StateMod_ReservoirAreaCap.equals(Vector, Vector)"; * StateMod_ReservoirAreaCap r1; * StateMod_ReservoirAreaCap r2; * if (v1.size() != v2.size()) { * Message.printStatus(1, routine, "Vectors are different sizes"); * return false; * } * else { * // sort the Vectors and compare item-by-item. Any differences * // and data will need to be saved back into the dataset. * int size = v1.size(); * Message.printStatus(1, routine, "Vectors are of size: " + size); * Vector v1Sort = StateMod_Util.sortStateMod_DataVector(v1); * Vector v2Sort = StateMod_Util.sortStateMod_DataVector(v2); * Message.printStatus(1, routine, "Vectors have been sorted"); * * for (int i = 0; i < size; i++) { * r1 = (StateMod_ReservoirAreaCap)v1Sort.elementAt(i); * r2 = (StateMod_ReservoirAreaCap)v2Sort.elementAt(i); * Message.printStatus(1, routine, r1.toString()); * Message.printStatus(1, routine, r2.toString()); * Message.printStatus(1, routine, "Element " + i + " comparison: " + r1.compareTo(r2)); + if (r1.compareTo(r2) != 0) { + return false; + } + } + } + return true; + } */ /// <summary> /// Tests to see if two parcels equal. Strings are compared with case sensitivity. </summary> /// <param name="supply"> The supply instance to compare. </param> /// <returns> true if they are equal, false otherwise. </returns> public virtual bool Equals(StateCU_Supply supply) { if (!base.Equals(supply)) { return(false); } if ((__amount == supply.__amount) && (__is_ground == supply.__is_ground) && (__is_surface == supply.__is_surface)) { return(true); } return(false); }
/// <summary> /// Indicate whether the parcel has groundwater supply. This will be true if /// any of the StateCU_Supply associated with the parcel return isGroundWater as true. /// </summary> public virtual bool hasGroundWaterSupply() { int size = __supply_List.Count; StateCU_Supply supply = null; for (int i = 0; i < size; i++) { supply = (StateCU_Supply)__supply_List[i]; if (supply.isGroundWater()) { return(true); } } return(false); }
/// <summary> /// Compares this object to another StateCU_Supply object based on the sorted /// order from the StateCU_Data variables, and then by amount. </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(StateCU_Data data) { int res = base.CompareTo(data); if (res != 0) { return(res); } StateCU_Supply supply = (StateCU_Supply)data; if (__amount < supply.__amount) { return(-1); } else if (__amount > supply.__amount) { return(1); } return(0); }
/// <summary> /// Add a supply object. /// </summary> public virtual void addSupply(StateCU_Supply supply) { __supply_List.Add(supply); }