/** * Adds a integer 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 integer Profile. */ public void addValue(StateVarKey <int> key, HSFProfile <int> profIn) { HSFProfile <int> valueOut; if (!Idata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Idata.Add(key, profIn); } else // Otherwise, add this data point to the existing Profile. { valueOut.Add(profIn); } }
/** * Adds a integer 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. */ void addValue(StateVarKey <int> key, KeyValuePair <double, int> pairIn) { HSFProfile <int> valueIn = new HSFProfile <int>(pairIn); HSFProfile <int> valueOut; if (!Idata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Idata.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 integer 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 integer state variable key that is being set.\ * @param profIn The integer Profile being saved. */ public void setProfile(StateVarKey <int> key, HSFProfile <int> profIn) { HSFProfile <int> valueOut; if (!Idata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Idata.Add(key, profIn); } else // Otherwise, erase whatever is there, and insert a new one. { Idata.Remove(key); Idata.Add(key, profIn); } }