public int GetAttributeRedundancy(SCPAttribute attribute) { if (USet == null) { return(0); } return(USet.Where(u => u == attribute.Tag).Count()); }
public void ComputeAttributeRedundancyPrice() { Sets.ForEach(set => { set.Attributes.ForEach(a => { if (USet.Exists(u => u == a.Tag)) { a.Cost = 0; USet.Where(u => u == a.Tag).ToList().ForEach(i => { double price = 0; SCPSet ts = Sets.Find(s => s.Tag == i); if (ts != null) { price = ts.Cost / ts.Attributes.Count; } a.Cost += price; }); } }); }); }