コード例 #1
0
        public void CopyToTest()
        {
            var set   = new IndexedSet <string>();
            var array = new string[2];

            Assert.IsEmpty(set);
            Assert.That(array, Is.All.Null);

            set.CopyTo(array, 0);

            Assert.IsEmpty(set);
            Assert.That(array, Is.All.Null);

            set.Add("A");
            set.Add("B");
            set.CopyTo(array, 0);

            Assert.That(set.Count, Is.EqualTo(2));
            Assert.That(set, Contains.Item("A").And.Contains("B"));
            Assert.That(array.Length, Is.EqualTo(2));
            Assert.That(array, Is.All.Not.Null);
            Assert.That(array, Contains.Item("A").And.Contains("B"));
            Assert.That(array[0], Is.EqualTo("A"));
            Assert.That(array[1], Is.EqualTo("B"));
        }
コード例 #2
0
 private void IndexedSetAdd()
 {
     for (int i = 0; i < count; i++)
     {
         indexedSet.Add(i);
     }
 }
コード例 #3
0
ファイル: Q007T.cs プロジェクト: sakapon/AtCoder-Contests
    static object Solve()
    {
        var n  = int.Parse(Console.ReadLine());
        var a  = Read();
        var qc = int.Parse(Console.ReadLine());
        var qs = Array.ConvertAll(new bool[qc], _ => int.Parse(Console.ReadLine()));

        var set = new IndexedSet <int>();

        foreach (var v in a)
        {
            set.Add(v);
        }
        set.Add(-1 << 30);
        set.Add(int.MaxValue);

        return(string.Join("\n", qs.Select(GetMin)));

        int GetMin(int bv)
        {
            var an2 = set.Root.SearchFirstNode(x => x >= bv);
            var an1 = an2.SearchPreviousNode();

            return(Math.Min(an2.Item - bv, bv - an1.Item));
        }
    }
コード例 #4
0
        public void AddTest()
        {
            var set = new IndexedSet <string>();

            Assert.True(set.Add("A"));
            Assert.Contains("A", set);

            Assert.False(set.Add("A"));
            Assert.Contains("A", set);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: m-khooryani/MCollections
        private static void Test2()
        {
            Random           rand    = new Random(0);
            int              size    = 20000;
            IndexedSet <int> set     = new IndexedSet <int>();
            HashSet <int>    hashSet = new HashSet <int>();
            List <int>       list    = new List <int>();

            while (true)
            {
                set.Clear();
                hashSet.Clear();
                int n = rand.Next(100);
                for (int i = 0; i < n; i++)
                {
                    int item = rand.Next(100);
                    hashSet.Add(item);
                    set.Add(item);
                }
                n = rand.Next(100);
                for (int i = 0; i < n; i++)
                {
                    list.Add(rand.Next(100));
                }
                try
                {
                    hashSet.SymmetricExceptWith(list);
                    set.SymmetricExceptWith(list);
                    //Assert.Equal(set.Count, hashSet.Count);
                }
                catch (Exception ex)
                {
                }
            }
        }
コード例 #6
0
        public void Test1()
        {
            Random           rand    = new Random(0);
            int              size    = 20000;
            IndexedSet <int> set     = new IndexedSet <int>();
            HashSet <int>    hashSet = new HashSet <int>();
            List <int>       list    = new List <int>();

            while (size-- > 0)
            {
                Debug.WriteLine(size);
                set.Clear();
                hashSet.Clear();
                list.Clear();
                int n = rand.Next(100);
                for (int i = 0; i < n; i++)
                {
                    int item = rand.Next(100);
                    hashSet.Add(item);
                    set.Add(item);
                }
                n = rand.Next(100);
                for (int i = 0; i < n; i++)
                {
                    list.Add(rand.Next(100));
                }
                hashSet.SymmetricExceptWith(list);
                set.SymmetricExceptWith(list);
                Assert.Equal(set.Count, hashSet.Count);
            }
        }
コード例 #7
0
        public void ExceptWithTest()
        {
            var firstSet  = new IndexedSet <string>();
            var secondSet = new IndexedSet <string>();

            firstSet.Add("A");

            secondSet.Add("A");
            secondSet.Add("B");

            secondSet.ExceptWith(firstSet);

            Assert.That(secondSet.Count, Is.EqualTo(1));
            Assert.False(secondSet.Contains("A"));
            Assert.True(secondSet.Contains("B"));
        }
コード例 #8
0
        /// <summary>
        /// Associates a Graphic with a Canvas and stores this association in the registry.
        /// </summary>
        /// <param name="c">The canvas being associated with the Graphic.</param>
        /// <param name="graphic">The Graphic being associated with the Canvas.</param>
        public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
        {
            if (c == null || graphic == null)
            {
                return;
            }

            IndexedSet <Graphic> graphics;

            instance.m_Graphics.TryGetValue(c, out graphics);

            if (graphics != null)
            {
                graphics.AddUnique(graphic);

                RegisterRaycastGraphicForCanvas(c, graphic);

                return;
            }

            // Dont need to AddUnique as we know its the only item in the list
            graphics = new IndexedSet <Graphic>();
            graphics.Add(graphic);
            instance.m_Graphics.Add(c, graphics);

            RegisterRaycastGraphicForCanvas(c, graphic);
        }
コード例 #9
0
        public void UnionWithTest()
        {
            var firstSet  = new IndexedSet <string>();
            var secondSet = new IndexedSet <string>();

            firstSet.UnionWith(secondSet);

            Assert.IsEmpty(firstSet);
            Assert.IsEmpty(secondSet);

            firstSet.Add("A");
            firstSet.UnionWith(secondSet);

            Assert.That(firstSet.Count, Is.EqualTo(1));
            Assert.That(firstSet[0], Is.EqualTo("A"));

            Assert.IsEmpty(secondSet);

            secondSet.Add("A");

            firstSet.UnionWith(secondSet);

            Assert.That(firstSet.Count, Is.EqualTo(1));
            Assert.That(firstSet[0], Is.EqualTo("A"));

            Assert.That(secondSet.Count, Is.EqualTo(1));
            Assert.That(secondSet[0], Is.EqualTo("A"));

            secondSet.Add("B");

            Assert.That(firstSet.Count, Is.EqualTo(1));
            Assert.That(firstSet[0], Is.EqualTo("A"));

            Assert.That(secondSet.Count, Is.EqualTo(2));
            Assert.That(secondSet[0], Is.EqualTo("A"));
            Assert.That(secondSet[1], Is.EqualTo("B"));

            firstSet.UnionWith(secondSet);

            Assert.That(firstSet.Count, Is.EqualTo(2));
            Assert.That(firstSet[0], Is.EqualTo("A"));
            Assert.That(firstSet[1], Is.EqualTo("B"));

            Assert.That(secondSet.Count, Is.EqualTo(2));
            Assert.That(secondSet[0], Is.EqualTo("A"));
            Assert.That(secondSet[1], Is.EqualTo("B"));
        }
コード例 #10
0
 private bool InternalRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
     if (m_LayoutRebuildQueue.Contains(element))
     {
         return(false);
     }
     m_LayoutRebuildQueue.Add(element);
     return(true);
 }
コード例 #11
0
 private void InternalRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
 {
     if (m_PerformingGraphicUpdate)
     {
         Debug.LogError(string.Format("Trying to add {0} for graphic rebuild while we are already inside a graphic rebuild loop. This is not supported.", element));
         return;
     }
     m_GraphicRebuildQueue.Add(element);
 }
コード例 #12
0
        public void RemoveTest()
        {
            var set = new IndexedSet <string>();

            Assert.False(set.Remove("A"));

            set.Add("A");

            Assert.True(set.Remove("A"));
            Assert.Zero(set.Count);
            Assert.False(set.Contains("A"));
        }
コード例 #13
0
        public void SimpleIndexedSetTest()
        {
            const double FirstElement  = 17;
            const double SecondElement = Math.PI;
            const double ThirdElement  = 6.23123438874;
            const double FourthElement = 43;

            var indexedSet = new IndexedSet <double>(new[] { FirstElement, SecondElement });

            Assert.Equal(2, indexedSet.Count);
            Assert.True(indexedSet.Contains(FirstElement));
            var elements = indexedSet.Elements.ToArray();

            Assert.Equal(SecondElement, elements[1]);
            Assert.Equal(SecondElement, indexedSet.GetElementByIndex(1));

            int secondElementIndex;

            Assert.True(indexedSet.TryGetIndex(Math.PI, out secondElementIndex));
            Assert.Equal(1, secondElementIndex);

            indexedSet.Add(ThirdElement);
            Assert.Equal(3, indexedSet.Count);
            Assert.True(indexedSet.Contains(ThirdElement));

            int fourthElementIndex;

            Assert.Throws <ArgumentException>(() => indexedSet.Add(ThirdElement));
            Assert.Throws <ArgumentOutOfRangeException>(() => indexedSet.GetElementByIndex(3));
            Assert.False(indexedSet.TryGetIndex(FourthElement, out fourthElementIndex));

            indexedSet.Add(ThirdElement, false);
            indexedSet.Add(FourthElement);
            Assert.Equal(FourthElement, indexedSet.GetElementByIndex(3));

            indexedSet.Clear();
            Assert.Equal(0, indexedSet.Count);

            Assert.Throws <ArgumentException>(() => new IndexedSet <double>(new[] { FirstElement, SecondElement, SecondElement }));
        }
コード例 #14
0
        public void IndexOfTest()
        {
            var set = new IndexedSet <string>();

            Assert.That(set.IndexOf(null), Is.EqualTo(-1));
            Assert.That(set.IndexOf("A"), Is.EqualTo(-1));

            set.Add("A");
            Assert.Zero(set.IndexOf("A"));

            set[0] = "B";
            Assert.Zero(set.IndexOf("B"));
        }
コード例 #15
0
        public void ClearTest()
        {
            var set = new IndexedSet <string>();

            set.Clear();
            Assert.Zero(set.Count);

            Assert.True(set.Add("A"));
            Assert.That(set.Count, Is.EqualTo(1));

            set.Clear();
            Assert.Zero(set.Count);
        }
コード例 #16
0
        public void CountTest()
        {
            var set = new IndexedSet <int>();

            Assert.Zero(set.Count);

            for (var i = 0; i < 10; i++)
            {
                Assert.That(set.Count, Is.EqualTo(i));
                set.Add(i);
                Assert.That(set.Count, Is.EqualTo(i + 1));
            }
        }
コード例 #17
0
        public void SetEqualsTest()
        {
            var firstSet  = new IndexedSet <string>();
            var secondSet = new IndexedSet <string>();

            Assert.True(firstSet.SetEquals(secondSet));
            Assert.True(secondSet.SetEquals(firstSet));

            firstSet.Add("A");

            Assert.False(firstSet.SetEquals(secondSet));
            Assert.False(secondSet.SetEquals(firstSet));

            secondSet.Add("A");

            Assert.True(firstSet.SetEquals(secondSet));
            Assert.True(secondSet.SetEquals(firstSet));

            firstSet.Add("B");

            Assert.False(firstSet.SetEquals(secondSet));
            Assert.False(secondSet.SetEquals(firstSet));
        }
コード例 #18
0
 private bool InternalRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
 {
     if (m_PerformingGraphicUpdate)
     {
         Debug.LogError($"Trying to add {element} for graphic rebuild while we are already inside a graphic rebuild loop. This is not supported.");
         return(false);
     }
     if (m_GraphicRebuildQueue.Contains(element))
     {
         return(false);
     }
     m_GraphicRebuildQueue.Add(element);
     return(true);
 }
コード例 #19
0
        public void IsSupersetOfTest()
        {
            var firstSet  = new IndexedSet <string>();
            var secondSet = new IndexedSet <string>();

            Assert.True(firstSet.IsSupersetOf(secondSet));
            Assert.True(secondSet.IsSupersetOf(firstSet));

            firstSet.Add("A");

            Assert.True(firstSet.IsSupersetOf(secondSet));
            Assert.False(secondSet.IsSupersetOf(firstSet));

            secondSet.Add("A");

            Assert.True(firstSet.IsSupersetOf(secondSet));
            Assert.True(secondSet.IsSupersetOf(firstSet));

            firstSet.Add("B");

            Assert.True(firstSet.IsSupersetOf(secondSet));
            Assert.False(secondSet.IsSupersetOf(firstSet));
        }
コード例 #20
0
        public void IndexTest()
        {
            var set = new IndexedSet <string>();

            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                var _ = set[0];
            });

            set.Add("A");
            Assert.IsNotEmpty(set);
            Assert.That(set.Count, Is.EqualTo(1));
            Assert.That(set[0], Is.EqualTo("A"));
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: m-khooryani/MCollections
        static void Main(string[] args)
        {
            ParallelTest();
            //Test2();
            //Benchmark();

            IndexedSet <string> set = new IndexedSet <string>();

            set.Add("two");
            set.Add("one");
            set.Add("zero");
            string first = set[0];

            //sd.Add(1, "1");
            //sd.Add(2, "2");
            //foreach (var item in sd.Keys)
            //{

            //}
            //IndexedDictionary<int, string> dictionary = new IndexedDictionary<int, string>();
            //dictionary.Add(1, "5");
            //dictionary.Add(5, "1");

            //IDictionary d = dictionary;
            //foreach (DictionaryEntry item in d)
            //{

            //}
            //foreach (DictionaryEntry item in d)
            //{

            //}
            //foreach (var item in dictionary.Values)
            //{

            //}
        }
コード例 #22
0
 public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
 {
     if (!(c == null))
     {
         instance.m_Graphics.TryGetValue(c, out IndexedSet <Graphic> value);
         if (value != null)
         {
             value.Add(graphic);
             return;
         }
         value = new IndexedSet <Graphic>();
         value.Add(graphic);
         instance.m_Graphics.Add(c, value);
     }
 }
コード例 #23
0
 /// <summary>
 /// 
 /// <para>
 /// Store a link between the given canvas and graphic in the registry.
 /// </para>
 /// 
 /// </summary>
 /// <param name="c">Canvas to register.</param><param name="graphic">Graphic to register.</param>
 public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
 {
   if ((Object) c == (Object) null)
     return;
   IndexedSet<Graphic> indexedSet;
   GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet);
   if (indexedSet != null)
   {
     indexedSet.AddUnique(graphic);
   }
   else
   {
     indexedSet = new IndexedSet<Graphic>();
     indexedSet.Add(graphic);
     GraphicRegistry.instance.m_Graphics.Add(c, indexedSet);
   }
 }
コード例 #24
0
 public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
 {
     if (!(c == null))
     {
         IndexedSet <Graphic> indexedSet;
         GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet);
         if (indexedSet != null)
         {
             indexedSet.AddUnique(graphic);
         }
         else
         {
             indexedSet = new IndexedSet <Graphic>();
             indexedSet.Add(graphic);
             GraphicRegistry.instance.m_Graphics.Add(c, indexedSet);
         }
     }
 }
コード例 #25
0
ファイル: GraphicRegistry.cs プロジェクト: gdzzzyyy/UGUIlok
        public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
        {
            if (c == null)
                return;

            IndexedSet<Graphic> graphics;
            instance.m_Graphics.TryGetValue(c, out graphics);

            if (graphics != null)
            {
                graphics.AddUnique(graphic);
                return;
            }

            // Dont need to AddUnique as we know its the only item in the list
            graphics = new IndexedSet<Graphic>();
            graphics.Add(graphic);
            instance.m_Graphics.Add(c, graphics);
        }
コード例 #26
0
ファイル: Program.cs プロジェクト: m-khooryani/MCollections
        private static void Test()
        {
            int              tid     = ++threadId;
            Random           rand    = new Random();
            IndexedSet <int> set     = new IndexedSet <int>();
            int              counter = 0;

            while (true)
            {
                set.Clear();
                int           size    = rand.Next(20000);
                HashSet <int> hashSet = new HashSet <int>();
                for (int i = 0; i < size; i++)
                {
                    int x = rand.Next(3000);
                    set.Add(x);
                    hashSet.Add(x);
                }
                int size2 = rand.Next(5000);
                for (int i = 0; i < size2; i++)
                {
                    int x = rand.Next(300);
                    set.Remove(x);
                    hashSet.Remove(x);
                }
                if (set.Count != hashSet.Count)
                {
                    throw new Exception();
                }
                List <int> list = new List <int>(hashSet);
                list.Sort();
                for (int i = 0; i < set.Count; i++)
                {
                    if (set[i] != list[i])
                    {
                        throw new Exception();
                    }
                }
                Console.WriteLine($"{tid} success {++counter}");
            }
        }
コード例 #27
0
        public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
        {
            if (c == null)
            {
                return;
            }

            IndexedSet <Graphic> graphics;

            instance.m_Graphics.TryGetValue(c, out graphics);

            if (graphics != null)
            {
                graphics.Add(graphic);
                return;
            }

            graphics = new IndexedSet <Graphic>();
            graphics.Add(graphic);
            instance.m_Graphics.Add(c, graphics);
        }
コード例 #28
0
ファイル: CI.cs プロジェクト: sakapon/AtCoder-Contests
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());

        var set = new IndexedSet <int>();

        Console.SetOut(new System.IO.StreamWriter(Console.OpenStandardOutput())
        {
            AutoFlush = false
        });
        while (n-- > 0)
        {
            var q = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            if (q[0] == 0)
            {
                set.Add(q[1]);
                Console.WriteLine(set.Count);
            }
            else if (q[0] == 1)
            {
                Console.WriteLine(set.Contains(q[1]) ? 1 : 0);
            }
            else if (q[0] == 2)
            {
                set.Remove(q[1]);
            }
            else
            {
                foreach (var x in set.GetItems(x => x >= q[1], x => x <= q[2]))
                {
                    Console.WriteLine(x);
                }
            }
        }
        Console.Out.Flush();
    }
コード例 #29
0
ファイル: F.cs プロジェクト: sakapon/AtCoder-Contests
    static object Solve()
    {
        var(n, qc) = Read2();
        var c  = Read();
        var qs = new bool[qc]
                 .Select((_, id) => { var a = Read(); return(id, l: a[0] - 1, r: a[1] - 1); })
                 .GroupBy(q => q.r)
                 .ToDictionary(g => g.Key, g => g.ToArray());

        // 各色に対して、最も右のインデックス
        var ris = Array.ConvertAll(new bool[n + 1], _ => - 1);
        var set = new IndexedSet <int>();

        var counts = new int[qc];

        for (int i = 0; i < n; i++)
        {
            if (ris[c[i]] != -1)
            {
                set.Remove(ris[c[i]]);
            }
            ris[c[i]] = i;
            set.Add(i);

            if (qs.ContainsKey(i))
            {
                foreach (var(id, l, _) in qs[i])
                {
                    var li = set.GetFirstIndex(x => x >= l);
                    counts[id] = set.Count - li;
                }
            }
        }

        return(string.Join("\n", counts));
    }
コード例 #30
0
        /**
         * Given an Iterable of Coord (such as a List or Set), a distance to expand outward by (using this Radius), and the
         * bounding height and width of the map, gets a "thickened" group of Coord as a Set where each Coord in points has
         * been expanded out by an amount no greater than distance. As an example, you could call this on a line generated
         * by Bresenham, OrthoLine, or an LOS object's getLastPath() method, and expand the line into a thick "brush stroke"
         * where this Radius affects the shape of the ends. This will never produce a Coord with negative x or y, a Coord
         * with x greater than or equal to width, or a Coord with y greater than or equal to height.
         * @param distance the distance, as measured by this Radius, to expand each Coord on points up to
         * @param width the bounding width of the map (exclusive)
         * @param height the bounding height of the map (exclusive)
         * @param points an Iterable (such as a List or Set) of Coord that this will make a "thickened" version of
         * @return a Set of Coord that covers a wider area than what points covers; each Coord will be unique (it's a Set)
         */
        public static IndexedSet <Coord> Expand(this Radius r, int distance, int width, int height, IEnumerable <Coord> points)
        {
            if (points is null)
            {
                return(null);
            }
            List <Coord>       around = PointsInside(r, Coord.Get(distance, distance), distance, false, width, height);
            IndexedSet <Coord> expanded = new IndexedSet <Coord>();
            int tx, ty;

            foreach (Coord pt in points)
            {
                foreach (Coord ar in around)
                {
                    tx = pt.X + ar.X - distance;
                    ty = pt.Y + ar.Y - distance;
                    if (tx >= 0 && tx < width && ty >= 0 && ty < height)
                    {
                        expanded.Add(Coord.Get(tx, ty));
                    }
                }
            }
            return(expanded);
        }
コード例 #31
0
        public void RefreshSelectedRoleBindings()
        {
            var roleMap      = m_roleSetButtonList[m_selectedRoleIndex].roleMap;
            var bindingTable = roleMap.BindingTable;

            // update bound device list and keep the original order
            for (int i = 0, imax = m_boundDevices.Count; i < imax; ++i)
            {
                m_tempDevices.Add(m_boundDevices[i]);
            }
            for (int i = 0, imax = bindingTable.Count; i < imax; ++i)
            {
                var boundDevice = bindingTable.GetKeyByIndex(i);
                if (!m_tempDevices.Remove(boundDevice))
                {
                    m_boundDevices.Add(boundDevice);
                }
            }
            for (int i = 0, imax = m_tempDevices.Count; i < imax; ++i)
            {
                m_boundDevices.Remove(m_tempDevices[i]);
            }
            m_tempDevices.Clear();

            if (m_bindingList.Count == 0)
            {
                m_bindingList.Add(m_bindingItem);
                m_bindingItem.onEditPress   += StartEditBinding;
                m_bindingItem.onRemovePress += RemoveBinding;
            }

            var bindingIndex = 0;

            for (int max = m_boundDevices.Count; bindingIndex < max; ++bindingIndex)
            {
                BindingInterfaceRoleSetBindingItem item;
                if (bindingIndex >= m_bindingList.Count)
                {
                    var itemObj = Instantiate(m_bindingItem.gameObject);
                    itemObj.transform.SetParent(m_bindingItem.transform.parent, false);

                    // set child index to secnd last, last index is for add item
                    itemObj.transform.SetSiblingIndex(itemObj.transform.parent.childCount - 2);

                    m_bindingList.Add(item = itemObj.GetComponent <BindingInterfaceRoleSetBindingItem>());
                    item.onEditPress      += StartEditBinding;
                    item.onRemovePress    += RemoveBinding;
                }
                else
                {
                    item = m_bindingList[bindingIndex];
                }

                item.gameObject.SetActive(true);
                item.deviceSN     = m_boundDevices[bindingIndex];
                item.isEditing    = isEditing && item.deviceSN == m_editingDevice;
                item.isHeighLight = hasHeightLight && item.deviceSN == m_heighLightDevice;
                item.RefreshDisplayInfo(roleMap);
            }

            // FIXME: issue in 2017.2.0b2, item won't refresh at the first time, force refresh
            m_bindingItem.transform.parent.gameObject.SetActive(false);
            m_bindingItem.transform.parent.gameObject.SetActive(true);

            for (int max = m_bindingList.Count; bindingIndex < max; ++bindingIndex)
            {
                m_bindingList[bindingIndex].gameObject.SetActive(false);
            }
        }
コード例 #32
0
        protected virtual void ProcessRaycast()
        {
            if (m_processedFrame == Time.frameCount)
            {
                return;
            }
            m_processedFrame = Time.frameCount;

            // use another list to iterate raycasters
            // incase that raycasters may changed during this process cycle
            for (int i = 0, imax = raycasters.Count; i < imax; ++i)
            {
                var r = raycasters[i];

                if (r != null)
                {
                    processingRaycasters.Add(r);
                }
            }

            for (var i = processingRaycasters.Count - 1; i >= 0; --i)
            {
                var raycaster = processingRaycasters[i];
                if (raycaster == null)
                {
                    continue;
                }

                raycaster.Raycast();
                var result = raycaster.FirstRaycastResult();

                // prepare raycaster value
                var scrollDelta  = raycaster.GetScrollDelta();
                var raycasterPos = raycaster.transform.position;
                var raycasterRot = raycaster.transform.rotation;

                var hoverEventData = raycaster.HoverEventData;
                if (hoverEventData == null)
                {
                    continue;
                }

                // gen shared data and put in hover event
                hoverEventData.Reset();
                hoverEventData.delta                 = Vector2.zero;
                hoverEventData.scrollDelta           = scrollDelta;
                hoverEventData.position              = ScreenCenterPoint;
                hoverEventData.pointerCurrentRaycast = result;

                hoverEventData.position3DDelta = raycasterPos - hoverEventData.position3D;
                hoverEventData.position3D      = raycasterPos;
                hoverEventData.rotationDelta   = Quaternion.Inverse(hoverEventData.rotation) * raycasterRot;
                hoverEventData.rotation        = raycasterRot;

                // copy data to other button event
                for (int j = 0, jmax = raycaster.ButtonEventDataList.Count; j < jmax; ++j)
                {
                    var buttonEventData = raycaster.ButtonEventDataList[j];
                    if (buttonEventData == null || buttonEventData == hoverEventData)
                    {
                        continue;
                    }

                    buttonEventData.Reset();
                    buttonEventData.delta                 = Vector2.zero;
                    buttonEventData.scrollDelta           = scrollDelta;
                    buttonEventData.position              = ScreenCenterPoint;
                    buttonEventData.pointerCurrentRaycast = result;

                    buttonEventData.position3DDelta = hoverEventData.position3DDelta;
                    buttonEventData.position3D      = hoverEventData.position3D;
                    buttonEventData.rotationDelta   = hoverEventData.rotationDelta;
                    buttonEventData.rotation        = hoverEventData.rotation;
                }

                ProcessPress(hoverEventData);
                ProcessMove(hoverEventData);
                ProcessDrag(hoverEventData);

                // other buttons event
                for (int j = 1, jmax = raycaster.ButtonEventDataList.Count; j < jmax; ++j)
                {
                    var buttonEventData = raycaster.ButtonEventDataList[j];
                    if (buttonEventData == null || buttonEventData == hoverEventData)
                    {
                        continue;
                    }

                    buttonEventData.pointerEnter = hoverEventData.pointerEnter;

                    ProcessPress(buttonEventData);
                    ProcessDrag(buttonEventData);
                }

                // scroll event
                if (result.isValid && !Mathf.Approximately(scrollDelta.sqrMagnitude, 0.0f))
                {
                    var scrollHandler = ExecuteEvents.GetEventHandler <IScrollHandler>(result.gameObject);
                    ExecuteEvents.ExecuteHierarchy(scrollHandler, hoverEventData, ExecuteEvents.scrollHandler);
                }
            }

            if (isActiveAndEnabled)
            {
                for (var i = processingRaycasters.Count - 1; i >= 0; --i)
                {
                    var r = processingRaycasters[i];
                    if (!raycasters.Contains(r))
                    {
                        CleanUpRaycaster(r);
                    }
                }
            }
            else
            {
                for (var i = processingRaycasters.Count - 1; i >= 0; --i)
                {
                    CleanUpRaycaster(processingRaycasters[i]);
                }
            }

            processingRaycasters.Clear();
        }