private void InitializeBands(BandDefinition definition) { for (double current = (double)definition.MinValue; current < (double)definition.MaxValue; current += (double)definition.Interval.Value) { items.Add(new ObservationBandItem <double>(definition.BandName, current, current + definition.Interval.Value)); } }
private void InitializeBands(BandDefinition definition) { for (long current = (long)definition.MinValue; current < (long)definition.MaxValue; current += (long)definition.Interval.Value) { items.Add(new ObservationBandItem <long>(definition.BandName, current, current + (long)definition.Interval.Value)); } }
private void InitializeBands(BandDefinition definition) { for (DateTime current = (DateTime)definition.MinValue; current < (DateTime)definition.MaxValue; current = current.AddDays(definition.Interval.Value)) { items.Add(new ObservationBandItem <DateTime>(definition.BandName, current, current.AddDays(definition.Interval.Value))); } }
public FieldObservationBand(ILambdaContext context, HttpClient httpClient, BandDefinition definition, IProductAnalyticsAPIClient client) : base($"{definition.BandingGroup}{definition.BandName}") { this.context = context ?? throw new ArgumentNullException("context"); this.httpClient = httpClient ?? throw new ArgumentNullException("httpClient"); this.client = client ?? throw new ArgumentNullException("client"); this.fieldObservations = new HashSet <string>(); this.fieldObservations.Add(definition.BandName); }
private static BandDefinition TranslateDefinition(BandDefinition submitted) { string translatedName; if (!BandNameTranslation.TryGetValue(submitted, out translatedName)) { return(submitted); } return(new BandDefinition(translatedName, submitted.Category, submitted.BandingGroup, submitted.MinValue, submitted.MaxValue, submitted.Interval)); }
private void InitializeIntervals(BandDefinition definition) { double localMin = ToDouble(definition.MinValue); double localMax = ToDouble(definition.MaxValue); double localInterval = ToDouble(definition.Interval.Value); for (double current = localMin; current < localMax; current += localInterval) { items.Add(new ObservationBandItem <double>(definition.BandName, current, current + localInterval)); } }
public FieldStressBand(ILambdaContext context, HttpClient httpClient, BandDefinition definition, IProductAnalyticsAPIClient client) : base($"{definition.BandingGroup} {definition.BandName}") { this.context = context ?? throw new ArgumentNullException("context"); this.httpClient = httpClient ?? throw new ArgumentNullException("httpClient"); this.client = client ?? throw new ArgumentNullException("client"); category = definition.Category; group = definition.BandingGroup; fieldName = definition.BandName; hasIntervals = (definition.Interval != null && definition.MinValue != null && definition.MaxValue != null); if (hasIntervals) { InitializeIntervals(definition); } }
public IntervalBandLong(BandDefinition definition) : base(definition.BandName) { if (definition.Interval == null) { throw new ArgumentNullException("Interval"); } if (definition.MinValue == null) { throw new ArgumentNullException("MinValue"); } if (definition.MaxValue == null) { throw new ArgumentNullException("MaxValue"); } InitializeBands(definition); }
public static BaseBand Create(Dictionary <string, BaseBand> existingBands, ILambdaContext context, HttpClient httpClient, BandDefinition definition, IProductAnalyticsAPIClient client, UDRList udrList) { BandDefinition toUse = TranslateDefinition(definition); Func <BandDefinition, BaseBand> creationFunction = AllBands.GetCreator(toUse.BandName); BaseBand band; if (creationFunction != null) { band = creationFunction(toUse); } else if (toUse.BandingGroup == "Field Observations") { if (existingBands.TryGetValue(toUse.BandingGroup, out band) && band is FieldObservationBand) { ((FieldObservationBand)band).AddBandDefinition(toUse); } else { band = new FieldObservationBand(context, httpClient, toUse, client); existingBands.Add(toUse.BandingGroup, band); } return(band); } else if (toUse.Category == "Field Stress") { band = new FieldStressBand(context, httpClient, toUse, client); } else if (toUse.BandingGroup == "UDR") { if (!existingBands.TryGetValue(toUse.BandingGroup, out band)) { band = new UDRBand(toUse, udrList); existingBands.Add(toUse.BandingGroup, band); } return(band); } else if (toUse.BandingGroup == "TestMeans" && toUse.MinValue != null && toUse.MaxValue != null && toUse.Interval.HasValue) { band = new ObservationBand(toUse); } else if (toUse.MinValue != null && toUse.MaxValue != null && toUse.Interval.HasValue) { if (toUse.MinValue is DateTime) { band = new IntervalBandDateTime(toUse); } else if (toUse.MinValue is double) { band = new IntervalBandDouble(toUse); } else if (toUse.MinValue is long) { band = new IntervalBandLong(toUse); } else { throw new ArgumentOutOfRangeException($"Band: {toUse.BandName} is not handled or is not defined properly."); } } else if (toUse.MinValue == null || toUse.MaxValue == null || toUse.Interval == null) { band = new ColumnBand(toUse.BandName); } else { throw new ArgumentOutOfRangeException($"Band: {toUse.BandName} is not handled or is not defined properly."); } existingBands.Add(band.BandName, band); return(band); }
public SubSubCountryBand(BandDefinition definition) : base(definition.BandName) { }
public void AddBandDefinition(BandDefinition definition) { this.fieldObservations.Add(definition.BandName); }
internal void AddBandDefinition(BandDefinition toUse) { throw new NotImplementedException(); }
public UDRBand(BandDefinition definition, UDRList udrList) : base(definition.BandingGroup) { this.udrList = udrList ?? throw new ArgumentNullException("udrList"); }