public bool CalculateWeight(TowerProgram[] programs) { if (ChildPrograms == null) { ChildPrograms = programs.Where(x => ChildProgramNames.Contains(x.Name)).ToArray(); } if (ChildPrograms.Any(x => x.WeightTotal == -1)) { return(false); } WeightTotal = ChildPrograms.Sum(x => x.WeightTotal) + Weight; return(true); }
public bool IsUnbalanced() { return(ChildPrograms.Select(x => x.WeightTotal).Distinct().Count() > 1); }