public static int ObjectIndex <T>(this List <T> p_list, T p_object) { for (int i = 0; i < p_list.Count; i++) { if (AOTHelper.Equals(p_list[i], p_object)) { return(i); } } return(-1); }
public int ObjectIndex(T p_object) { for (int i = 0; i < this.Count; i++) { if (AOTHelper.Equals(this[i], p_object)) { return(i); } } return(-1); }
public bool ContainsValue(TValue p_value) { foreach (TAOTPair v_pairValue in this) { try { if (AOTHelper.Equals(v_pairValue.Value, p_value)) { return(true); } } catch { } } return(false); }
public TAOTPair GetPairByValue(TValue p_value) { foreach (TAOTPair v_pairValues in this) { try { if (AOTHelper.Equals(v_pairValues.Value, p_value)) { return(v_pairValues); } } catch { } } return(default(TAOTPair)); }
public bool ContainsKey(TKey p_key) { foreach (TAOTPair v_pairValue in this) { try { if (AOTHelper.Equals(v_pairValue.Key, p_key)) { return(true); } } catch { } } return(false); }
public TAOTPair GetPairByKey(TKey p_key) { foreach (TAOTPair v_pairValues in this) { try { if (AOTHelper.Equals(v_pairValues.Key, p_key)) { //if(p_key.Equals(v_pairValues.Comparer)) return(v_pairValues); } } catch { } } return(default(TAOTPair)); }
public TKey GetKeyByValue(TValue p_value) { foreach (TAOTPair v_pairValues in this) { try { if (AOTHelper.Equals(v_pairValues.Value, p_value)) { //if(p_value.Equals(v_pairValues.Object)) return(v_pairValues.Key); } } catch { } } return(default(TKey)); }
public bool RemoveByKey(TKey p_key) { TAOTPair v_removePair = default(TAOTPair); foreach (TAOTPair v_pairValue in this) { try { if (AOTHelper.Equals(v_pairValue.Key, p_key)) { v_removePair = v_pairValue; break; } } catch { } } return(this.RemoveChecking(v_removePair)); }
public bool RemoveChecking(TValue p_value) { TAOTPair v_removePair = default(TAOTPair); foreach (TAOTPair v_pairValue in this) { try { if (AOTHelper.Equals(v_pairValue.Value, p_value)) { v_removePair = v_pairValue; break; } } catch { } } return(this.RemoveChecking(v_removePair)); }
public AOTList <TValue> GetAllValueByKey(TKey p_key) { AOTList <TValue> v_values = new AOTList <TValue> (); foreach (TAOTPair v_pairValues in this) { try { if (AOTHelper.Equals(v_pairValues.Key, p_key)) { //if(p_key.Equals(v_pairValues.Comparer)) v_values.Add(v_pairValues.Value); } } catch { } } return(v_values); }
public bool RemoveChecking(T p_object, bool p_removeNulls = true) { bool v_sucess = false; if (!AOTHelper.IsNull(p_object)) { if (p_removeNulls) { RemoveNulls(); } AOTList <T> v_newList = new AOTList <T>(); for (int i = 0; i < this.Count; i++) { try { T v_object = this[i]; if (!AOTHelper.Equals(p_object, v_object)) { v_newList.Add(v_object); } else { v_sucess = true; } } catch { UnityEngine.Debug.Log("An error occurred when trying to RemoveChecking"); v_sucess = true; } } this.Clear(); foreach (T v_object in v_newList) { this.AddWithoutCallEvents(v_object); } } if (v_sucess) { OnRemove(p_object); } return(v_sucess); }
public void AddChecking(TKey p_key, TValue p_value) { bool v_found = false; foreach (TAOTPair v_pair in this) { try { if (AOTHelper.Equals(v_pair.Value, p_value) && AOTHelper.Equals(v_pair.Key, p_key)) { v_found = true; break; } } catch { } } if (!v_found) { Add(p_key, p_value); } }
public static bool RemoveChecking <T>(this List <T> p_list, T p_object, bool p_removeNulls = true) { bool v_sucess = false; if (p_list != null && !AOTHelper.IsNull(p_object)) { List <T> v_newList = new List <T>(); for (int i = 0; i < p_list.Count; i++) { try { T v_object = p_list[i]; if (!p_removeNulls || !AOTHelper.IsNull(v_object)) { if (!AOTHelper.Equals(p_object, v_object)) { v_newList.Add(v_object); } else { v_sucess = true; } } } catch { UnityEngine.Debug.Log("An error occurred when trying to RemoveChecking"); v_sucess = true; } } p_list.Clear(); foreach (T v_object in v_newList) { p_list.Add(v_object); } } return(v_sucess); }
public void AddReplacing(TKey p_key, TValue p_value) { bool v_found = false; for (int i = 0; i < this.Count; i++) { try { if (AOTHelper.Equals(this [i].Key, p_key)) { v_found = true; TAOTPair v_pair = new TAOTPair(); v_pair.Value = p_value; v_pair.Key = p_key; this [i] = v_pair; break; } } catch { } } if (!v_found) { Add(p_key, p_value); } }