コード例 #1
0
 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);
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
ファイル: QueueProcessor.cs プロジェクト: jonathansiqueira/GP
 public QueueProcessor(
     IQueue queue,
     INotifier notifier,
     IProductAnalyticsAPIClient productAnalyticsAPIClient,
     ICache persister,
     IUDRData udrData,
     HttpClient httpClient,
     string bearerToken,
     ISlackAPI slack,
     IHeadtoHeadAPIClient headToHeadAPIClient
     )
 {
     this.queue    = queue ?? throw new ArgumentNullException("queue");
     this.notifier = notifier ?? throw new ArgumentNullException("notifier");;
     this.productAnalyticsAPIClient = productAnalyticsAPIClient ?? throw new ArgumentNullException("productAnalyticsAPIClient");
     this.persister           = persister ?? throw new ArgumentNullException("persister");
     this.udrData             = udrData ?? throw new ArgumentNullException("udrData");
     this.bearerToken         = bearerToken ?? throw new ArgumentNullException("bearerToken");
     this.httpClient          = httpClient ?? throw new ArgumentNullException("httpClient");
     this.bearerToken         = bearerToken;
     this.slack               = slack ?? throw new ArgumentNullException("slack");
     this.headToHeadAPIClient = headToHeadAPIClient ?? throw new ArgumentNullException("headToHeadAPIClient");
 }
コード例 #4
0
ファイル: Engine.cs プロジェクト: jonathansiqueira/GP
 public Engine(
     IQueue queue,
     INotifier notifier,
     IProductAnalyticsAPIClient productAnalyticsAPIClient,
     ICache persister,
     IUDRData udrData,
     IHttpClientFactory httpClientFactory,
     IOAuthClient oauthClient,
     IEncryptedEnvVariable decryptVariable,
     ISlackAPI slack,
     IHeadtoHeadAPIClient headToHeadAPIClient
     )
 {
     this.queue    = queue ?? throw new ArgumentNullException("queue");
     this.notifier = notifier ?? throw new ArgumentNullException("notifier");
     this.productAnalyticsAPIClient = productAnalyticsAPIClient ?? throw new ArgumentNullException("productAnalyticsAPIClient");
     this.persister           = persister ?? throw new ArgumentNullException("persister");
     this.udrData             = udrData ?? throw new ArgumentNullException("udrData");
     this.httpClientFactory   = httpClientFactory ?? throw new ArgumentNullException("httpClientFactory");
     this.oauthClient         = oauthClient ?? throw new ArgumentNullException("oauthClient");
     this.decryptVariable     = decryptVariable ?? throw new ArgumentNullException("decryptVariable");
     this.slack               = slack ?? throw new ArgumentNullException("slack");
     this.headToHeadAPIClient = headToHeadAPIClient ?? throw new ArgumentNullException("headToHeadAPIClient");
 }
コード例 #5
0
        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);
        }