/// <exception cref="RelationshipException"> /// Cannot create realization. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="implementer"/> is null.-or- /// <paramref name="baseType"/> is null. /// </exception> internal RealizationRelationship(TypeBase implementer, InterfaceType baseType) : base(implementer, baseType) { if (!(implementer is IInterfaceImplementer)) throw new RelationshipException(Strings.ErrorNotInterfaceImplementer); Attach(); }
private void AddInterface(IInterfaceImplementer implementer, InterfaceType _interface) { if (implementer == null || _interface == null) return; TreeNode node = CreateInterfaceNode(_interface.Name); AddOperations(implementer, _interface, node); }
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; } } }
bool RemoveBase(InterfaceType _base) { _base.children.Remove(this); if (BaseList.Remove(_base)) { Changed(); return true; } else { return false; } }
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, Name, _base.Name)); } if (_base.Language != Language) throw new RelationshipException(Strings.ErrorLanguagesDoNotEqual); BaseList.Add(_base); _base.children.Add(this); Changed(); }
private bool IsAncestor(InterfaceType _interface) { foreach (InterfaceType baseInterface in baseList) { if (baseInterface.IsAncestor(_interface)) return true; } return (_interface == this); }
/// <exception cref="ArgumentNullException"> /// <paramref name="interfaceType"/> is null. /// </exception> internal InterfaceShape(InterfaceType interfaceType) : base(interfaceType) { _interface = interfaceType; UpdateMinSize(); }
public RealizationRelationship Clone(TypeBase implementer, InterfaceType baseType) { RealizationRelationship realization = new RealizationRelationship(implementer, baseType); realization.CopyFrom(this); return realization; }