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

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     IsDumpTruck == other.IsDumpTruck ||
                     IsDumpTruck.Equals(other.IsDumpTruck)
                 ) &&
                 (
                     BlueBookSection == other.BlueBookSection ||
                     BlueBookSection != null &&
                     BlueBookSection.Equals(other.BlueBookSection)
                 ) &&
                 (
                     NumberOfBlocks == other.NumberOfBlocks ||
                     NumberOfBlocks.Equals(other.NumberOfBlocks)
                 ) &&
                 (
                     BlueBookRateNumber == other.BlueBookRateNumber ||
                     BlueBookRateNumber != null &&
                     BlueBookRateNumber.Equals(other.BlueBookRateNumber)
                 ) &&
                 (
                     MaximumHours == other.MaximumHours ||
                     MaximumHours != null &&
                     MaximumHours.Equals(other.MaximumHours)
                 ) &&
                 (
                     ExtendHours == other.ExtendHours ||
                     ExtendHours != null &&
                     ExtendHours.Equals(other.ExtendHours)
                 ) &&
                 (
                     MaxHoursSub == other.MaxHoursSub ||
                     MaxHoursSub != null &&
                     MaxHoursSub.Equals(other.MaxHoursSub)
                 ));
        }
Beispiel #2
0
        public override List <byte[]> GetProperties()
        {
            EncodedShortIdsEncoder shortIdsEncoder = new EncodedShortIdsEncoder();

            return(new List <byte[]> {
                ChainHash,
                FirstBlockNumber.GetBytesBigEndian(),
                NumberOfBlocks.GetBytesBigEndian(),
                Complete ? new byte[] { 255 } : new byte[1],
                shortIdsEncoder.Encode(ShortIds, CompressShortIds)
            });
        }
Beispiel #3
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + Id.GetHashCode();

                if (Name != null)
                {
                    hash = hash * 59 + Name.GetHashCode();
                }

                hash = hash * 59 + IsDumpTruck.GetHashCode();

                if (BlueBookSection != null)
                {
                    hash = hash * 59 + BlueBookSection.GetHashCode();
                }

                hash = hash * 59 + NumberOfBlocks.GetHashCode();

                if (BlueBookRateNumber != null)
                {
                    hash = hash * 59 + BlueBookRateNumber.GetHashCode();
                }

                if (MaximumHours != null)
                {
                    hash = hash * 59 + MaximumHours.GetHashCode();
                }

                if (ExtendHours != null)
                {
                    hash = hash * 59 + ExtendHours.GetHashCode();
                }

                if (MaxHoursSub != null)
                {
                    hash = hash * 59 + MaxHoursSub.GetHashCode();
                }

                return(hash);
            }
        }
Beispiel #4
0
        public override string ToString()
        {
            if (m_firstBlock == null || m_secondBlock == null)
            {
                return("[no characters in group]");
            }

            var sb = new StringBuilder();

            sb.Append(NumberOfBlocks == Int32.MaxValue ? "MAX" : NumberOfBlocks.ToString()).Append("  |  ")
            .Append(FirstReference)
            .Append(" (").Append(m_firstBlock.CharacterIdInScript).Append(")")
            .Append(" - ")
            .Append(SecondReference)
            .Append(" (").Append(m_secondBlock.CharacterIdInScript).Append(")");
            return(sb.ToString());
        }
Beispiel #5
0
        public override string ToString()
        {
            if (FirstBlock == null || SecondBlock == null)
            {
                return("[no characters in group]");
            }

            var sb = new StringBuilder();

            sb.Append(NumberOfBlocks == Int32.MaxValue ? "MAX" : NumberOfBlocks.ToString()).Append("  |  ")
            .Append(FirstBook.BookId).Append(" ").Append(FirstBlock.ChapterNumber).Append(":").Append(FirstBlock.InitialStartVerseNumber)
            .Append(" (").Append(FirstBlock.CharacterIdInScript).Append(")")
            .Append(" - ")
            .Append(SecondBook.BookId).Append(" ").Append(SecondBlock.ChapterNumber).Append(":").Append(SecondBlock.InitialStartVerseNumber)
            .Append(" (").Append(SecondBlock.CharacterIdInScript).Append(")");
            return(sb.ToString());
        }