public bool IsColorValidatedForBand(Band band, string color) { var bandColorValue = new BandColorValue() { Band = band, Color = color }; var sp = new BandColorSpecification(bandColorValue); if (sp.IsSatisfiedBy(bandColorValue)) { var value = colors.GetAllBandColors().Where(sp.ToExpression()).SingleOrDefault(); return(value != null); } return(false); }
public double?GetValue(Band band, string color) { var bandColorValue = new BandColorValue() { Band = band, Color = color }; var sp = new FourBandColorResistorSpecification(bandColorValue); if (sp.IsSatisfiedBy(bandColorValue)) { var value = colors.GetAllBandColors().Where(sp.ToExpression()).SingleOrDefault(); if (value == null) { throw new ColorNotFoundException(bandColorValue.Band); } return(value.Value); } return(null); }
public bool IsColorValidatedForBand(BandColorValue bandColorValue) { return(IsColorValidatedForBand(bandColorValue.Band, bandColorValue.Color)); }
public double GetValue(BandColorValue bandColorValue) { return(GetValue(bandColorValue.Band, bandColorValue.Color)); }