コード例 #1
0
		/// <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();
		}
コード例 #2
0
		private void AddInterface(IInterfaceImplementer implementer, InterfaceType _interface)
		{
			if (implementer == null || _interface == null)
				return;

			TreeNode node = CreateInterfaceNode(_interface.Name);
			AddOperations(implementer, _interface, node);
		}
コード例 #3
0
		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;
				}
			}
		}
コード例 #4
0
		bool RemoveBase(InterfaceType _base)
		{
            _base.children.Remove(this);
			if (BaseList.Remove(_base)) {
				Changed();
				return true;
			}
			else {
				return false;
			}
		}
コード例 #5
0
		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();
		}
コード例 #6
0
		private bool IsAncestor(InterfaceType _interface)
		{
			foreach (InterfaceType baseInterface in baseList) {
				if (baseInterface.IsAncestor(_interface))
					return true;
			}
			return (_interface == this);
		}
コード例 #7
0
		/// <exception cref="ArgumentNullException">
		/// <paramref name="interfaceType"/> is null.
		/// </exception>
		internal InterfaceShape(InterfaceType interfaceType)
			: base(interfaceType)
		{
			_interface = interfaceType;
			UpdateMinSize();
		}
コード例 #8
0
		public RealizationRelationship Clone(TypeBase implementer, InterfaceType baseType)
		{
			RealizationRelationship realization = new RealizationRelationship(implementer, baseType);
			realization.CopyFrom(this);
			return realization;
		}