예제 #1
0
        public override void AddRealization(RealizationRelationship real)
        {
            if (!(real.BaseType is CSharpInterface))
                throw new RelationshipException(string.Format(Strings.ErrorInterfaceLanguage, "C#"));

            base.AddRealization(real);
        }
예제 #2
0
		/// <exception cref="ArgumentNullException">
		/// <paramref name="realization"/> is null.-or-
		/// <paramref name="startShape"/> is null.-or-
		/// <paramref name="endShape"/> is null.
		/// </exception>
		public Realization(RealizationRelationship realization, Shape startShape, Shape endShape)
			: base(realization, startShape, endShape)
		{
			this.realization = realization;
		}
		/// <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 AddRealization(RealizationRelationship real)
		{
			var interfaceType = real.BaseType;

			if (interfaceType == null)
				throw new ArgumentNullException("interfaceType");

			if (InterfaceList.Contains(interfaceType))
				throw new RelationshipException(Strings.ErrorCannotAddSameInterface);

			//foreach (InterfaceType implementedInterface in InterfaceList)
			//{
			//    if (interfaceType == implementedInterface)
			//        throw new RelationshipException(Strings.ErrorCannotAddSameInterface);
			//}
			
			InterfaceList.Add(interfaceType);
			interfaceType.Realisztions.Add(this);
			realizations.Add(real);
			Changed();
		}
		public RealizationRelationship Clone(TypeBase implementer, InterfaceType baseType)
		{
			RealizationRelationship realization = new RealizationRelationship(implementer, baseType);
			realization.CopyFrom(this);
			return realization;
		}
		public void RemoveRealization(RealizationRelationship real)
		{
			var interfaceType = real.BaseType;

			interfaceType.Realisztions.Remove(this);
			realizations.Remove(real);
			if (InterfaceList.Remove(interfaceType))
				Changed();
		}