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); }
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))); }
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()); } }
public Category With(params Feature[] features) { HasFeatures.AddRange(features); return(this); }