Inheritance: CompositeType
Example #1
0
		private void AddInterface(IInterfaceImplementer implementer, InterfaceType _interface)
		{
			if (implementer == null || _interface == null)
				return;

			TreeNode node = CreateInterfaceNode(_interface.Name);
			AddOperations(implementer, _interface, node);
		}
Example #2
0
		/// <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();
		}
Example #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;
				}
			}
		}
Example #4
0
		/// <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);
		}
Example #5
0
		/// <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);
		}
Example #6
0
		/// <exception cref="ArgumentNullException">
		/// <paramref name="interfaceType"/> is null.
		/// </exception>
		internal InterfaceShape(InterfaceType interfaceType)
			: base(interfaceType)
		{
			_interface = interfaceType;
			UpdateMinSize();
		}
Example #7
0
		internal bool RemoveBase(InterfaceType _base)
		{
			if (BaseList.Remove(_base)) {
				Changed();
				return true;
			}
			else {
				return false;
			}
		}
Example #8
0
		/// <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();
		}
Example #9
0
		private bool IsAncestor(InterfaceType _interface)
		{
			foreach (InterfaceType baseInterface in baseList) {
				if (baseInterface.IsAncestor(_interface))
					return true;
			}
			return (_interface == this);
		}
Example #10
0
		public void RemoveInterface(InterfaceType interfaceType)
		{
			if (InterfaceList.Remove(interfaceType))
				Changed();
		}