Exemplo n.º 1
0
        public IEnumerable <Cell> SortedCells(Cell.FilterType orderBy, bool descending)
        {
            switch (orderBy)
            {
            case Cell.FilterType.Mass:
                if (descending)
                {
                    return(Cells.OrderByDescending(x => x.Mass));
                }
                else
                {
                    return(Cells.OrderBy(x => x.Mass));
                }

            case Cell.FilterType.Energy:
                if (descending)
                {
                    return(Cells.OrderByDescending(x => x.Energy));
                }
                else
                {
                    return(Cells.OrderBy(x => x.Energy));
                }

            case Cell.FilterType.Momentum:
                if (descending)
                {
                    return(Cells.OrderByDescending(x => x.Momentum.Length));
                }
                else
                {
                    return(Cells.OrderBy(x => x.Momentum.Length));
                }

            case Cell.FilterType.Velocity:
                if (descending)
                {
                    return(Cells.OrderByDescending(x => x.Velocity.Length));
                }
                else
                {
                    return(Cells.OrderBy(x => x.Velocity.Length));
                }

            default:
                return(Cells.AsEnumerable());
            }
        }