private void AddInterface(IInterfaceImplementer implementer, InterfaceType _interface) { if (implementer == null || _interface == null) return; TreeNode node = CreateInterfaceNode(_interface.Name); AddOperations(implementer, _interface, node); }
/// <exception cref="RelationshipException"> /// The language of <paramref name="interfaceType"/> does not equal.-or- /// <paramref name="interfaceType"/> is earlier implemented interface. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="interfaceType"/> is null. /// </exception> public virtual void AddInterface(InterfaceType interfaceType) { if (interfaceType == null) throw new ArgumentNullException("interfaceType"); foreach (InterfaceType implementedInterface in InterfaceList) { if (interfaceType == implementedInterface) throw new RelationshipException(Strings.ErrorCannotAddSameInterface); } InterfaceList.Add(interfaceType); Changed(); }
private void AddOperations(IInterfaceImplementer implementer, InterfaceType _interface, TreeNode node) { if (implementer == null || _interface == null || node == null) return; foreach (InterfaceType baseInterface in _interface.Bases) AddOperations(implementer, baseInterface, node); foreach (Operation operation in _interface.Operations) { Operation defined = implementer.GetDefinedOperation(operation); if (defined == null) { CreateOperationNode(node, operation); } else if (defined.Type != operation.Type && _interface.Language.SupportsExplicitImplementation) { TreeNode operationNode = CreateOperationNode(node, operation); operationNode.ForeColor = Color.Gray; } } }
/// <exception cref="ArgumentException"> /// The language of <paramref name="interfaceType"/> does not equal.-or- /// <paramref name="interfaceType"/> is earlier implemented interface. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="interfaceType"/> is null. /// </exception> public override void AddInterface(InterfaceType interfaceType) { if (!(interfaceType is JavaInterface)) { throw new RelationshipException( string.Format(Strings.ErrorInterfaceLanguage, "Java")); } base.AddInterface(interfaceType); }
/// <exception cref="RelationshipException"> /// The language of <paramref name="interfaceType"/> does not equal.-or- /// <paramref name="interfaceType"/> is earlier implemented interface. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="interfaceType"/> is null. /// </exception> public override void AddInterface(InterfaceType interfaceType) { if (!(interfaceType is CSharpInterface)) throw new RelationshipException(string.Format(Strings.ErrorInterfaceLanguage, "C#")); base.AddInterface(interfaceType); }
/// <exception cref="ArgumentNullException"> /// <paramref name="interfaceType"/> is null. /// </exception> internal InterfaceShape(InterfaceType interfaceType) : base(interfaceType) { _interface = interfaceType; UpdateMinSize(); }
internal bool RemoveBase(InterfaceType _base) { if (BaseList.Remove(_base)) { Changed(); return true; } else { return false; } }
/// <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 bool IsAncestor(InterfaceType _interface) { foreach (InterfaceType baseInterface in baseList) { if (baseInterface.IsAncestor(_interface)) return true; } return (_interface == this); }
public void RemoveInterface(InterfaceType interfaceType) { if (InterfaceList.Remove(interfaceType)) Changed(); }