Example #1
0
        public Vector <T> sort(dynamic sortBehavior = null)
        {
            IComparer <T> comparer;

            if (sortBehavior is System.Func <T, T, int> )
            {
                System.Func <T, T, int> func = (System.Func <T, T, int>)sortBehavior;
                // By definition, we know that the vector only contains type T,
                // so if the function passed has the exact expected signature, we use the fast path
                comparer = new TypedFunctionSorter(func);
            }
            else if (sortBehavior is Delegate)
            {
                comparer = new FunctionSorter(sortBehavior);
            }
            else if (sortBehavior is uint)
            {
                comparer = new OptionsSorter((uint)sortBehavior);
            }
            else
            {
                //	http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Vector.html#sort%28%29
                comparer = new DefaultSorter();
            }
            System.Array.Sort(mArray, 0, (int)mCount, comparer);
            return(this);
        }
Example #2
0
        private void InitSorter(LSObject obj)
        {
            var name   = obj["Name"].Value.ToString();
            var sorter = Sorters.Find(e => e.Name.Equals(name));

            if (sorter == null)
            {
                sorter = new DefaultSorter {
                    Name = name
                };
                Sorters.Add(sorter);
            }
            var rule = obj["Rules"];

            sorter.Data = rule.GetValue(sorter.Type);
        }
Example #3
0
 public Vector(int CAPACITY)
 {
     data = new T[CAPACITY];
     // connect Sorter to the DeafultSorter
     Sorter = new DefaultSorter();
 }
Example #4
0
 public Vector()
 {
     data = new T[DEFAULT_CAPACITY];
     // connect Sorter to the DeafultSorter
     Sorter = new DefaultSorter();
 }