Exemplo n.º 1
0
        public override int GetHashCode()
        {
            int hashCode = -1529620533;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Id);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Question);

            hashCode = hashCode * -1521134295 + EqualityComparer <IEnumerable <PollOption> > .Default.GetHashCode(Options);

            hashCode = hashCode * -1521134295 + TotalVoterCount.GetHashCode();
            hashCode = hashCode * -1521134295 + IsClosed.GetHashCode();
            hashCode = hashCode * -1521134295 + IsAnonymous.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Type);

            hashCode = hashCode * -1521134295 + AllowsMultipleAnswers.GetHashCode();
            hashCode = hashCode * -1521134295 + CorrectOptionId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Explanation);

            hashCode = hashCode * -1521134295 + EqualityComparer <IEnumerable <MessageEntity> > .Default.GetHashCode(ExplanationEntities);

            hashCode = hashCode * -1521134295 + OpenPeriod.GetHashCode();
            hashCode = hashCode * -1521134295 + CloseDate.GetHashCode();
            return(hashCode);
        }
Exemplo n.º 2
0
        /// <summary>
        /// A verbose string representation of the <see cref="LinearStateEstimator.Modeling.CircuitBreaker"/> and can be used for detailed text based output via a console or a text file.
        /// </summary>
        /// <returns>A verbose string representation of the <see cref="LinearStateEstimator.Modeling.CircuitBreaker"/>.</returns>
        public new string ToVerboseString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine();
            stringBuilder.AppendFormat("----- Circuit Breaker ----------------------------------------------------------");
            stringBuilder.AppendLine();
            stringBuilder.AppendFormat("      InternalID: " + InternalID.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("          Number: " + Number.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("            Name: " + Name + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("     Description: " + Description + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat(" Can Infer State: " + CanInferState.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("Group A Reported: " + CrossDevicePhasors.GroupAWasReported + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("Group B Reported: " + CrossDevicePhasors.GroupBWasReported + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("          Normal: " + NormalState.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("          Actual: " + ActualState.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        Measured: " + MeasuredState.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("   Measured Open: " + IsMeasuredOpen.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat(" Measured Closed: " + IsMeasuredClosed.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("   Inferred Open: " + IsInferredOpen.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat(" Inferred Closed: " + IsInferredClosed.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("         Is Open: " + IsOpen.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("       Is Closed: " + IsClosed.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat(" In Pruning Mode: " + InPruningMode.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("          Manual: " + InManualOverrideMode.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        FromNode: " + FromNode.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("          ToNode: " + ToNode.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("ParentSubstation: " + m_parentSubstation.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("          Status: {0}", Environment.NewLine);
            stringBuilder.AppendFormat(m_breakerStatus.ToStatusString() + "{0}", Environment.NewLine);
            stringBuilder.AppendLine();
            return(stringBuilder.ToString());
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BankAccount"/> class.
        /// Constructor of the class.
        /// </summary>
        /// <param name="firstName">First name of the owner of the account.</param>
        /// <param name="lastName">Last name of the owner of the account.</param>
        /// <param name="billNumber">The number of the bill.</param>
        /// <param name="billBalance">The balance of the bill.</param>
        /// <param name="typeOfBill">Type of the bill.</param>
        public BankAccount(string firstName, string lastName, long billNumber, decimal billBalance, TypeOfBill typeOfBill)
        {
            this.owner = new OwnerInfo()
            {
                FirstName = firstName, LastName = lastName
            };
            if (billNumber.ToString().Length != 16)
            {
                throw new ArgumentException("Bill number should contain 16 digits.");
            }
            else
            {
                this.billNumber = billNumber;
            }

            if (billBalance < 0)
            {
                throw new ArgumentException("Bill balance can't be less than zero.");
            }
            else
            {
                this.bills.Add(billBalance);
            }

            this.type     = typeOfBill;
            this.isClosed = IsClosed.Open;
            this.billStorage.AddBillToStorage(this);
        }
Exemplo n.º 4
0
Arquivo: Switch.cs Projeto: lulzzz/lse
        /// <summary>
        /// A verbose string representation of the <see cref="Switch"/>.
        /// </summary>
        /// <returns>A verbose string representation of the <see cref="Switch"/>.</returns>
        public new string ToVerboseString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine();
            stringBuilder.AppendFormat("----- Switch -------------------------------------------------------------------");
            stringBuilder.AppendLine();
            stringBuilder.AppendFormat("      InternalID: " + InternalID.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("          Number: " + Number.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("            Name: " + Name + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("     Description: " + Description + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat(" Can Infer State: " + CanInferState.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("Group A Reported: " + CrossDevicePhasors.GroupAWasReported + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("Group B Reported: " + CrossDevicePhasors.GroupBWasReported + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        Normally: " + NormalState.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        Actually: " + ActualState.ToString() + "{0}", Environment.NewLine); stringBuilder.AppendFormat("   Inferred Open: " + IsInferredOpen.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat(" Inferred Closed: " + IsInferredClosed.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("         Is Open: " + IsOpen.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("       Is Closed: " + IsClosed.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat(" In Pruning Mode: " + InPruningMode.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("          Manual: " + InManualOverrideMode.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        FromNode: " + FromNode.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("          ToNode: " + ToNode.ToString() + "{0}", Environment.NewLine);
            if (m_parentSubstation != null)
            {
                stringBuilder.AppendFormat("ParentSubstation: " + m_parentSubstation.ToString() + "{0}", Environment.NewLine);
            }
            if (m_parentTransmissionLine != null)
            {
                stringBuilder.AppendFormat("ParntTrnsmsnLine: " + m_parentTransmissionLine.ToString() + "{0}", Environment.NewLine);
            }
            stringBuilder.AppendFormat("   InDefaultMode: " + m_isInDefaultMode.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendLine();
            return(stringBuilder.ToString());
        }
        /// <summary>
        /// Closes existing bill.
        /// </summary>
        /// <param name="indexOfBill">Index of bill to close.</param>
        public void CloseExistingBill(int indexOfBill)
        {
            if (this.bills[indexOfBill] < 0)
            {
                throw new ArgumentException("You can't close the bill with negative balance.");
            }

            this.isClosed = IsClosed.Closed;
            Console.WriteLine($"{this.billNumber} bill is closed.\n");
        }
Exemplo n.º 6
0
 public string GetString()
 {
     return
         ("[DP=" + DastgahPardakhtCode.ToString() +
          ", SP=" + ShahrPardakhtCode.ToString() +
          ", MO=" + Mobile.ToString() +
          ", ISC=" + IsClosed.ToString() +
          ", ISV=" + IsValid.ToString() +
          ", NSD=" + (NazarsanjiDone ? "1" : "0") +
          "]");
 }
Exemplo n.º 7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ Number;
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsClosed.GetHashCode();
         hashCode = (hashCode * 397) ^ EventId;
         return(hashCode);
     }
 }
Exemplo n.º 8
0
        public void Matches_returns_true_for_a_ticket_which_is_closed(Ticket ticket)
        {
            // Arrange
            ticket.Closed = true;
            var sut = new IsClosed();

            // Act
            var result = sut.Matches(ticket);

            // Assert
            Assert.That(result, Is.True);
        }
Exemplo n.º 9
0
        public void Matches_returns_false_for_a_ticket_which_is_open(Ticket ticket)
        {
            // Arrange
            ticket.Closed = false;
            var sut = new IsClosed();

            // Act
            var result = sut.Matches(ticket);

            // Assert
            Assert.That(result, Is.False);
        }
Exemplo n.º 10
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            DbReloadToken
            .Merge(IsOpened.Changed())
            .Merge(IsClosed.Changed())
            .Merge(IsEnd.Changed())
            .Merge(Begin.Changed())
            .Merge(End.Changed())
            .SelectMany(_ => RxQuery(LoadItems))
            .Subscribe(Items);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Gets the hashcode for the block
        /// </summary>
        /// <returns>The hash code</returns>
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 27;
                foreach (var item in Children)
                {
                    hash = (13 * hash) + item.GetHashCode();
                }

                hash = (13 * hash) + IsClosed.GetHashCode();
                return(hash);
            }
        }
Exemplo n.º 12
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = 27;
         hash = (13 * hash) + TagStartPosition.GetHashCode();
         hash = (13 * hash) + TagEndPosition.GetHashCode();
         hash = (13 * hash) + ContentStartPosition.GetHashCode();
         hash = (13 * hash) + ContentEndPosition.GetHashCode();
         hash = (13 * hash) + Content.GetHashCode();
         hash = (13 * hash) + IsClosed.GetHashCode();
         return(hash);
     }
 }
Exemplo n.º 13
0
        public override void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement(GetType().ToString());
            base.WriteXml(writer);

            writer.WriteAttributeString(nameof(IsClosed), IsClosed.ToString());
            CentrePoint.WriteXml(writer);

            writer.WriteStartElement(nameof(Points));
            foreach (var point in Points)
            {
                point.WriteXml(writer);
            }
            writer.WriteEndElement();
            writer.WriteEndElement();
        }
Exemplo n.º 14
0
        /// <inheritdoc/>
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 27;
                hash = (13 * hash) + ContentStartPosition.GetHashCode();
                hash = (13 * hash) + ContentEndPosition.GetHashCode();
                foreach (var item in Content)
                {
                    hash = (13 * hash) + item.GetHashCode();
                }

                hash = (13 * hash) + IsClosed.GetHashCode();
                return(hash);
            }
        }
Exemplo n.º 15
0
        public LabelLister(IEntityData data, IsOpen isOpen, IsClosed isClosed)
        {
            if (isClosed == null)
            {
                throw new ArgumentNullException(nameof(isClosed));
            }
            if (isOpen == null)
            {
                throw new ArgumentNullException(nameof(isOpen));
            }
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            this.data     = data;
            this.isOpen   = isOpen;
            this.isClosed = isClosed;
        }
Exemplo n.º 16
0
Arquivo: Switch.cs Projeto: lulzzz/lse
        public new string ToCsvLineString()
        {
            StringBuilder csvLine = new StringBuilder();

            csvLine.AppendFormat($"{InternalID.ToString()},");
            csvLine.AppendFormat($"{Number.ToString()},");
            csvLine.AppendFormat($"{Name},");
            csvLine.AppendFormat($"{Description},");
            csvLine.AppendFormat($"{CanInferState.ToString()},");
            csvLine.AppendFormat($"{CrossDevicePhasors.GroupAWasReported},");
            csvLine.AppendFormat($"{CrossDevicePhasors.GroupBWasReported},");
            csvLine.AppendFormat($"{NormalState.ToString()},");
            csvLine.AppendFormat($"{ActualState.ToString()},");
            csvLine.AppendFormat($"{IsInferredOpen.ToString()},");
            csvLine.AppendFormat($"{IsInferredClosed.ToString()},");
            csvLine.AppendFormat($"{IsOpen.ToString()},");
            csvLine.AppendFormat($"{IsClosed.ToString()},");
            csvLine.AppendFormat($"{InPruningMode.ToString()},");
            csvLine.AppendFormat($"{InManualOverrideMode.ToString()},");
            csvLine.AppendFormat($"{FromNode.ToString()},");
            csvLine.AppendFormat($"{ToNode.ToString()},");
            if (ParentSubstation != null)
            {
                csvLine.AppendFormat($"{ParentSubstation.Name},");
            }
            else
            {
                csvLine.AppendFormat("None,");
            }
            if (m_parentTransmissionLine != null)
            {
                csvLine.AppendFormat($"{ParentTransmissionLine.Name},");
            }
            else
            {
                csvLine.AppendFormat("None,");
            }
            csvLine.AppendFormat($"{IsInDefaultMode}{Environment.NewLine}");
            return(csvLine.ToString());
        }
Exemplo n.º 17
0
 public bool Answer(IsClosed qry) => this.isClosed;
Exemplo n.º 18
0
 public override string ToString()
 => $"{nameof(DiskHeader)}{{{(string.IsNullOrWhiteSpace(FilePath) ? "" : $"{nameof(FilePath)}:{FilePath}, ")}{(AsyncFlag == null ? "" : $"{nameof(AsyncFlag)}:{AsyncFlag}, ")}{nameof(IsInvalid)}:{IsInvalid}, {nameof(IsClosed)}:{IsClosed}{(SectorSize == null ? "" : $", {nameof(SectorSize)}:{SectorSize}")}{(Headers == null ? "" : $", {nameof(Headers)}:{Headers}")}}}";