Пример #1
0
 public void UnmergeList(AOTList <T> p_otherList)
 {
     if (p_otherList != null)
     {
         AOTList <T> v_dummyList = new AOTList <T>();
         this.RemoveNulls();
         for (int i = 0; i < this.Count; i++)
         {
             T v_object = this[i];
             if (!p_otherList.Contains(v_object))
             {
                 v_dummyList.Add(v_object);
             }
             else
             {
                 OnRemove(v_object);
             }
         }
         this.Clear();
         for (int i = 0; i < v_dummyList.Count; i++)
         {
             try
             {
                 T v_object = v_dummyList[i];
                 this.AddWithoutCallEvents(v_object);
             }
             catch
             {
                 UnityEngine.Debug.Log("An error occurred when trying to UnmergeList");
             }
         }
     }
 }
Пример #2
0
    public AOTList <T> CloneList()
    {
        AOTList <T> v_clonedList = new AOTList <T>();

        foreach (T v_object in this)
        {
            v_clonedList.Add(v_object);
        }
        return(v_clonedList);
    }
Пример #3
0
    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);
    }
Пример #4
0
    public void RemoveNulls()
    {
        AOTList <T> v_newList = new AOTList <T>();

        for (int i = 0; i < this.Count; i++)
        {
            T v_object = this[i];
            if (!AOTHelper.IsNull(v_object))
            {
                v_newList.Add(v_object);
            }
        }
        this.Clear();
        foreach (T v_object in v_newList)
        {
            this.AddWithoutCallEvents(v_object);
        }
    }
Пример #5
0
    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);
    }
Пример #6
0
    public AOTList <string> GetStringList()
    {
        AOTList <string> v_stringList = new AOTList <string>();

        for (int i = 0; i < Count; i++)
        {
            object v_object   = this[i];
            string v_toString = "null";
            try
            {
                v_toString = v_object.ToString();
            }
            catch {
                v_toString = "null";
            }
            v_stringList.Add(v_toString);
        }
        return(v_stringList);
    }
Пример #7
0
    public void RemovePairsWithNullKeys()
    {
        AOTList <TAOTPair> v_newList = new AOTList <TAOTPair> ();

        foreach (TAOTPair v_pairValue in this)
        {
            try {
                if (!AOTHelper.IsNull(v_pairValue.Key))
                {
                    v_newList.Add(v_pairValue);
                }
            } catch {
            }
        }
        this.Clear();
        foreach (TAOTPair v_pairValue in v_newList)
        {
            this.AddWithoutCallEvents(v_pairValue);
        }
    }