Clone() public abstract méthode

public abstract Clone ( CompositeType newParent ) : Operation
newParent CompositeType
Résultat Operation
Exemple #1
0
        /// <exception cref="ArgumentException">
        /// <paramref name="operation"/> cannot be overridden.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="operation"/> is null.
        /// </exception>
        public override Operation Override(Operation operation)
        {
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }

            if (operation.Modifier == OperationModifier.None ||
                operation.Modifier == OperationModifier.Sealed)
            {
                throw new ArgumentException("error_cannot_override");
            }

            if (operation.Language != Language.CSharp)
            {
                throw new ArgumentException("error_languages_do_not_equal");
            }

            Operation newOperation = (Operation)operation.Clone();

            newOperation.Parent   = this;
            newOperation.Modifier = OperationModifier.Override;
            OperationList.Add(newOperation);

            return(newOperation);
        }
Exemple #2
0
        /// <exception cref="ArgumentException">
        /// The language of <paramref name="operation"/> does not equal.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="operation"/> is null.
        /// </exception>
        public Operation Implement(Operation operation)
        {
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }

            if (operation.Language != Language)
            {
                throw new ArgumentException("error_languages_do_not_equal");
            }

            Operation newOperation = (Operation)operation.Clone();

            newOperation.Parent         = this;
            newOperation.AccessModifier = AccessModifier.Public;
            newOperation.Modifier       = OperationModifier.None;
            newOperation.IsStatic       = false;
            OperationList.Add(newOperation);

            return(newOperation);
        }
Exemple #3
0
		/// <exception cref="ArgumentException">
		/// <paramref name="operation"/> cannot be overridden.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="operation"/> is null.
		/// </exception>
		protected override Operation Override(Operation operation, CompositeType newParent)
		{
			if (operation == null)
				throw new ArgumentNullException("operation");

			if (!operation.IsVirtual && !operation.IsAbstract && !operation.IsOverride ||
				operation.IsSealed)
			{
				throw new ArgumentException(
					Strings.ErrorCannotOverride, "operation");
			}

			Operation newOperation = operation.Clone(newParent);
			newOperation.IsVirtual = false;
			newOperation.IsAbstract = false;
			newOperation.IsOverride = true;

			return newOperation;
		}
Exemple #4
0
		/// <exception cref="ArgumentException">
		/// The language does not support explicit interface implementation.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="operation"/> is null.-or-
		/// <paramref name="newParent"/> is null.
		/// </exception>
		protected override Operation Implement(Operation operation,
			CompositeType newParent, bool explicitly)
		{
			if (newParent == null)
				throw new ArgumentNullException("newParent");
			if (operation == null)
				throw new ArgumentNullException("operation");

			Operation newOperation = operation.Clone(newParent);

			newOperation.AccessModifier = AccessModifier.Public;
			newOperation.ClearModifiers();
			newOperation.IsStatic = false;

			if (explicitly) {
				newOperation.Name = string.Format("{0}.{1}",
					((InterfaceType) operation.Parent).Name, newOperation.Name);
			}

			return newOperation;
		}
Exemple #5
0
		/// <exception cref="ArgumentException">
		/// <paramref name="operation"/> cannot be overridden.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="operation"/> is null.
		/// </exception>
		protected override Operation Override(Operation operation, CompositeType newParent)
		{
			if (operation == null)
				throw new ArgumentNullException("operation");

			if (operation.Modifier == OperationModifier.Sealed) {
				throw new ArgumentException(
					Strings.ErrorCannotOverride, "operation");
			}

			Operation newOperation = operation.Clone(newParent);
			newOperation.ClearModifiers();

			return newOperation;
		}
Exemple #6
0
		/// <exception cref="ArgumentException">
		/// The language does not support explicit interface implementation.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="operation"/> is null.-or-
		/// <paramref name="newParent"/> is null.
		/// </exception>
		protected override Operation Implement(Operation operation,
			CompositeType newParent, bool explicitly)
		{
			if (operation == null)
				throw new ArgumentNullException("operation");
			if (newParent == null)
				throw new ArgumentNullException("newParent");

			if (explicitly) {
				throw new ArgumentException("Java does not support explicit" +
					"interface implementation.", "explicitly");
			}

			Operation newOperation = operation.Clone(newParent);

			newOperation.AccessModifier = AccessModifier.Default;
			newOperation.ClearModifiers();
			newOperation.IsStatic = false;

			return newOperation;
		}