/** * Adds a double Profile to the state with the given key. If no Profile exists, a new Profile is created * with the corresponding key. If a Profile exists with that key, the Profile is appended onto the end of the Profile. * @param key The key corresponding to the state variable. * @param profIn The Profile to be added to the double Profile. */ public void addValue(StateVarKey <double> key, HSFProfile <double> profIn) { HSFProfile <double> valueOut; if (!Ddata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Ddata.Add(key, profIn); } else // Otherwise, add this data point to the existing Profile. { valueOut.Add(profIn); } }
/** * Adds a double Profile value pair to the state with the given key. If no Profile exists, a new Profile is created * with the corresponding key. If a Profile exists with that key, the pair is appended onto the end of the Profile. * Ensure that the Profile is still time ordered if this is the case. * @param key The key corresponding to the state variable. * @param pairIn The pair to be added to the integer Profile. */ public void addValue(StateVarKey <double> key, KeyValuePair <double, double> pairIn) { HSFProfile <double> valueIn = new HSFProfile <double>(pairIn); HSFProfile <double> valueOut; if (!Ddata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Ddata.Add(key, valueIn); } else // Otherwise, add this data point to the existing Profile. { valueOut.Add(pairIn); //TODO: make sure this is ok. was formally iterator.second.data } }
/** * Sets the double Profile in the state with its matching key. If a Profile is found already under * that key, this will overwrite the old Profile. * @param key The double state variable key that is being set.\ * @param profIn The double Profile being saved. */ public void setProfile(StateVarKey <double> key, HSFProfile <double> profIn) { HSFProfile <double> valueOut; if (!Ddata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Ddata.Add(key, profIn); } else // Otherwise, erase whatever is there, and insert a new one. { Ddata.Remove(key); Ddata.Add(key, profIn); } }