public StatementAgentInstanceFactoryOnTriggerResult(
     Viewable finalView,
     AgentInstanceMgmtCallback stopCallback,
     AgentInstanceContext agentInstanceContext,
     AggregationService optionalAggegationService,
     IDictionary<int, SubSelectFactoryResult> subselectStrategies,
     PriorEvalStrategy[] priorStrategies,
     PreviousGetterStrategy[] previousGetterStrategies,
     RowRecogPreviousStrategy regexExprPreviousEvalStrategy,
     IDictionary<int, ExprTableEvalStrategy> tableAccessStrategies,
     IList<StatementAgentInstancePreload> preloadList,
     Runnable postContextMergeRunnable,
     EvalRootState optPatternRoot,
     ViewableActivationResult viewableActivationResult)
     : base(
         finalView,
         stopCallback,
         agentInstanceContext,
         optionalAggegationService,
         subselectStrategies,
         priorStrategies,
         previousGetterStrategies,
         regexExprPreviousEvalStrategy,
         tableAccessStrategies,
         preloadList,
         postContextMergeRunnable)
 {
     OptPatternRoot = optPatternRoot;
     ViewableActivationResult = viewableActivationResult;
 }
예제 #2
0
 public StatementAgentInstanceFactoryCreateNWResult(
     Viewable finalView,
     AgentInstanceStopCallback stopCallback,
     AgentInstanceContext agentInstanceContext,
     Viewable eventStreamParentViewable,
     Viewable topView,
     NamedWindowInstance namedWindowInstance,
     ViewableActivationResult viewableActivationResult)
     : base(
         finalView,
         stopCallback,
         agentInstanceContext,
         null,
         new EmptyDictionary<int, SubSelectFactoryResult>(),
         null,
         null,
         null,
         new EmptyDictionary<int, ExprTableEvalStrategy>(),
         null)
 {
     this.eventStreamParentViewable = eventStreamParentViewable;
     this.topView = topView;
     this.namedWindowInstance = namedWindowInstance;
     this.viewableActivationResult = viewableActivationResult;
 }
예제 #3
0
파일: ViewSupport.cs 프로젝트: ikvm/nesper
        /// <summary>
        /// Find the descendent view in the view tree under the parent view returning the list of view nodes between the parent view and the descendent view. Returns null if the descendent view is not found. Returns an empty list if the descendent view is a child view of the parent view.
        /// </summary>
        /// <param name="parentView">is the view to start searching under</param>
        /// <param name="descendentView">is the view to find</param>
        /// <returns>
        /// list of Viewable nodes between parent and descendent view.
        /// </returns>
        public static IList <View> FindDescendent(Viewable parentView, Viewable descendentView)
        {
            var stack = new Stack <View>();

            foreach (View view in parentView.Views)
            {
                if (view == descendentView)
                {
                    var viewList = new List <View>(stack);
                    viewList.Reverse();
                    return(viewList);
                }

                bool found = FindDescendentRecusive(view, descendentView, stack);

                if (found)
                {
                    var viewList = new List <View>(stack);
                    viewList.Reverse();
                    return(viewList);
                }
            }

            return(null);
        }
예제 #4
0
 public StatementAgentInstanceFactorySelectResult(
     Viewable finalView,
     AgentInstanceStopCallback stopCallback,
     AgentInstanceContext agentInstanceContext,
     AggregationService optionalAggegationService,
     IDictionary<int, SubSelectFactoryResult> subselectStrategies,
     PriorEvalStrategy[] priorStrategies,
     PreviousGetterStrategy[] previousGetterStrategies,
     RowRecogPreviousStrategy regexExprPreviousEvalStrategy,
     IDictionary<int, ExprTableEvalStrategy> tableAccessStrategies,
     IList<StatementAgentInstancePreload> preloadList,
     EvalRootState[] patternRoots,
     JoinSetComposer joinSetComposer,
     Viewable[] topViews,
     Viewable[] eventStreamViewables,
     ViewableActivationResult[] viewableActivationResults)
     : base(
         finalView,
         stopCallback,
         agentInstanceContext,
         optionalAggegationService,
         subselectStrategies,
         priorStrategies,
         previousGetterStrategies,
         regexExprPreviousEvalStrategy,
         tableAccessStrategies,
         preloadList)
 {
     TopViews = topViews;
     PatternRoots = patternRoots;
     JoinSetComposer = joinSetComposer;
     EventStreamViewables = eventStreamViewables;
     ViewableActivationResults = viewableActivationResults;
 }
예제 #5
0
        /// <summary>
        ///     NOTE: Code-generation-invoked method, method name and parameter order matters
        /// </summary>
        /// <param name="joinExecutionStrategy">join strategy</param>
        /// <param name="resultSetProcessor">processor</param>
        /// <param name="parentView">view</param>
        /// <param name="distinct">flag</param>
        /// <param name="distinctKeyGetter"></param>
        /// <returns>iterator</returns>
        public static IEnumerator<EventBean> GetEnumerator(
            JoinExecutionStrategy joinExecutionStrategy,
            ResultSetProcessor resultSetProcessor,
            Viewable parentView,
            bool distinct,
            EventPropertyValueGetter distinctKeyGetter)
        {
            IEnumerator<EventBean> enumerator;
            if (joinExecutionStrategy != null) {
                var joinSet = joinExecutionStrategy.StaticJoin();
                enumerator = resultSetProcessor.GetEnumerator(joinSet);
            }
            else if (resultSetProcessor != null) {
                enumerator = resultSetProcessor.GetEnumerator(parentView);
            }
            else {
                enumerator = parentView.GetEnumerator();
            }

            if (!distinct) {
                return enumerator;
            }

            return EventDistinctEnumerator.For(enumerator, distinctKeyGetter);
        }
예제 #6
0
파일: ViewSupport.cs 프로젝트: ikvm/nesper
        private static bool FindDescendentRecusive(View parentView, Viewable descendentView, Stack <View> stack)
        {
            stack.Push(parentView);

            bool found = false;

            foreach (View view in parentView.Views)
            {
                if (view == descendentView)
                {
                    return(true);
                }

                found = FindDescendentRecusive(view, descendentView, stack);

                if (found)
                {
                    break;
                }
            }

            if (!found)
            {
                stack.Pop();
                return(false);
            }

            return(true);
        }
예제 #7
0
        public StatementAgentInstanceFactoryCreateContextResult(
            Viewable finalView,
            AgentInstanceStopCallback stopCallback,
            AgentInstanceContext agentInstanceContext,
            AggregationService optionalAggegationService,
            IDictionary<int, SubSelectFactoryResult> subselectStrategies,
            PriorEvalStrategy[] priorStrategies,
            PreviousGetterStrategy[] previousGetterStrategies,
            RowRecogPreviousStrategy regexExprPreviousEvalStrategy,
            IDictionary<int, ExprTableEvalStrategy> tableAccessStrategies,
            IList<StatementAgentInstancePreload> preloadList,
            ContextManagerRealization contextManagerRealization)
            : base(
                finalView,
                stopCallback,
                agentInstanceContext,
                optionalAggegationService,
                subselectStrategies,
                priorStrategies,
                previousGetterStrategies,
                regexExprPreviousEvalStrategy,
                tableAccessStrategies,
                preloadList)

        {
            this.contextManagerRealization = contextManagerRealization;
        }
예제 #8
0
 public StatementAgentInstanceFactorySelectResult(
     Viewable finalView,
     StopCallback stopCallback,
     AgentInstanceContext agentInstanceContext,
     AggregationService optionalAggegationService,
     IDictionary <ExprSubselectNode, SubSelectStrategyHolder> subselectStrategies,
     IDictionary <ExprPriorNode, ExprPriorEvalStrategy> priorNodeStrategies,
     IDictionary <ExprPreviousNode, ExprPreviousEvalStrategy> previousNodeStrategies,
     RegexExprPreviousEvalStrategy regexExprPreviousEvalStrategy,
     IDictionary <ExprTableAccessNode, ExprTableAccessEvalStrategy> tableAccessStrategies,
     IList <StatementAgentInstancePreload> preloadList,
     EvalRootState[] patternRoots,
     StatementAgentInstancePostLoad optionalPostLoadJoin,
     Viewable[] topViews,
     Viewable[] eventStreamViewables,
     ViewableActivationResult[] viewableActivationResults) : base(
         finalView, stopCallback, agentInstanceContext, optionalAggegationService, subselectStrategies,
         priorNodeStrategies, previousNodeStrategies, regexExprPreviousEvalStrategy, tableAccessStrategies, preloadList)
 {
     TopViews                  = topViews;
     PatternRoots              = patternRoots;
     OptionalPostLoadJoin      = optionalPostLoadJoin;
     EventStreamViewables      = eventStreamViewables;
     ViewableActivationResults = viewableActivationResults;
 }
예제 #9
0
 public ViewablePair(
     Viewable top,
     Viewable last)
 {
     Top = top;
     Last = last;
 }
 protected StatementAgentInstanceFactoryResult(
     Viewable finalView,
     AgentInstanceMgmtCallback stopCallback,
     AgentInstanceContext agentInstanceContext,
     AggregationService optionalAggegationService,
     IDictionary<int, SubSelectFactoryResult> subselectStrategies,
     PriorEvalStrategy[] priorStrategies,
     PreviousGetterStrategy[] previousGetterStrategies,
     RowRecogPreviousStrategy rowRecogPreviousStrategy,
     IDictionary<int, ExprTableEvalStrategy> tableAccessStrategies,
     IList<StatementAgentInstancePreload> preloadList,
     Runnable postContextMergeRunnable)
 {
     FinalView = finalView;
     StopCallback = stopCallback;
     AgentInstanceContext = agentInstanceContext;
     OptionalAggegationService = optionalAggegationService;
     SubselectStrategies = subselectStrategies;
     PriorStrategies = priorStrategies;
     PreviousGetterStrategies = previousGetterStrategies;
     RowRecogPreviousStrategy = rowRecogPreviousStrategy;
     TableAccessStrategies = tableAccessStrategies;
     this.preloadList = preloadList;
     PostContextMergeRunnable = postContextMergeRunnable;
 }
예제 #11
0
 public StatementAgentInstanceFactoryCreateNwResult(
     Viewable finalView,
     AgentInstanceMgmtCallback stopCallback,
     AgentInstanceContext agentInstanceContext,
     Viewable eventStreamParentViewable,
     Viewable topView,
     NamedWindowInstance namedWindowInstance,
     ViewableActivationResult viewableActivationResult)
     : base(
         finalView,
         stopCallback,
         agentInstanceContext,
         null,
         EmptyDictionary<int, SubSelectFactoryResult>.Instance,
         null,
         null,
         null,
         EmptyDictionary<int, ExprTableEvalStrategy>.Instance,
         null,
         null)
 {
     _eventStreamParentViewable = eventStreamParentViewable;
     _topView = topView;
     _namedWindowInstance = namedWindowInstance;
     _viewableActivationResult = viewableActivationResult;
 }
예제 #12
0
        public static ViewablePair Materialize(
            ViewFactory[] factories,
            Viewable eventStreamParent,
            AgentInstanceViewFactoryChainContext viewFactoryChainContext,
            IList<AgentInstanceMgmtCallback> stopCallbacks)
        {
            if (factories.Length == 0) {
                return new ViewablePair(eventStreamParent, eventStreamParent);
            }

            var current = eventStreamParent;
            Viewable topView = null;
            Viewable streamView = null;

            foreach (var viewFactory in factories) {
                var view = viewFactory.MakeView(viewFactoryChainContext);
                if (view is AgentInstanceMgmtCallback) {
                    stopCallbacks.Add((AgentInstanceMgmtCallback) view);
                }

                current.Child = view;
                view.Parent = current;
                if (topView == null) {
                    topView = view;
                }

                streamView = view;
                current = view;
            }

            return new ViewablePair(topView, streamView);
        }
        public override IEnumerator <EventBean> GetEnumerator(Viewable parent)
        {
            // Return an iterator that gives row-by-row a result
            var transform = new ResultSetProcessorSimpleTransform(this);

            return(parent.Select(transform.Transform).GetEnumerator());
        }
예제 #14
0
 /// <summary>Ctor. </summary>
 /// <param name="viewable">last view to attach listeners to</param>
 /// <param name="stopMethod">method to stop</param>
 public EPStatementStartResult(Viewable viewable,
                               EPStatementStopMethod stopMethod)
 {
     Viewable      = viewable;
     StopMethod    = stopMethod;
     DestroyMethod = null;
 }
예제 #15
0
 public AgentInstance(StopCallback stopCallback,
                      AgentInstanceContext agentInstanceContext,
                      Viewable finalView)
 {
     StopCallback         = stopCallback;
     AgentInstanceContext = agentInstanceContext;
     FinalView            = finalView;
 }
예제 #16
0
        private void OnSceneGUI()
        {
            Viewable viewable = (Viewable)target;

            // Draw arc
            Handles.color = Color.white;
            Handles.DrawWireArc(viewable.transform.position, Vector3.forward, Vector3.left, AmongUsClone.Shared.Game.PlayerLogic.Viewable.ViewAngle, viewable.viewRadius);
        }
 public StatementAgentInstanceFactoryCreateIndex(EPServicesContext services, CreateIndexDesc spec, Viewable finalView, NamedWindowProcessor namedWindowProcessor, string tableName)
 {
     this.services             = services;
     this.spec                 = spec;
     this.finalView            = finalView;
     this.namedWindowProcessor = namedWindowProcessor;
     this.tableName            = tableName;
 }
예제 #18
0
 public override IEnumerator <EventBean> GetEnumerator(Viewable parent)
 {
     if (OrderByProcessor == null)
     {
         return(ResultSetRowPerGroupEnumerator.New(_groupReps.Values, this, AggregationService, AgentInstanceContext));
     }
     return(GetEnumeratorSorted(_groupReps.Values.GetEnumerator()));
 }
예제 #19
0
 internal JoinPlanResult(
     Viewable viewable,
     JoinPreloadMethod preloadMethod,
     JoinSetComposerDesc joinSetComposerDesc)
 {
     Viewable            = viewable;
     PreloadMethod       = preloadMethod;
     JoinSetComposerDesc = joinSetComposerDesc;
 }
    public void Update()
    {
        cursor.transform.position = Input.mousePosition;

        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit) && (DialogueRunner.instance != null && !DialogueRunner.instance.isDialogueRunning))
        {
            Debug.DrawLine(Camera.main.transform.position, hit.point);

            if (hit.transform.gameObject != lastHit)
            {
                lastHit = hit.transform.gameObject;

                if (lastHit.tag == "Interactable")
                {
                    animator.SetBool("Interacting", true);
                    Interactable i = lastHit.GetComponent <Interactable>();
                    text.text = i.interactionUIActionString + " " + i.interactionUIObjectString;
                }
                else if (lastHit.tag == "Viewable")
                {
                    animator.SetBool("Interacting", true);
                    Viewable i = lastHit.GetComponent <Viewable>();
                    text.text = i.viewUIActionString + " " + i.viewUIObjectString;
                }
                else if (lastHit.tag == "Pickupable")
                {
                    animator.SetBool("Interacting", true);
                    Pickupable i = lastHit.GetComponent <Pickupable>();
                    text.text = i.pickUpUIActionString + " " + i.pickUpUIObjectString;
                }
                else if (lastHit.tag == "NPC")
                {
                    animator.SetBool("Interacting", true);
                    Controller i = lastHit.GetComponentInParent <Controller>();
                    text.text = "Talk to " + i.name;
                }
                else if (lastHit.tag == "Commentable")
                {
                    animator.SetBool("Interacting", true);
                    Commentable i = lastHit.GetComponentInParent <Commentable>();
                    text.text = "Comment on " + i.commentableUIObjectString;
                }
                else
                {
                    animator.SetBool("Interacting", false);
                }
            }
        }
        else
        {
            animator.SetBool("Interacting", false);
        }
    }
        public override IEnumerator <EventBean> GetEnumerator(Viewable parent)
        {
            var output = GenerateOutputEventsView(_unboundHelper.Buffer, true, true);

            if (output == null)
            {
                return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
            }
            return(((IEnumerable <EventBean>)output).GetEnumerator());
        }
예제 #22
0
 public StatementAgentInstanceFactoryCreateIndexResult(Viewable finalView, StopCallback stopCallback, AgentInstanceContext agentInstanceContext)
     : base(finalView, stopCallback, agentInstanceContext, null,
            Collections.GetEmptyMap <ExprSubselectNode, SubSelectStrategyHolder>(),
            Collections.GetEmptyMap <ExprPriorNode, ExprPriorEvalStrategy>(),
            Collections.GetEmptyMap <ExprPreviousNode, ExprPreviousEvalStrategy>(),
            null,
            Collections.GetEmptyMap <ExprTableAccessNode, ExprTableAccessEvalStrategy>(),
            Collections.GetEmptyList <StatementAgentInstancePreload>())
 {
 }
예제 #23
0
        public static EventRowRegexNFAViewService RecursiveFindRegexService(Viewable top)
        {
            if (top is EventRowRegexNFAViewService)
            {
                return((EventRowRegexNFAViewService)top);
            }

            return(top.Views
                   .Select(RecursiveFindRegexService)
                   .FirstOrDefault());
        }
예제 #24
0
 public void AddViewable(Viewable viewable)
 {
     if (viewable is Tilemap2D)
     {
         CreateRepresentation((Tilemap2D)viewable);
     }
     //TODO
     //get the type of viewable
     //get the corrisponding game object for this viewable
     //set the data on the corresponding game objects view component
 }
예제 #25
0
        public ViewServiceCreateResult CreateViews(
            Viewable eventStreamViewable,
            IList <ViewFactory> viewFactories,
            AgentInstanceViewFactoryChainContext viewFactoryChainContext,
            bool hasPreviousNode)
        {
            // Attempt to find existing views under the stream that match specs.
            // The viewSpecList may have been changed by this method.
            Pair <Viewable, IList <View> > resultPair;

            if (hasPreviousNode)
            {
                resultPair = new Pair <Viewable, IList <View> >(eventStreamViewable, Collections.GetEmptyList <View>());
            }
            else
            {
                resultPair = ViewServiceHelper.MatchExistingViews(eventStreamViewable, viewFactories, viewFactoryChainContext.AgentInstanceContext);
            }

            var parentViewable = resultPair.First;

            if (viewFactories.IsEmpty())
            {
                if (Log.IsDebugEnabled)
                {
                    Log.Debug(".createView No new views created, dumping stream ... " + eventStreamViewable);
                    ViewSupport.DumpChildViews("EventStream ", eventStreamViewable);
                }

                return(new ViewServiceCreateResult(parentViewable, parentViewable, Collections.GetEmptyList <View>()));   // we know its a view here since the factory list is empty
            }

            // Instantiate remaining chain of views from the remaining factories which didn't match to existing views.
            var views = ViewServiceHelper.InstantiateChain(parentViewable, viewFactories, viewFactoryChainContext);

            // Initialize any views that need initializing after the chain is complete
            foreach (var view in views)
            {
                if (view is InitializableView)
                {
                    var initView = (InitializableView)view;
                    initView.Initialize();
                }
            }

            if (Log.IsDebugEnabled)
            {
                Log.Debug(".createView New views created for stream, all views ... " + eventStreamViewable);
                ViewSupport.DumpChildViews("EventStream ", eventStreamViewable);
            }

            return(new ViewServiceCreateResult(views[views.Count - 1], views[0], views));
        }
예제 #26
0
        public static RowRecogNFAViewService RecursiveFindRegexService(Viewable top)
        {
            if (top == null) {
                return null;
            }

            if (top is RowRecogNFAViewService) {
                return (RowRecogNFAViewService) top;
            }

            return RecursiveFindRegexService(top.Child);
        }
예제 #27
0
 public void Dispose()
 {
     if (State == EPStatementState.DESTROYED)
     {
         throw new IllegalStateException("Statement already destroyed");
     }
     _statementLifecycleSvc.Destroy(StatementContext.StatementId);
     _parentView            = null;
     EventType              = null;
     _dispatchChildView     = null;
     _statementLifecycleSvc = null;
 }
    void Update()
    {
        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Input.GetButtonDown("Fire1"))
        {
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.collider.CompareTag("Interactable"))
                {
                    Interactable objectHit = hit.transform.GetComponent <Interactable>();
                    if (objectHit != null && !DialogueRunner.instance.isDialogueRunning)
                    {
                        PlayerControllerMain.instance.InteractWith(objectHit);
                    }
                }
                else if (hit.collider.CompareTag("Viewable"))
                {
                    Viewable objectHit = hit.transform.GetComponent <Viewable>();
                    if (objectHit != null && !DialogueRunner.instance.isDialogueRunning)
                    {
                        PlayerControllerMain.instance.InteractWith(objectHit);
                    }
                }
                else if (hit.collider.CompareTag("Pickupable"))
                {
                    Pickupable objectHit = hit.transform.GetComponent <Pickupable>();
                    if (objectHit != null && !DialogueRunner.instance.isDialogueRunning)
                    {
                        PlayerControllerMain.instance.InteractWith(objectHit);
                    }
                }
                else if (hit.collider.tag == "NPC")
                {
                    if (PlayerControllerMain.instance.Control)
                    {
                        CheckForNearbyNPC(hit.collider.gameObject);
                    }
                }
                else if (hit.collider.tag == "Commentable")
                {
                    Commentable objectHit = hit.transform.GetComponent <Commentable>();
                    objectHit.Go();
                    if (objectHit != null && !DialogueRunner.instance.isDialogueRunning)
                    {
                        DialogueRunner.instance.StartDialogue(objectHit.startNode, playerText);
                    }
                }
            }
        }
    }
        public IEnumerator <EventBean> GetEnumerator(Viewable parent)
        {
            if (!_prototype.IsHistoricalOnly)
            {
                return(ObtainEnumerator(parent));
            }

            ResultSetProcessorUtil.ClearAndAggregateUngrouped(_exprEvaluatorContext, _aggregationService, parent);
            ArrayDeque <EventBean> deque = ResultSetProcessorUtil.EnumeratorToDeque(ObtainEnumerator(parent));

            _aggregationService.ClearResults(_exprEvaluatorContext);
            return(deque.GetEnumerator());
        }
예제 #30
0
파일: Main.cs 프로젝트: csheldondante/MGP
    public List <Viewable> GetViewables()
    {
        List <Viewable> viewables = new List <Viewable> ();

        foreach (DataEntity entity in _entities)
        {
            Viewable viewable = entity.GetComponent <Viewable> ();
            if (viewable != null)
            {
                viewables.Add(viewable);
            }
        }
        return(viewables);
    }