Exemplo n.º 1
0
        public override Boolean take(IToken token)
        {
            Boolean oldAlive = token.IsAlive;

            EdgeInstanceEvent e = new EdgeInstanceEvent(this);

            e.Token     = token;
            e.EventType = EdgeInstanceEventEnum.ON_TAKING_THE_TOKEN;

            for (int i = 0; this.eventListeners != null && i < this.eventListeners.Count; i++)
            {
                IEdgeInstanceEventListener listener = this.eventListeners[i];
                listener.onEdgeInstanceEventFired(e);
            }


            Boolean newAlive = token.IsAlive;

            if (!newAlive)
            {//循环条件不满足,则恢复token的alive标示
                token.IsAlive = oldAlive;
                return(newAlive);
            }
            else
            {//否则流转到下一个节点
                INodeInstance nodeInst = this.LeavingNodeInstance;
                token.Value = this.Weight;
                nodeInst.fire(token);//触发同步器节点
                return(newAlive);
            }
        }
Exemplo n.º 2
0
        public override Boolean take(IToken token)
        {
            EdgeInstanceEvent e = new EdgeInstanceEvent(this);

            e.Token     = token;
            e.EventType = EdgeInstanceEventEnum.ON_TAKING_THE_TOKEN;

            for (int i = 0; this.eventListeners != null && i < this.eventListeners.Count; i++)
            {
                IEdgeInstanceEventListener listener = this.eventListeners[i];
                listener.onEdgeInstanceEventFired(e);//调用TransitionInstanceExtension 来计算弧线上的条件表达式
            }

            INodeInstance nodeInst = this.LeavingNodeInstance; //获取到流向哪个节点

            token.Value = this.Weight;                         //获取到弧线上的权值
            Boolean alive = token.IsAlive;

            nodeInst.fire(token);//节点触发

            return(alive);
        }