Inheritance: CompositeType
コード例 #1
0
ファイル: ImplementDialog.cs プロジェクト: gbaychev/NClass
		private void AddInterface(IInterfaceImplementer implementer, InterfaceType _interface)
		{
			if (implementer == null || _interface == null)
				return;

			TreeNode node = CreateInterfaceNode(_interface.Name);
			AddOperations(implementer, _interface, node);
		}
コード例 #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();
		}
コード例 #3
0
ファイル: ImplementDialog.cs プロジェクト: gbaychev/NClass
		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
ファイル: JavaClass.cs プロジェクト: gbaychev/NClass
		/// <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);
		}
コード例 #5
0
ファイル: CSharpClass.cs プロジェクト: gbaychev/NClass
		/// <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);
		}
コード例 #6
0
ファイル: InterfaceShape.cs プロジェクト: gbaychev/NClass
		/// <exception cref="ArgumentNullException">
		/// <paramref name="interfaceType"/> is null.
		/// </exception>
		internal InterfaceShape(InterfaceType interfaceType)
			: base(interfaceType)
		{
			_interface = interfaceType;
			UpdateMinSize();
		}
コード例 #7
0
ファイル: InterfaceType.cs プロジェクト: gbaychev/NClass
		internal bool RemoveBase(InterfaceType _base)
		{
			if (BaseList.Remove(_base)) {
				Changed();
				return true;
			}
			else {
				return false;
			}
		}
コード例 #8
0
ファイル: InterfaceType.cs プロジェクト: gbaychev/NClass
		/// <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();
		}
コード例 #9
0
ファイル: InterfaceType.cs プロジェクト: gbaychev/NClass
		private bool IsAncestor(InterfaceType _interface)
		{
			foreach (InterfaceType baseInterface in baseList) {
				if (baseInterface.IsAncestor(_interface))
					return true;
			}
			return (_interface == this);
		}
コード例 #10
0
		public void RemoveInterface(InterfaceType interfaceType)
		{
			if (InterfaceList.Remove(interfaceType))
				Changed();
		}