예제 #1
0
 public static Classifier Enqueue(this Classifier classifier, Qualifier tail)
 {
     classifier?.Path.Add(tail);
     return(classifier);
 }
예제 #2
0
 /// <summary>
 /// True, if the given qualifier is held by this classifier.
 /// </summary>
 /// <param name="classifier">The classifier</param>
 /// <param name="qualifier">The qualifier</param>
 /// <returns>True, if the qualifier is held by this classifier</returns>
 public static bool IsExactMatching(this Classifier classifier, Qualifier qualifier)
 {
     return(classifier.Path.Any(q => q.Equals(qualifier)));
 }
예제 #3
0
 /// <summary>
 /// True, if the classifier is empty.
 /// </summary>
 /// <param name="classifier">The classifier</param>
 /// <returns>True if empty</returns>
 public static bool IsNothing(this Classifier classifier)
 {
     return(null == classifier || classifier.Path.Count == 0);
 }
예제 #4
0
        /// <summary>
        /// If a classifier contains only unique qualifiers.
        /// </summary>
        /// <param name="classifier">The classifier</param>
        /// <returns>True, if each path qualifier is unique (no cycles)</returns>
        public static bool IsValid(this Classifier classifier)
        {
            var set = new HashSet <Qualifier>(classifier?.Path);

            return(set.Count == classifier?.Path.Count);
        }
예제 #5
0
 /// <summary>
 /// Counterpart of <see cref="IsNothing(Classifier)"/>
 /// </summary>
 /// <param name="classifier">The classifier</param>
 /// <returns>True if the classifier holds any path of qualifiers</returns>
 public static bool IsSomething(this Classifier classifier)
 {
     return(!classifier.IsNothing());
 }