using Deltares.Standard.Specifications; namespace Deltares.Dam.Data.Sensors.Specifications { internal class DitchWaterLevelSensorSpecification : PredicateSpecification { private readonly double xDitchDikeSide; private readonly double xDitchPolderSide; public DitchWaterLevelSensorSpecification(double xDitchDikeSide, double xDitchPolderSide) : base(s => s.Type == SensorType.PolderLevel) { this.xDitchDikeSide = xDitchDikeSide; this.xDitchPolderSide = xDitchPolderSide; } public override bool IsSatisfiedBy(Sensor candidate) { if (base.IsSatisfiedBy(candidate)) return true; return candidate.RelativeLocation > xDitchDikeSide && candidate.RelativeLocation < xDitchPolderSide; } } }