using Deltares.Dam.Data;
namespace Deltares.Standard.Specifications
{
///
/// The and specification is a compositable one.
///
/// The type of the candidate.
public class AndSpecification : CompositeSpecification
{
private readonly ISpecification one;
private readonly ISpecification other;
public AndSpecification(ISpecification one, ISpecification other)
{
this.one = one;
this.other = other;
}
///
/// Determines whether this candidate satisfies the specification AND the other.
///
/// The candidate.
///
/// true if the candidate satisfies the specification otherwise, false.
///
public override bool IsSatisfiedBy(TCandidate candidate)
{
bool satisfied = (this.one.IsSatisfiedBy(candidate) && this.other.IsSatisfiedBy(candidate));
if (!satisfied)
{
base.Description = this.Description;
}
return satisfied;
}
}
}