Exemplo n.º 1
0
        /// <summary>
        /// Returns true if Grade instances are equal
        /// </summary>
        /// <param name="other">Instance of Grade to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Grade other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     LongName == other.LongName ||
                     LongName != null &&
                     LongName.Equals(other.LongName)
                     ) &&
                 (
                     ShortName == other.ShortName ||
                     ShortName != null &&
                     ShortName.Equals(other.ShortName)
                 ) &&
                 (
                     ExternalReference == other.ExternalReference ||
                     ExternalReference != null &&
                     ExternalReference.Equals(other.ExternalReference)
                 ));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns true if HoursAssignmentOwningUnit instances are equal
        /// </summary>
        /// <param name="other">Instance of HoursAssignmentOwningUnit to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(HoursAssignmentOwningUnit other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Code == other.Code ||
                     Code != null &&
                     Code.Equals(other.Code)
                     ) &&
                 (
                     ShortName == other.ShortName ||
                     ShortName != null &&
                     ShortName.Equals(other.ShortName)
                 ) &&
                 (
                     LongName == other.LongName ||
                     LongName != null &&
                     LongName.Equals(other.LongName)
                 ) &&
                 (
                     ExternalReference == other.ExternalReference ||
                     ExternalReference != null &&
                     ExternalReference.Equals(other.ExternalReference)
                 ));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a value that indicates whether the current instance and a specified <see cref="CommandLine.NameInfo"/> have the same value.
        /// </summary>
        /// <param name="other">The <see cref="CommandLine.NameInfo"/> instance to compare.</param>
        /// <returns><value>true</value> if this instance of <see cref="CommandLine.NameInfo"/> and <paramref name="other"/> have the same value; otherwise, <value>false</value>.</returns>
        public bool Equals(NameInfo other)
        {
            if (other == null)
            {
                return(false);
            }

            return(ShortName.Equals(other.ShortName) && LongName.Equals(other.LongName));
        }
Exemplo n.º 4
0
        public bool Equals(IOption other)
        {
            if (Name != null ? !Name.Equals(other.Name) : other.Name != null)
            {
                return(false);
            }

            if (LongName != null ? !LongName.Equals(other.LongName) : other.LongName != null)
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Activate this parameter when found
        /// </summary>
        /// <param name="arguments">Arguments to process.</param>
        public override bool TryActivate(Queue <string> arguments)
        {
            if (arguments == null)
            {
                throw new ArgumentNullException(nameof(arguments));
            }

            if (arguments.Count == 0)
            {
                return(false);
            }

            var arg = arguments.Peek();

            if (arg.StartsWith(ShortName + ":", StringComparison.CurrentCultureIgnoreCase) ||
                arg.StartsWith(AlternateShortName + ":", StringComparison.CurrentCultureIgnoreCase) ||
                arg.StartsWith(LongName + ":", StringComparison.CurrentCultureIgnoreCase))
            {
                arguments.Dequeue();
                var value = arg.After(":").As <V>();
                _values.Add(value);
                return(true);
            }

            if (ShortName.Equals(arg, StringComparison.CurrentCultureIgnoreCase) ||
                AlternateShortName.Equals(arg, StringComparison.CurrentCultureIgnoreCase) ||
                LongName.Equals(arg, StringComparison.CurrentCultureIgnoreCase))
            {
                arguments.Dequeue();

                if (arguments.Count < 1)
                {
                    _valueMissing = true;
                    return(true);
                }

                var value = arguments.Dequeue().As <V>();
                _values.Add(value);
                return(true);
            }

            return(false);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Checks if this instance properties equals the specified other option.
 /// </summary>
 /// <param name="other">The other option.</param>
 /// <returns></returns>
 public bool Equals(CommandlineOption other)
 {
     return(Name.Equals(other.Name) && LongName.Equals(other.LongName) && Description.Equals(other.Description) &&
            Flags == other.Flags && ParameterName.Equals(other.ParameterName) && RequiredPosition.Equals(other.RequiredPosition));
 }