Beispiel #1
0
        private async Task <ObjectResult <T> > GetResultsAsync(
            MergeOption?forMergeOption, IDbExecutionStrategy executionStrategy, CancellationToken cancellationToken)
        {
            var mergeOption = forMergeOption.HasValue
                                  ? forMergeOption.Value
                                  : QueryState.EffectiveMergeOption;

            if (mergeOption != MergeOption.NoTracking)
            {
                QueryState.ObjectContext.AsyncMonitor.Enter();
            }

            try
            {
                return(await executionStrategy.ExecuteAsync(
                           () => QueryState.ObjectContext.ExecuteInTransactionAsync(
                               () => QueryState.GetExecutionPlan(forMergeOption)
                               .ExecuteAsync <T>(QueryState.ObjectContext, QueryState.Parameters, cancellationToken),
                               executionStrategy,
                               /*startLocalTransaction:*/ false, /*releaseConnectionOnSuccess:*/ !QueryState.EffectiveStreamingBehavior,
                               cancellationToken),
                           cancellationToken).WithCurrentCulture());
            }
            finally
            {
                if (mergeOption != MergeOption.NoTracking)
                {
                    QueryState.ObjectContext.AsyncMonitor.Exit();
                }
            }
        }
Beispiel #2
0
            public override async ValueTask <bool> MoveNextAsync(ITrace trace)
            {
                this.cancellationToken.ThrowIfCancellationRequested();

                if (trace == null)
                {
                    throw new ArgumentNullException(nameof(trace));
                }

                if (!await this.inputStage.MoveNextAsync(trace))
                {
                    this.Current = default;
                    return(false);
                }

                TryCatch <QueryPage> tryGetSourcePage = this.inputStage.Current;

                if (tryGetSourcePage.Failed)
                {
                    this.Current = tryGetSourcePage;
                    return(true);
                }

                QueryPage sourcePage = tryGetSourcePage.Result;

                // Skip the documents but keep all the other headers
                IReadOnlyList <CosmosElement> documentsAfterSkip = sourcePage.Documents.Skip(this.skipCount).ToList();

                int numberOfDocumentsSkipped = sourcePage.Documents.Count() - documentsAfterSkip.Count();

                this.skipCount -= numberOfDocumentsSkipped;

                QueryState state;

                if (sourcePage.State == null)
                {
                    state = default;
                }
                else
                {
                    OffsetContinuationToken offsetContinuationToken = new OffsetContinuationToken(
                        offset: this.skipCount,
                        sourceToken: sourcePage.State.Value);

                    state = new QueryState(OffsetContinuationToken.ToCosmosElement(offsetContinuationToken));
                }

                QueryPage queryPage = new QueryPage(
                    documents: documentsAfterSkip,
                    requestCharge: sourcePage.RequestCharge,
                    activityId: sourcePage.ActivityId,
                    responseLengthInBytes: sourcePage.ResponseLengthInBytes,
                    cosmosQueryExecutionInfo: sourcePage.CosmosQueryExecutionInfo,
                    disallowContinuationTokenMessage: sourcePage.DisallowContinuationTokenMessage,
                    state: state);

                this.Current = TryCatch <QueryPage> .FromResult(queryPage);

                return(true);
            }
Beispiel #3
0
            public override async ValueTask <bool> MoveNextAsync(ITrace trace)
            {
                if (trace == null)
                {
                    throw new ArgumentNullException(nameof(trace));
                }

                if (!await this.inputStage.MoveNextAsync(trace))
                {
                    this.Current = default;
                    return(false);
                }

                TryCatch <QueryPage> tryGetSourcePage = this.inputStage.Current;

                if (tryGetSourcePage.Failed)
                {
                    this.Current = tryGetSourcePage;
                    return(true);
                }

                QueryPage sourcePage = tryGetSourcePage.Result;

                List <CosmosElement> distinctResults = new List <CosmosElement>();

                foreach (CosmosElement document in sourcePage.Documents)
                {
                    if (this.distinctMap.Add(document, out UInt128 _))
                    {
                        distinctResults.Add(document);
                    }
                }

                QueryState queryState;

                if (sourcePage.State != null)
                {
                    DistinctContinuationToken distinctContinuationToken = new DistinctContinuationToken(
                        sourceToken: sourcePage.State.Value,
                        distinctMapToken: this.distinctMap.GetCosmosElementContinuationToken());
                    queryState = new QueryState(DistinctContinuationToken.ToCosmosElement(distinctContinuationToken));
                }
                else
                {
                    queryState = null;
                }

                QueryPage queryPage = new QueryPage(
                    documents: distinctResults,
                    requestCharge: sourcePage.RequestCharge,
                    activityId: sourcePage.ActivityId,
                    responseLengthInBytes: sourcePage.ResponseLengthInBytes,
                    cosmosQueryExecutionInfo: sourcePage.CosmosQueryExecutionInfo,
                    disallowContinuationTokenMessage: ComputeDistinctQueryPipelineStage.UseTryGetContinuationTokenMessage,
                    state: queryState);

                this.Current = TryCatch <QueryPage> .FromResult(queryPage);

                return(true);
            }
            public override async Task <TryCatch <QueryPage> > MonadicQueryAsync(
                SqlQuerySpec sqlQuerySpec,
                FeedRangeState <QueryState> feedRangeState,
                QueryPaginationOptions queryPaginationOptions,
                ITrace trace,
                CancellationToken cancellationToken)
            {
                await this.semaphore.WaitAsync(this.cancellationToken);

                int count = ParseQueryState(feedRangeState.State);

                QueryState continuationToken = count < this.continuationCount ? CreateQueryState(++count) : default;
                QueryPage  page = new QueryPage(
                    documents: new List <CosmosElement> {
                },
                    requestCharge: 3.0,
                    activityId: "E7980B1F-436E-44DF-B7A5-655C56D38648",
                    responseLengthInBytes: 48,
                    cosmosQueryExecutionInfo: new Lazy <CosmosQueryExecutionInfo>(() => new CosmosQueryExecutionInfo(false, false)),
                    disallowContinuationTokenMessage: null,
                    additionalHeaders: null,
                    state: continuationToken);

                return(continuationToken != default ?
                       TryCatch <QueryPage> .FromResult(page) :
                       await base.MonadicQueryAsync(
                           sqlQuerySpec,
                           new FeedRangeState <QueryState>(feedRangeState.FeedRange, default),
                           queryPaginationOptions,
                           trace,
                           cancellationToken));
            }
Beispiel #5
0
 // main
 private static void main_40_0(DataContext _datacontext, LocalVariables _parameters)
 {
     ExtractionListBase <Result> GoogleResults = (ExtractionListBase <Result>)_parameters["GoogleResults"];
     QueryState  state       = (QueryState)_parameters["state"];
     string      searchQuery = (string)_parameters["searchQuery"];
     ScopesStack __l         = new ScopesStack(_datacontext, null);
     {
         {
             __l.Push(__l.context.OpenContextDynamic("open", new object[] { (("http://www.google.com/search?hl=en&q=") + (urlencode_20_0(searchQuery))) }), null);
             ActionItem.AddAction(new ActionItem.ExtractionMethod[] { googlepage_50_0 }, __l.context, new LocalVariables()
             {
                 { "items", GoogleResults }
             }.SetCannotAddAction(new Dictionary <string, bool>()
             {
                 { "items", _parameters.CannotAddActionForVariable("GoogleResults") }
             }));
             ActionItem.AddAction(new ActionItem.ExtractionMethod[] { searchinfo_65_0 }, __l.context, new LocalVariables()
             {
                 { "state", state }
             }.SetCannotAddAction(new Dictionary <string, bool>()
             {
                 { "state", _parameters.CannotAddActionForVariable("state") }
             }));
             __l.Pop();
         }
     }
 }
        public void Hide()
        {
            if (unityText != null)
            {
                if (queryButtonStyle == QueryButtonStyle.kQButtonsCentral)
                {
                }
                else
                {
                    unityText.StopRender();
                }
            }

            state = QueryState.e_Inactive;
            dimZob.Hide();
            backdrop.Hide();
            if (useActualText)
            {
                for (int i = 0; i < (int)Enum.kMaxFunnyWordsInQuery; i++)
                {
                    (funnyWord[i]).Hide();
                }
            }
            else
            {
                text.Hide();
            }

            for (int i = 0; i < (int)QueryButton.kNumButtonsOnQuery; i++)
            {
                (button[i]).Hide();
            }

            (SoundEngine.Instance()).PlayFinchSound((int)Audio.Enum1.kSoundEffect_Swish);
        }
Beispiel #7
0
 private Session ConfigureSession(QueryState<EventBase> query)
 {
     var session = new ScriptEngine().CreateSession(query);
     session.AddReference(GetType().Assembly);
     session.AddReference(typeof (QueryState<EventBase>).Assembly);
     return session;
 }
Beispiel #8
0
        // <summary>
        // Retrieves the LINQ expression that backs this ObjectQuery for external consumption.
        // It is important that the work to wrap the expression in an appropriate MergeAs call
        // takes place in this method and NOT in ObjectQueryState.TryGetExpression which allows
        // the unmodified expression (that does not include the MergeOption-preserving MergeAs call)
        // to be retrieved and processed by the ELinq ExpressionConverter.
        // </summary>
        // <returns> The LINQ expression for this ObjectQuery, wrapped in a MergeOption-preserving call to the MergeAs method if the ObjectQuery.MergeOption property has been set. </returns>
        internal override Expression GetExpression()
        {
            // If this ObjectQuery is not backed by a LINQ Expression (it is an ESQL query),
            // then create a ConstantExpression that uses this ObjectQuery as its value.
            Expression retExpr;

            if (!QueryState.TryGetExpression(out retExpr))
            {
                retExpr = Expression.Constant(this);
            }

            if (QueryState.UserSpecifiedMergeOption.HasValue)
            {
                retExpr = TypeSystem.EnsureType(retExpr, typeof(ObjectQuery <T>));
                retExpr = Expression.Call(retExpr, MergeAsMethod, Expression.Constant(QueryState.UserSpecifiedMergeOption.Value));
            }

            if (null != QueryState.Span)
            {
                retExpr = TypeSystem.EnsureType(retExpr, typeof(ObjectQuery <T>));
                retExpr = Expression.Call(retExpr, IncludeSpanMethod, Expression.Constant(QueryState.Span));
            }

            return(retExpr);
        }
Beispiel #9
0
        public virtual T Run()
        {
            if (!Client.IsConnected())
            {
                Client.Logger.Info("Client not connected, Connect.");
                Client.Connect();
            }

            Sshcmd = Client.Client.CreateCommand(CmdString);


            using (Sshcmd)
            {
                Client.Logger.Info($"Running command : {CmdString}.");
                _resultStr = Sshcmd.Execute();


                if (!string.IsNullOrEmpty(Sshcmd.Error))
                {
                    Client.Logger.Info($"Running command ({CmdString}) Error : {Sshcmd.Error}.");
                }

                Client.Logger.Info($"Return Value from command : {_resultStr}.");
                _state = QueryState.CommandSent;
            }

            var result = PaseResult(_resultStr);

            _state = QueryState.ResultParsed;
            //TODO Doods : QueryResult
            var queryResult = ToQueryResult(result);

            return(result);
        }
Beispiel #10
0
        private void UpdateFromState(QueryState state)
        {
            Query = state.Query;

            IsSpatialQuery = state.IsSpatialQuery;
            SpatialQuery.UpdateFromState(state);

            UseTransformer            = state.UseTransformer;
            DefaultOperator           = state.DefaultOperator;
            SelectedTransformer.Value = state.Transformer;
            SkipTransformResults      = state.SkipTransform;
            ShowFields  = state.ShowFields;
            ShowEntries = state.ShowEntries;


            SortBy.Clear();

            foreach (var sortOption in state.SortOptions)
            {
                if (SortByOptions.Contains(sortOption))
                {
                    SortBy.Add(new StringRef()
                    {
                        Value = sortOption
                    });
                }
            }
        }
 public static void QueryStateIs(QueryState state, params Proxy[] proxies)
 {
     foreach (var proxy in proxies)
     {
         Assert.AreEqual(state, proxy.queryState);
     }
 }
Beispiel #12
0
        /// <summary>
        ///     Retrieves the LINQ expression that backs this ObjectQuery for external consumption.
        ///     It is important that the work to wrap the expression in an appropriate MergeAs call
        ///     takes place in this method and NOT in ObjectQueryState.TryGetExpression which allows
        ///     the unmodified expression (that does not include the MergeOption-preserving MergeAs call)
        ///     to be retrieved and processed by the ELinq ExpressionConverter.
        /// </summary>
        /// <returns> The LINQ expression for this ObjectQuery, wrapped in a MergeOption-preserving call to the MergeAs method if the ObjectQuery.MergeOption property has been set. </returns>
        internal override Expression GetExpression()
        {
            // If this ObjectQuery is not backed by a LINQ Expression (it is an ESQL query),
            // then create a ConstantExpression that uses this ObjectQuery as its value.
            Expression retExpr;

            if (!QueryState.TryGetExpression(out retExpr))
            {
                retExpr = Expression.Constant(this);
            }

            var objectQueryType = typeof(ObjectQuery <T>);

            if (QueryState.UserSpecifiedMergeOption.HasValue)
            {
                var mergeAsMethod = objectQueryType.GetMethod("MergeAs", BindingFlags.Instance | BindingFlags.NonPublic);
                Debug.Assert(mergeAsMethod != null, "Could not retrieve ObjectQuery<T>.MergeAs method using reflection?");
                retExpr = TypeSystem.EnsureType(retExpr, objectQueryType);
                retExpr = Expression.Call(retExpr, mergeAsMethod, Expression.Constant(QueryState.UserSpecifiedMergeOption.Value));
            }

            if (null != QueryState.Span)
            {
                var includeSpanMethod = objectQueryType.GetMethod("IncludeSpan", BindingFlags.Instance | BindingFlags.NonPublic);
                Debug.Assert(includeSpanMethod != null, "Could not retrieve ObjectQuery<T>.IncludeSpan method using reflection?");
                retExpr = TypeSystem.EnsureType(retExpr, objectQueryType);
                retExpr = Expression.Call(retExpr, includeSpanMethod, Expression.Constant(QueryState.Span));
            }

            return(retExpr);
        }
Beispiel #13
0
        public BasicQueryInfo(
            QueryId queryId,
            SessionRepresentation session,
            QueryState state,
            MemoryPoolId memoryPool,
            bool scheduled,
            Uri self,
            string query,
            BasicQueryStats queryStats,
            ErrorType errorType,
            ErrorCode errorCode
            )
        {
            ParameterCheck.NotNullOrEmpty(query, "query");

            this.QueryId    = queryId ?? throw new ArgumentNullException("queryId");
            this.Session    = session ?? throw new ArgumentNullException("session");
            this.State      = state;
            this.MemoryPool = memoryPool;
            this.ErrorType  = errorType;
            this.ErrorCode  = errorCode;
            this.Scheduled  = scheduled;
            this.Self       = self ?? throw new ArgumentNullException("self");
            this.Query      = query;
            this.QueryStats = queryStats ?? throw new ArgumentNullException("queryStats");
        }
Beispiel #14
0
        private async Task <ObjectResult <T> > GetResultsAsync(
            MergeOption?forMergeOption, IExecutionStrategy executionStrategy, CancellationToken cancellationToken)
        {
            var mergeOption = forMergeOption.HasValue
                                  ? forMergeOption.Value
                                  : QueryState.EffectiveMergeOption;

            if (mergeOption != MergeOption.NoTracking)
            {
                QueryState.ObjectContext.AsyncMonitor.Enter();
            }

            try
            {
                return(await executionStrategy.ExecuteAsync(
                           () => QueryState.ObjectContext.ExecuteInTransactionAsync(
                               () => QueryState.GetExecutionPlan(forMergeOption)
                               .ExecuteAsync <T>(QueryState.ObjectContext, QueryState.Parameters, cancellationToken),
                               /*throwOnExistingTransaction:*/ executionStrategy.RetriesOnFailure,
                               /*startLocalTransaction:*/ false, /*releaseConnectionOnSuccess:*/ !QueryState.EffectiveStreamingBehaviour,
                               cancellationToken),
                           cancellationToken).ConfigureAwait(continueOnCapturedContext: false));
            }
            finally
            {
                if (mergeOption != MergeOption.NoTracking)
                {
                    QueryState.ObjectContext.AsyncMonitor.Exit();
                }
            }
        }
Beispiel #15
0
        /// <summary>
        /// Shows and hides child objects based on a parent's tracking of AR Data
        /// </summary>
        /// <param name="newState">The current state of the parent object</param>
        /// <param name="queryResult">Query data associated with the state change</param>
        /// <param name="objectsToActivate">A list containing objects that should be activated</param>
        /// <param name="objectsToDeactivate">A list containing objects which should be set to inactive</param>
        void IMatchVisibilityHandler.FilterVisibleObjects(QueryState newState, QueryResult queryResult, List <GameObject> objectsToActivate, List <GameObject> objectsToDeactivate)
        {
            if (!this) // object may have been destroyed
            {
                return;
            }

            switch (newState)
            {
            case QueryState.Acquiring:
                foreach (Transform child in transform)
                {
                    objectsToActivate.Add(child.gameObject);
                }

                break;

            case QueryState.Resuming:
            case QueryState.Unavailable:
            case QueryState.Unknown:
                foreach (Transform child in transform)
                {
                    objectsToDeactivate.Add(child.gameObject);
                }

                break;
            }
        }
Beispiel #16
0
        public QueryInfo(
            QueryId queryId,
            SessionRepresentation session,
            QueryState state,
            MemoryPoolId memoryPool,
            bool scheduled,
            Uri self,
            IEnumerable <string> fieldNames,
            string query,
            QueryStats queryStats,
            string setCatalog,
            string setSchema,
            IDictionary <string, string> setSessionProperties,
            HashSet <string> resetSessionProperties,
            IDictionary <string, string> addedPreparedStatements,
            HashSet <string> deallocatedPreparedStatemetns,
            TransactionId startedTransactionId,
            bool clearTransactionId,
            string updateType,
            StageInfo outputStage,
            FailureInfo failureInfo,
            ErrorCode errorCode,
            HashSet <Input> inputs,
            Output output,
            bool completeInfo,
            string resourceGroupName
            )
        {
            if (String.IsNullOrEmpty(query))
            {
                throw new ArgumentNullException("query");
            }

            this.QueryId                       = queryId ?? throw new ArgumentNullException("queryId");
            this.Session                       = session ?? throw new ArgumentNullException("session");
            this.State                         = state;
            this.MemoryPool                    = memoryPool ?? throw new ArgumentNullException("memoryPool");
            this.Scheduled                     = scheduled;
            this.Self                          = self ?? throw new ArgumentNullException("self");
            this.FieldNames                    = fieldNames ?? throw new ArgumentNullException("fieldNames");
            this.Query                         = query;
            this.QueryStats                    = queryStats ?? throw new ArgumentNullException("queryStats");
            this.SetCatalog                    = setCatalog;
            this.SetSchema                     = setSchema;
            this.SetSessionProperties          = setSessionProperties ?? throw new ArgumentNullException("setSessionProperties");
            this.ResetSessionProperties        = resetSessionProperties ?? throw new ArgumentNullException("resetSessionProperties");
            this.AddedPreparedStatements       = addedPreparedStatements ?? throw new ArgumentNullException("addedPreparedStatements");
            this.DeallocatedPreparedStatements = deallocatedPreparedStatemetns; // ?? throw new ArgumentNullException("deallocatedPreparedStatements");
            this.StartedTransactionId          = startedTransactionId;
            this.ClearTransactionId            = clearTransactionId;
            this.UpdateType                    = updateType;
            this.OutputStage                   = outputStage;
            this.FailureInfo                   = failureInfo;
            this.ErrorType                     = errorCode == null ? ErrorType.NONE : errorCode.Type;
            this.ErrorCode                     = errorCode;
            this.Inputs                        = inputs ?? throw new ArgumentNullException("inputs");
            this.Output                        = output;
            this.CompleteInfo                  = completeInfo;
            this.ResourceGroupName             = resourceGroupName;
        }
Beispiel #17
0
            public override async ValueTask <bool> MoveNextAsync()
            {
                this.cancellationToken.ThrowIfCancellationRequested();

                if (!await this.inputStage.MoveNextAsync())
                {
                    this.Current = default;
                    return(false);
                }

                TryCatch <QueryPage> tryGetSourcePage = this.inputStage.Current;

                if (tryGetSourcePage.Failed)
                {
                    this.Current = tryGetSourcePage;
                    return(true);
                }

                QueryPage sourcePage = tryGetSourcePage.Result;

                List <CosmosElement> takedDocuments = sourcePage.Documents.Take(this.takeCount).ToList();

                this.takeCount -= takedDocuments.Count;

                QueryState state;

                if ((sourcePage.State != null) && (sourcePage.DisallowContinuationTokenMessage == null))
                {
                    string updatedContinuationToken = this.takeEnum switch
                    {
                        TakeEnum.Limit => new LimitContinuationToken(
                            limit: this.takeCount,
                            sourceToken: sourcePage.State?.Value.ToString()).ToString(),
                        TakeEnum.Top => new TopContinuationToken(
                            top: this.takeCount,
                            sourceToken: sourcePage.State?.Value.ToString()).ToString(),
                        _ => throw new ArgumentOutOfRangeException($"Unknown {nameof(TakeEnum)}: {this.takeEnum}."),
                    };

                    state = new QueryState(CosmosElement.Parse(updatedContinuationToken));
                }
                else
                {
                    state = null;
                }

                QueryPage queryPage = new QueryPage(
                    documents: takedDocuments,
                    requestCharge: sourcePage.RequestCharge,
                    activityId: sourcePage.ActivityId,
                    responseLengthInBytes: sourcePage.ResponseLengthInBytes,
                    cosmosQueryExecutionInfo: sourcePage.CosmosQueryExecutionInfo,
                    disallowContinuationTokenMessage: sourcePage.DisallowContinuationTokenMessage,
                    state: state);

                this.Current = TryCatch <QueryPage> .FromResult(queryPage);

                return(true);
            }
Beispiel #18
0
        //[HttpPost]
        public ActionResult Insert__(int ID, DateTime?DateFrom, DateTime?DateTo)
        //public ActionResult Insert_(TableState ts_)
        {
            QueryState ts = sl.tableList.Where(s => s.ID == ID).FirstOrDefault();

            return(RedirectToAction("Insert", sl));
            // return View("Insert", sl.tableEnum);
        }
Beispiel #19
0
        public NodeGraphManager()
        {
            Connections          = new List <PinConnection>();
            ExecutionConnections = new List <Tuple <GraphNode, int, GraphNode> >();
            QueryState           = new QueryState();

            nodeNetwork = new List <GraphNode>();
        }
Beispiel #20
0
            public override async ValueTask <bool> MoveNextAsync(ITrace trace)
            {
                this.cancellationToken.ThrowIfCancellationRequested();

                if (trace == null)
                {
                    throw new ArgumentNullException(nameof(trace));
                }

                if (this.ReturnedFinalPage || !await this.inputStage.MoveNextAsync(trace))
                {
                    this.Current   = default;
                    this.takeCount = 0;
                    return(false);
                }

                TryCatch <QueryPage> tryGetSourcePage = this.inputStage.Current;

                if (tryGetSourcePage.Failed)
                {
                    this.Current = tryGetSourcePage;
                    return(true);
                }

                QueryPage sourcePage = tryGetSourcePage.Result;

                List <CosmosElement> takedDocuments = sourcePage.Documents.Take(this.takeCount).ToList();

                this.takeCount -= takedDocuments.Count;

                QueryState queryState;

                if (sourcePage.State != null)
                {
                    TakeContinuationToken takeContinuationToken = new TakeContinuationToken(
                        takeCount: this.takeCount,
                        sourceToken: sourcePage.State.Value);
                    queryState = new QueryState(TakeContinuationToken.ToCosmosElement(takeContinuationToken));
                }
                else
                {
                    queryState = default;
                }

                QueryPage queryPage = new QueryPage(
                    documents: takedDocuments,
                    requestCharge: sourcePage.RequestCharge,
                    activityId: sourcePage.ActivityId,
                    responseLengthInBytes: sourcePage.ResponseLengthInBytes,
                    cosmosQueryExecutionInfo: sourcePage.CosmosQueryExecutionInfo,
                    disallowContinuationTokenMessage: sourcePage.DisallowContinuationTokenMessage,
                    additionalHeaders: sourcePage.AdditionalHeaders,
                    state: queryState);

                this.Current = TryCatch <QueryPage> .FromResult(queryPage);

                return(true);
            }
 public static void QueryStateIs(QueryState state, params ProxyGroup[] groups)
 {
     foreach (var group in groups)
     {
         Assert.AreEqual(state, group.queryState);
         group.GetChildList(k_TempChildren);
         QueryStateIs(state, k_TempChildren.ToArray());
     }
 }
 public BufferedEnumerable(IQueryable <TElement> source, int bufferSize)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     _state      = new QueryState <TElement>(bufferSize);
     _source     = source;
     _bufferSize = bufferSize;
 }
        public void ShowForUIAlert()
        {
            if (unityText != null)
            {
                unityText.Show();
            }

            if (queryButtonStyle == QueryButtonStyle.kQButtonsCentral)
            {
                for (int i = 0; i < numButtons; i++)
                {
                    (buttonText[i]).FitToWidth(170.0f);
                    (buttonText[i]).Show();
                }
            }

            state        = QueryState.e_Active;
            chosenButton = (QueryButton)(-1);
            dimZob.Show();
            backdrop.Show();
            if (useActualText)
            {
                this.ShowFunnyWords();
            }
            else
            {
                text.Show();
            }

            float timeTweenButtons = 0.04f;
            float maxWaitToShow    = (float)numButtons * timeTweenButtons;

            for (int i = 0; i < (int)QueryButton.kNumButtonsOnQuery; i++)
            {
                (button[i]).Show();
                if (queryButtonStyle == QueryButtonStyle.kQButtonsEdges)
                {
                    ((button[i]).zobject).QueueAction(ZobjectAction.nThrobLooping);
                    ((button[i]).zobject).SetThrobSize(0.06f);
                    ((button[i]).zobject).SetThrobTime(0.5f);
                }
                else if (queryButtonStyle == QueryButtonStyle.kQButtonsCentral)
                {
                    button[i].zobject.SetWaitToShow(maxWaitToShow - ((float)i * timeTweenButtons));
                }
            }

            for (int i = 0; i < (int)Enum.kMaxFunnyWordsInQuery; i++)
            {
                if (funnyWord[i] != null)
                {
                    (funnyWord[i]).Show();
                }
            }
        }
Beispiel #24
0
        public void RememberHistory()
        {
            if (string.IsNullOrEmpty(IndexName))
            {
                return;
            }

            var state = new QueryState(IndexName, Query, SortBy.Select(r => r.Value), IsSpatialQuery, Latitude, Longitude, Radius);

            PerDatabaseState.QueryHistoryManager.StoreQuery(state);
        }
Beispiel #25
0
        public void RememberHistory()
        {
            if (string.IsNullOrEmpty(IndexName))
            {
                return;
            }

            var state = new QueryState(this);

            PerDatabaseState.QueryHistoryManager.StoreQuery(state);
        }
Beispiel #26
0
 // searchinfo
 private static void searchinfo_65_0(DataContext _datacontext, LocalVariables _parameters)
 {
     QueryState  state = (QueryState)_parameters["state"];
     ScopesStack __l   = new ScopesStack(_datacontext, null);
     {
         foreach (var __fe67_4 in ForeachMethods.match(__l.context, "<p id=resultStats>&nbsp;~@strstat@~&nbsp;</div>"))
         {
             __l.Push(null, __fe67_4);
             state.info = (__l["strstat"].ToString());                    __l.Pop();
         }
     }
 }
            private static int ParseQueryState(QueryState state)
            {
                if (state == default)
                {
                    return(0);
                }

                CosmosObject parsedContinuationToken = CosmosObject.Parse(((CosmosString)state.Value).Value);
                int          continuationCount       = (int)Number64.ToLong(((CosmosNumber64)parsedContinuationToken["continuationCount"]).Value);

                return(continuationCount);
            }
Beispiel #28
0
        public override ValueTask <bool> MoveNextAsync()
        {
            if (this.pageIndex == this.pages.Count)
            {
                this.Current = default;
                return(new ValueTask <bool>(false));
            }

            IReadOnlyList <CosmosElement> documents = this.pages[this.pageIndex++];
            QueryState state = (this.pageIndex == this.pages.Count) ? null : new QueryState(CosmosString.Create(this.pageIndex.ToString()));
            QueryPage  page  = new QueryPage(
                documents: documents,
                requestCharge: default,
Beispiel #29
0
        /// <summary>
        ///     Create the command, execute it at the client level and parse the result.
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public virtual async Task <T> RunAsync(CancellationToken token)
        {
            _resultStr = await SendCommandAsync(token);

            _state = QueryState.CommandSent;
            var result = await PaseResultAsync(token);

            _state = QueryState.ResultParsed;
            //TODO Doods : QueryResult
            var queryResult = ToQueryResult(result);

            return(result);
        }
        public override ValueTask <bool> MoveNextAsync(ITrace trace)
        {
            if (this.PageIndex == this.pages.Count)
            {
                this.Current = default;
                return(new ValueTask <bool>(false));
            }

            IReadOnlyList <CosmosElement> documents = this.pages[(int)this.PageIndex++];
            QueryState state = this.PageIndex == this.pages.Count ? null : new QueryState(CosmosNumber64.Create(this.PageIndex));
            QueryPage  page  = new QueryPage(
                documents: documents,
                requestCharge: default,
Beispiel #31
0
    private void CreateQueryComplete(object state)
    {
        //Debug.Log( "CreateQueryComplete state=" + state );
        QueryState qrState = state as QueryState;

        // ここで上書きすればいいのか?
        lastSqliteQuery = qrState.Query;

        if (qrState.Callback != null)
        {
            qrState.Callback(qrState.Query, qrState.State);
        }
    }
        internal void GetAll(Action<List<Bookmark>> callback, Failed failed)
        {
            // ask the server for a collection...
            AMX.BookmarkCollection serverItems = this.GetServerTarget();

            // create some state...
            QueryState state = new QueryState();
            state.Query = serverItems.CreateQuery<AMX.Bookmark>("Bookmark");
            state.Success = callback;
            state.Failed = failed;

            // run it, passing in the state object to be unwrapped in the callback handler...
            state.Query.BeginExecute(new AsyncCallback(ServerQueryFinished), state);
        }
Beispiel #33
0
        public void MostBasic_Count_100x()
        {
            // Where type = 1

            var testInterval = new TestInterval();

            var query = new QueryState<EventBase>();

            var session = ConfigureSession(query);
            session.Execute("Filters.Add(@event => @event.Type == 1);");

            int count = 0;
            testInterval.Interval.WhereEach(query.Filters).Count().Subscribe(i => count = i);
            testInterval.Start();
            count.Should().Be(testInterval.ExpectedCount / testInterval.NumberOfTypes);
        }
 public void OnExecuteQueryEvent(QueryState queryState)
 {
     if (ExecuteQueryEvent != null)
     {
         ExecuteQueryEvent(queryState);
     }
 }
Beispiel #35
0
 public QueryException(QueryState state)
     : base()
 {
     this.State = state;
 }
        public override void LoadContent()
        {
            if (m_glare == null)
                m_glare = new MyLightGlare(this);

            m_glare.LoadContent();
            
            SpotQuery = MyOcclusionQueries.Get();
            SpotQueryState = QueryState.IssueOcc;
            
            base.LoadContent();
        }
Beispiel #37
0
        private void UpdateGpuOcclusion(float querySize)
        {
            m_occlusionBox.Min = this.Position - new Vector3D(querySize);
            m_occlusionBox.Max = this.Position + new Vector3D(querySize);

            switch (m_state)
            {
                case QueryState.IssueOcc:
                    IssueOcclusionQuery(m_occlusionQuery, true);
                    m_state = QueryState.IssueMeasure;
                    break;

                case QueryState.IssueMeasure:
                    IssueOcclusionQuery(m_measurementQuery, false);
                    m_state = QueryState.WaitOcc;
                    break;

                case QueryState.WaitOcc:
                    m_state = QueryState.WaitMeasure;
                    break;

                case QueryState.WaitMeasure:
                    m_state = QueryState.CheckOcc;
                    break;

                case QueryState.CheckOcc:
                    if (m_occlusionQuery.IsComplete)
                    {
                        m_state = QueryState.CheckMeasure;
                    }
                    break;

                case QueryState.CheckMeasure:
                    if (m_measurementQuery.IsComplete)
                    {
                        m_state = QueryState.IssueOcc;
                        m_occlusionRatio = CalcRatio();
                    }
                    break;
            }
        }
Beispiel #38
0
 public static LogMessage ResponseInvalid(QueryState queryState)
 {
     return Create(Resources.LogMessages.ResponseInvalid, new object[] { queryState });
 }
Beispiel #39
0
 // Use this for initialization
 void Start()
 {
     //parent = transform.parent.gameObject;
     //contents = transform.Find("Contents").gameObject;
     pageButtonsContens = transform.Find("PageButtonsContents").gameObject;
     contents = transform.Find("Ranking View").Find("Contents").gameObject;
     if(scrollbarContainer != null)
         scrollbar = scrollbarContainer.GetComponent<Scrollbar>();
     dataManager = DataManager.Instace;
     dataManager.OnHttpRequest += OnHttpRequest;
     queryState = QueryState.All;
     GetTargetIndexInAllRanking(0);
 }
Beispiel #40
0
 public QueryException(QueryState state, string message)
     : base(message)
 {
     this.State = state;
 }
Beispiel #41
0
 public static LogMessage NegativeResponse(QueryState queryState)
 {
     return Create(Resources.LogMessages.NegativeResponse, new object[] { queryState });
 }
Beispiel #42
0
 public void GetTargetIndexInAllRanking(int _pageIndex = 0)
 {
     queryState = QueryState.All;
     dataManager.GetUserAllRankData(rankingViewID, _pageIndex, limitPageSize);
 }
Beispiel #43
0
 public void GetTargetIndexInFriendsRanking(int _pageIndex = 0)
 {
     queryState = QueryState.Friends;
 }
Beispiel #44
0
 public void GetMyPageInAllRanking()
 {
     queryState = QueryState.All;
     dataManager.GetUserAreaRankData(rankingViewID, FB.UserId, limitPageSize);
     //UpdateRankingView();
 }
        private void IssueSpotQuery()
        {
            if (((LightType & LightTypeEnum.Spotlight) > 0) && SpotQuery != null && SpotQueryState == QueryState.IssueOcc)
            {
                BlendState previousBlendState = BlendState.Current; ;
                MyStateObjects.DisabledColorChannels_BlendState.Apply();
               // RasterizerState.CullNone.Apply();
               // DepthStencilState.None.Apply();

                MyEffectOcclusionQueryDraw effectOQ = MyRender.GetEffect(MyEffects.OcclusionQueryDrawMRT) as MyEffectOcclusionQueryDraw;
                effectOQ.SetTechnique(MyEffectOcclusionQueryDraw.Technique.DepthTestEnabled);

                MatrixD spotWorld = SpotWorld;
                spotWorld.Translation = SpotWorld.Translation - MyRenderCamera.Position;
                effectOQ.SetWorldMatrix((Matrix)spotWorld);
                effectOQ.SetViewMatrix(MyRenderCamera.ViewMatrixAtZero);
                effectOQ.SetProjectionMatrix(MyRenderCamera.ProjectionMatrix);

                var depthRenderTarget = MyRender.GetRenderTarget(MyRenderTargets.Depth);
                effectOQ.SetDepthRT(depthRenderTarget);
                effectOQ.SetScale(MyRender.GetScaleForViewport(depthRenderTarget));

                SpotQuery.Begin();

                effectOQ.Begin();

                MyDebugDraw.ModelCone.Render();

                effectOQ.End();

                SpotQuery.End();

                SpotQueryState = QueryState.CheckOcc;

                previousBlendState.Apply();
            }

            if (SpotQueryState == QueryState.WaitOcc)
                SpotQueryState = QueryState.IssueOcc;
        }
 void ViewModel_ExecuteQueryEvent(QueryState state)
 {
     if (state == QueryState.Begin)
     {
         BorderMain.Opacity = 0.5;
         //winWait.Show();
         pbStauts.Visibility = System.Windows.Visibility.Visible;
         #region 三种更新UI的方式 已注
         //三种方式使用主线程更新UI
         //第一种
         //Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
         //{
         //}));
         //第二种
         //new Thread(() =>
         //{
         //    this.Dispatcher.Invoke(new Action(() =>
         //    {
         //        ShowWaitWindow();
         //    }));
         //}).Start();
         //第三种
         //this.Dispatcher.Invoke(new Action(() => { ShowWaitWindow(); }));
         #endregion
     }
     else
     {
         BorderMain.Opacity = 1;
         //winWait.Hide();
         pbStauts.Visibility = System.Windows.Visibility.Hidden;
     }
 }
Beispiel #47
0
 public void GetMyPageInFriendsRanking()
 {
     queryState = QueryState.Friends;
 }