コード例 #1
0
 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
ファイル: OutputStrategyUtil.cs プロジェクト: lanicon/nesper
        /// <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
ファイル: ViewablePair.cs プロジェクト: lanicon/nesper
 public ViewablePair(
     Viewable top,
     Viewable last)
 {
     Top = top;
     Last = last;
 }
コード例 #10
0
 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);
        }
コード例 #13
0
        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
ファイル: AgentInstance.cs プロジェクト: ikvm/nesper
 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);
        }
コード例 #17
0
 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;
 }
コード例 #20
0
    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);
        }
    }
コード例 #21
0
        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
ファイル: EventRowRegexHelper.cs プロジェクト: valmac/nesper
        public static EventRowRegexNFAViewService RecursiveFindRegexService(Viewable top)
        {
            if (top is EventRowRegexNFAViewService)
            {
                return((EventRowRegexNFAViewService)top);
            }

            return(top.Views
                   .Select(RecursiveFindRegexService)
                   .FirstOrDefault());
        }
コード例 #24
0
ファイル: UnityMain.cs プロジェクト: csheldondante/MGP
 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
ファイル: RowRecogHelper.cs プロジェクト: lanicon/nesper
        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;
 }
コード例 #28
0
    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);
                    }
                }
            }
        }
    }
コード例 #29
0
        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);
    }