예제 #1
0
 /// <summary>
 /// Get figure by percolate delegate
 /// </summary>
 /// <param name="chessBoard">chessboard</param>
 /// <param name="percolator">percolator delegate</param>
 /// <returns>result figure</returns>
 public static Figure GetFigureByPercolate(this ChessBoard chessBoard, Percolator <Figure, bool> percolator)
 {
     foreach (var figure in chessBoard)
     {
         if (percolator(figure))
         {
             return(figure);
         }
     }
     return(default);
예제 #2
0
        public int RunCount(bool clearQueryContents = true)
        {
            var lator   = new Percolator <T>(_axisGroups, _components);
            var command = lator.ScoopCommand;

            if (clearQueryContents)
            {
                Clear();
            }
            return(_provider.ExecuteScalar(command, lator._parameter));
        }
예제 #3
0
        public T RunFirstOrDefault(bool clearQueryContents = true)
        {
            var lator   = new Percolator <T>(_axisGroups, _components);
            var command = lator.ScoopCommand;

            if (clearQueryContents)
            {
                Clear();
            }
            return(_provider.GetFirstOrDefault <T>(command, lator._parameter));
        }
예제 #4
0
        public DataTable ExecuteDataTable(bool clearQueryContents = true)
        {
            var lator   = new Percolator <T>(this._axisGroups, this._components);
            var command = lator.MdxCommand;

            if (clearQueryContents)
            {
                this.Clear();
            }

            return(this._provider.GetDataTable(command));
        }
예제 #5
0
        public IEnumerable <TResult> Percolate <TResult>(bool clearQueryContents = true) where TResult : new()
        {
            var lator   = new Percolator <TResult>(_axisGroups, _components);
            var command = lator.ScoopCommand;
            //var cellSet = this._provider.GetCellSet(command);
            var reader = _provider.GetReader(command);

            if (clearQueryContents)
            {
                Clear();
            }

            var mapper = new Mapperlator <TResult>(reader);

            return(mapper);
        }
예제 #6
0
        /// <summary>
        /// The magic word. Executes this cube's objects in an MDX query against the analysis services, and maps the results to the type applied to the generic parameter.
        /// </summary>
        /// <typeparam name="T_MapTo">The type to map the results of the query to.</typeparam>
        /// <param name="clearQueryContents">Optional boolean to indicate whether to clear this object's query objects after the query is executed.</param>
        /// <returns>An IEnumerable of the type specified.</returns>
        public IEnumerable <T_MapTo> Percolate <T_MapTo>(bool clearQueryContents = true) where T_MapTo : new()
        {
            var lator   = new Percolator <T>(this._axisGroups, this._components);
            var command = lator.MdxCommand;
            ////var cellSet = this._provider.GetCellSet(command);
            var reader = this._provider.GetReader(command);

            if (clearQueryContents)
            {
                this.Clear();
            }

            var mapper = new Mapperlator <T_MapTo>(reader);

            return(mapper);
        }
        public void GivenIHaveAPeroclatorWithADimensionOf(string graphManagerTypeName, int dimension)
        {
            //HACK: may want to improve on this later, string to type mapping is messy
            switch (graphManagerTypeName)
            {
            case "QuickFindGraphManager":
                _peroclator = new Percolator(dimension, (n) => new QuickFindGraphManager(n));
                break;

            case "QuickWeigthedUnionGraphManager":
                _peroclator = new Percolator(dimension, (n) => new QuickWeightedUnionGraphManager(n));
                break;

            default:
                throw new Exception("Graph Manager Type Unknown, cannot create");
            }
            _dimension = dimension;
        }
예제 #8
0
        public HttpResponseMessage CaptureProgress()
        {
            var perco    = new Percolator(ApplicationContext.ApplicationCache.RuntimeCache);
            var progress = perco.CaptureProgress();

            // progres.DateTime is 'now' as local datetime
            // round to next 12hrs
            // so will be 12:00:00 or 00:00:00, server time
            // (everything we do is server-local time based)

            var captureDateTime = progress.DateTime.Date;

            captureDateTime = progress.DateTime.Hour < 12
                ? captureDateTime.AddHours(12)
                : captureDateTime.AddDays(1);
            progress.DateTime = captureDateTime;

            SprintProgress.Save(progress);

            return(Request.CreateResponse(HttpStatusCode.OK, captureDateTime.ToUniversalTime()));
        }
예제 #9
0
        public override bool PerformRun()
        {
            var perco    = new Percolator(ApplicationContext.Current.ApplicationCache.RuntimeCache);
            var progress = perco.CaptureProgress(); // fixme - this should be async

            // progres.DateTime is 'now' as local datetime
            // round to next 12hrs
            // so will be 12:00:00 or 00:00:00, server time
            // (everything we do is server-local time based)

            var captureDateTime = progress.DateTime.Date;

            captureDateTime = progress.DateTime.Hour < 12
                ? captureDateTime.AddHours(12)
                : captureDateTime.AddDays(1);
            progress.DateTime = captureDateTime;

            SprintProgress.Save(progress);

            Logger.Info <CaptureProgress>($"Capture Progress {captureDateTime}.");

            // repeat
            return(true);
        }