// 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 System.Linq;
using Deltares.DamEngine.Data.General.Results;
using Deltares.DamEngine.Data.General.TimeSeries;
using Deltares.DamEngine.Data.RegionalAssessmentResults;
using Deltares.DamEngine.Data.Standard.Validation;
namespace Deltares.DamEngine.Data.General
{
///
/// Interface for location job
///
public interface ILocationJob
{
Location Location { get; }
IEnumerable RegionalScenarioResults { get; }
bool HasRegionalScenarioResults { get; }
}
///
/// Class holding LocationJob data
///
///
///
public class LocationJob : DamJob, ILocationJob
{
private TimeSerie waterLevelTimeSerie = new TimeSerie();
private LocationResult locationResult = new LocationResult();
private static DamProjectType damProjectType = DamProjectType.Operational;
///
/// Initializes a new instance of the class.
///
/// The subject.
public LocationJob(object subject)
: base(subject)
{
}
///
/// Gets or sets the location.
///
///
/// The location.
///
[Validate]
public Location Location
{
get
{
return Subject as Location;
}
set
{
Subject = value;
}
}
///
/// Gets or sets the water level time serie.
///
///
/// The water level time serie.
///
public TimeSerie WaterLevelTimeSerie
{
get { return waterLevelTimeSerie; }
set
{
waterLevelTimeSerie = value;
}
}
///
/// Gets the regional scenario results.
///
///
/// The regional scenario results.
///
public virtual IEnumerable RegionalScenarioResults
{
get
{
return !HasRegionalScenarioResults ?
new List() : locationResult.RegionalScenariosResult.RegionalScenarioResults;
}
}
///
/// Gets a value indicating whether this instance has regional scenario results.
///
///
/// true if this instance has regional scenario results; otherwise, false.
///
public bool HasRegionalScenarioResults
{
get { return locationResult != null && locationResult.RegionalScenariosResult != null &&
locationResult.RegionalScenariosResult.RegionalScenarioResults.Any();
}
}
///
/// Gets or sets the location result.
///
///
/// The location result.
///
public virtual LocationResult LocationResult
{
get { return locationResult; }
set
{
locationResult = value;
}
}
///
/// Gets or sets the type of the dam project.
///
///
/// The type of the dam project.
///
public static DamProjectType DamProjectType
{
get { return damProjectType; }
set { damProjectType = value; }
}
///
/// Returns a that represents this instance.
///
///
/// A that represents this instance.
///
public override string ToString()
{
return Location != null ? Location.ToString() : "";
}
}
}