/// <exception cref="RelationshipException"> /// The language of <paramref name="_base"/> does not equal.-or- /// <paramref name="_base"/> is earlier added base.-or- /// <paramref name="_base"/> is descendant of the interface. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="_base"/> is null. /// </exception> internal void AddBase(InterfaceType _base) { if (_base == null) { throw new ArgumentNullException("_base"); } if (BaseList.Contains(_base)) { throw new RelationshipException( Strings.ErrorCannotAddSameBaseInterface); } if (_base.IsAncestor(this)) { throw new RelationshipException(string.Format(Strings.ErrorCyclicBase, Strings.Interface)); } if (_base.Language != this.Language) { throw new RelationshipException(Strings.ErrorLanguagesDoNotEqual); } BaseList.Add(_base); Changed(); }
private void UpdateBaseList() { using (Monitor.Enter()) { var previousSelectedBase = SelectedBase; var bases = EligibleBases; if (SelectedFirstLevel != BaseGroup.Any) { bases = bases.Where(b => SelectedFirstLevel.Matches(b.Tags)); } if (SelectedSecondLevel != ItemClass.Any) { bases = bases.Where(b => b.ItemClass == SelectedSecondLevel); } if (SelectedThirdLevel != Tags.Default) { bases = bases.Where(b => b.Tags.HasFlag(SelectedThirdLevel)); } BaseList = bases.ToList(); SelectedBase = BaseList.Contains(previousSelectedBase) ? previousSelectedBase : BaseList[0]; if (SelectedBase == previousSelectedBase) { UpdateBase(); } } }
/// <exception cref="RelationException"> /// The language of <paramref name="_base"/> does not equal.-or- /// <paramref name="_base"/> is earlier added base.-or- /// <paramref name="_base"/> is descendant of the interface. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="_base"/> is null. /// </exception> internal void AddBase(InterfaceType _base) { if (_base == null) { throw new ArgumentNullException("_base"); } if (BaseList.Contains(_base)) { throw new RelationException( Strings.GetString("error_cannot_add_same_base_interface")); } if (_base.IsAncestor(this)) { throw new RelationException(Strings.GetString("error_cyclic_base", Strings.GetString("interface"))); } if (_base.Language != this.Language) { throw new RelationException(Strings.GetString("error_languages_do_not_equal")); } BaseList.Add(_base); Modified(); }
/// <exception cref="ArgumentException"> /// The language of <paramref name="_base"/> does not equal.-or- /// <paramref name="_base"/> is earlier added base.-or- /// <paramref name="_base"/> is descendant of the interface. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="_base"/> is null. /// </exception> internal void AddBase(InterfaceType _base) { if (_base == null) { throw new ArgumentNullException("_base"); } if (BaseList.Contains(_base)) { throw new ArgumentException("error_cannot_add_same_base_interface"); } if (_base.IsAncestor(this)) { throw new ArgumentException("interface"); } if (_base.Language != this.Language) { throw new ArgumentException("error_languages_do_not_equal"); } BaseList.Add(_base); }
public void AddTest() { Assert.IsFalse(list.Contains("C")); list.Add("C"); Assert.IsTrue(list.Contains("C")); }
public bool Contains(T item) { return(BaseList.Contains(item)); }