protected override BaseFuzzyObject plus(BaseFuzzyObject fuzzy) { var item = fuzzy as FuzzyTriplet; return(new FuzzyTriplet(this.triplet.first + item.triplet.first, this.triplet.second + item.triplet.second, this.triplet.third + item.triplet.third)); }
protected override BaseFuzzyObject plus(BaseFuzzyObject fuzzy) { var first = this; var second = fuzzy as FuzzyObject; var result = new FuzzyObject(); foreach (var property in first.Belongings) { result.Belongings.Add(property.Key, new Dictionary <string, double>()); if (second.Belongings.ContainsKey(property.Key)) { foreach (var value in property.Value) { if (second.Belongings[property.Key].ContainsKey(value.Key)) { result.Belongings[property.Key].Add(value.Key, value.Value + second.Belongings[property.Key][value.Key]); } else { result.Belongings[property.Key].Add(value.Key, value.Value); } } } } foreach (var property in second.Belongings) { if (!result.Belongings.ContainsKey(property.Key)) { result.Belongings.Add(property.Key, new Dictionary <string, double>()); } foreach (var value in second.Belongings[property.Key]) { if (!result.Belongings[property.Key].ContainsKey(value.Key)) { result.Belongings[property.Key].Add(value.Key, value.Value); } } } return(result); }
protected abstract BaseFuzzyObject plus(BaseFuzzyObject fuzzy);
public FuzzyTriplet(BaseFuzzyObject f, BaseFuzzyObject s, BaseFuzzyObject t) { triplet = new Triplet <BaseFuzzyObject>(f, s, t); }