Beispiel #1
0
        /// <summary>
        /// Get all style declarations that match the selector
        /// </summary>
        public List <CssStyleDeclaration> GetStylesForElement(XElement element)
        {
            List <SortStyle> foundStyles = new List <SortStyle>();

            foreach (var rule in cssRules)
            {
                var specifity = rule.MatchElement(element);

                if (specifity >= 0)
                {
                    var ss = new SortStyle {
                        Specificity = specifity, Style = rule.Style
                    };
                    foundStyles.Add(ss);
                }
            }

            // sort all matching styles, lowest specificity first
            foundStyles.Sort(delegate(SortStyle a, SortStyle b)
            {
                var sa = a.Specificity;
                var sb = b.Specificity;

                if (sa == sb)
                {
                    return(0);
                }

                return(sa < sb ? -1 : 1);
            });

            return(foundStyles.Select(x => x.Style).ToList());
        }
Beispiel #2
0
 /// <summary>
 /// Sorting this <see cref="IList{T}"/> object using <see cref="IComparable.CompareTo(T?)"/>
 /// </summary>
 /// <typeparam name="T">The type if this <see cref="IList{T}"/></typeparam>
 /// <param name="list">this object.</param>
 /// <param name="style">The sorting algoritm to use.</param>
 /// <returns></returns>
 public static IList <T> Sort <T>(this IList <T> list, SortStyle style) where T : IComparable
 {
     if (style == SortStyle.Merge_Sort)
     {
         return(MergeSort(list));
     }
     if (style == SortStyle.Insertion_Sort)
     {
         return(InsertionSort(list));
     }
     if (style == SortStyle.Bogo_Sort)
     {
         return(BogoSort(list));
     }
     return(BubbleSort(list));
 }
Beispiel #3
0
        void SelectedSort(SortStyle style)
        {
//			_sorted = style;
//
//			switch (style) {
//			case SortStyle.Alphabetic:
//				_catButton.Active = false;
//				_alphButton.Active = true;
//				break;
//			case SortStyle.Categories:
//				_alphButton.Active = false;
//				_catButton.Active = true;
//				break;
//			default:
//				// Should not enter here.
//				break;
//			}
        }
Beispiel #4
0
 public FeatureTextIntersector(SortStyle style = SortStyle.Vertical, int padding = 0)
 {
     _style   = style;
     _padding = padding;
 }
Beispiel #5
0
 // Use this for initialization
 void Start()
 {
     order = SortStyle.Empire;
 }
Beispiel #6
0
 public SortStyleChangedEventArgs(SortStyle sortStyle)
 {
     this.style = sortStyle;
 }