public static Classifier Enqueue(this Classifier classifier, Qualifier tail) { classifier?.Path.Add(tail); return(classifier); }
/// <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))); }
/// <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); }
/// <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); }
/// <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()); }