Пример #1
0
        public bool IsMatch(Lingon lingon)
        {
            var has = HasFeatures.TrueForAll(ft => lingon.Features.Contains(ft));
            var not = NotFeatures.TrueForAll(ft => !lingon.Features.Contains(ft));

            return(has && not);
        }
Пример #2
0
 public bool Equals(Category other)
 {
     return(HasFeatures.TrueForAll(ft => other.HasFeatures.Contains(ft)) &&
            other.HasFeatures.TrueForAll(ft => HasFeatures.Contains(ft)) &&
            NotFeatures.TrueForAll(ft => other.NotFeatures.Contains(ft)) &&
            other.NotFeatures.TrueForAll(ft => NotFeatures.Contains(ft)));
 }
Пример #3
0
 public string ToString(Cypher cypher)
 {
     if (cypher.Categories.ContainsValue(this))
     {
         return(cypher.DecodePattern(new Pattern {
             this
         }));
     }
     else
     {
         var sb = new StringBuilder("?");
         HasFeatures.ForEach(feature => sb.Append($"[+{feature.Name}]"));
         NotFeatures.ForEach(feature => sb.Append($"[+{feature.Name}]"));
         return(sb.ToString());
     }
 }
Пример #4
0
 public Category With(params Feature[] features)
 {
     HasFeatures.AddRange(features);
     return(this);
 }