/// <summary> /// Initializes a new instance of the <see cref="Convoy"/> class. /// </summary> /// <param name="locomotiveInfo">The locomotive information.</param> /// <param name="convoyReaderFilePath"></param> public Convoy(string locomotiveInfo, string convoyReaderFilePath) { this.Locomotive = new Locomotive(locomotiveInfo); this.WeightInKilos = this.Locomotive.WeightInKilos; this.WagonStack = new Stack <AbstractWagon>(); this.Length = 0; this.JournalLog = new JournalLog(convoyReaderFilePath); }
/// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="isDisposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> private void Dispose(bool isDisposing) { //Check if Dispose has been called if (!this._IsDisposed) { //dispose managed and unmanaged resources if (isDisposing) { //managed resources clean this.Locomotive = null; this.WagonStack = null; this.JournalLog = null; } //unmanaged resources clean this.WeightInKilos = this.Length = 0; //confirm cleaning this._IsDisposed = true; } }