// Copyright (C) Stichting Deltares 2018. All rights reserved. // // This file is part of the Dam Engine. // // The Dam Engine is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System.Collections.Generic; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; using Deltares.DamEngine.Data.Standard.Calculation; namespace Deltares.DamEngine.Data.RegionalAssessmentResults { public class EvaluationJob { private string dikeName = ""; private List locations = new List(); private List failedEvaluatedLocations = new List(); private List results = new List(); public string DikeName { get { return dikeName; } set { dikeName = value; } } public List Locations { get { return locations; } set { locations = value; } } public List Results { get { return results; } set { results = value; } } // public string XML // { // get // { // XmlSerializer serializer = new XmlSerializer(); // return serializer.SerializeToString(this); // } // set // { // XmlDeserializer deserializer = new XmlDeserializer(); // EvaluationJob job = (EvaluationJob)deserializer.XmlDeserializeFromString(value, typeof(EvaluationJob)); // // this.DikeName = job.DikeName; // // this.Locations.Clear(); // this.Locations.AddRange(job.Locations); // // this.Results.Clear(); // this.Results.AddRange(job.Results); // this.schematizationFactorResults.Clear(); // this.schematizationFactorResults.AddRange(job.schematizationFactorResults); // } // } public List FailedEvaluatedLocations { get { return failedEvaluatedLocations; } set { failedEvaluatedLocations = value; } } public void AttachResults(IEnumerable locationJobs) { foreach (LocationJob locationJob in locationJobs) { foreach (Location location in this.locations) { if (locationJob.Location.Name.Equals(location.Name)) { if (locationJob.LocationResult == null) { locationJob.LocationResult = new LocationResult(); } if ((this.locations.IndexOf(location) < 0) || (this.locations.IndexOf(location) >= this.results.Count)) { var failedRes = new RegionalScenariosResult(); failedRes.CalculationResult = CalculationResult.UnexpectedError; locationJob.LocationResult.RegionalScenariosResult = failedRes; } else { locationJob.LocationResult.RegionalScenariosResult = this.results[this.locations.IndexOf(location)]; } // foreach (RWScenarioResult scenarioResult in locationJob.LocationResult.RegionalScenariosResult.RegionalScenarioResults) // { // foreach (RWScenarioProfileResult scenarioProfileResult in scenarioResult.RegionalScenarioProfileResults) // { // scenarioProfileResult.Location = locationJob.Location; // } // } #Bka: if this is really needed, location must be added as non serializeable object. } } } } } }