private void UniquifyName(IAssess <Tdata> item) { int highestIndex = -1; foreach (var a in Assessors) { int index; if (a.Name == item.Name) { index = 1; } else { if (!a.Name.StartsWith(item.Name)) { continue; } if (!int.TryParse(a.Name.Substring(item.Name.Length), out index)) { continue; } } highestIndex = Math.Max(index, highestIndex); } if (highestIndex >= 1) { item.Name += (highestIndex + 1).ToString(); } }
public bool Contains(IAssess <Tdata> item) { return(((IList <IAssess <Tdata> >)Assessors).Contains(item)); }
public int IndexOf(IAssess <Tdata> item) { return(((IList <IAssess <Tdata> >)Assessors).IndexOf(item)); }
public bool Remove(IAssess <Tdata> item) { return(Coefficients.Remove(item)); //return ((IList<IAssess<Tdata>>)Assessors).Remove(item); }
public void Insert(int index, IAssess <Tdata> item) { UniquifyName(item); ((IList <IAssess <Tdata> >)Assessors).Insert(index, item); coefficients.Insert(index, 1.0); }
public void Add(IAssess <Tdata> item) { UniquifyName(item); Coefficients.Add(item, 1.0); ((IList <IAssess <Tdata> >)Assessors).Add(item); }