예제 #1
0
        /// <summary>
        /// Get the next nodes
        /// </summary>
        /// <param name="AD_WF_Node_ID">ID</param>
        /// <param name="AD_Client_ID">for client</param>
        /// <returns>array of next nodes or null</returns>
        public MWFNode[] GetNextNodes(int AD_WF_Node_ID, int AD_Client_ID)
        {
            MWFNode node = GetNode(AD_WF_Node_ID);

            if (node == null || node.GetNextNodeCount() == 0)
            {
                return(null);
            }
            MWFNodeNext[]  nexts = node.GetTransitions(AD_Client_ID);
            List <MWFNode> list  = new List <MWFNode>();

            for (int i = 0; i < nexts.Length; i++)
            {
                MWFNode next = GetNode(nexts[i].GetAD_WF_Next_ID());
                if (next != null)
                {
                    list.Add(next);
                }
            }
            //	Return Nodes
            MWFNode[] retValue = new MWFNode[list.Count];
            //list.toArray(retValue);
            retValue = list.ToArray();
            return(retValue);
        }
예제 #2
0
        /// <summary>
        ///	Add Nodes recursively (depth first) to Ordered List
        /// </summary>
        /// <param name="list">list to add to</param>
        /// <param name="AD_WF_Node_ID">start node id</param>
        /// <param name="AD_Client_ID">for client</param>
        private void AddNodesDF(List <MWFNode> list, int AD_WF_Node_ID, int AD_Client_ID)
        {
            MWFNode node = GetNode(AD_WF_Node_ID);

            if (node != null && !list.Contains(node))
            {
                list.Add(node);
                //	Get Dependent
                MWFNodeNext[] nexts = node.GetTransitions(AD_Client_ID);
                for (int i = 0; i < nexts.Length; i++)
                {
                    if (nexts[i].IsActive())
                    {
                        AddNodesDF(list, nexts[i].GetAD_WF_Next_ID(), AD_Client_ID);
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Add Nodes recursively (sibling first) to Ordered List
        /// </summary>
        /// <param name="list">list to add to</param>
        /// <param name="AD_WF_Node_ID">start node id</param>
        /// <param name="AD_Client_ID">for client</param>
        private void AddNodesSF(List <MWFNode> list, int AD_WF_Node_ID, int AD_Client_ID)
        {
            MWFNode node = GetNode(AD_WF_Node_ID);

            if (node != null &&
                (node.GetAD_Client_ID() == 0 || node.GetAD_Client_ID() == AD_Client_ID))
            {
                if (!list.Contains(node))
                {
                    list.Add(node);
                }
                MWFNodeNext[] nexts = node.GetTransitions(AD_Client_ID);
                for (int i = 0; i < nexts.Length; i++)
                {
                    MWFNode child = GetNode(nexts[i].GetAD_WF_Next_ID());
                    if (!child.IsActive())
                    {
                        continue;
                    }
                    if (child.GetAD_Client_ID() == 0 ||
                        child.GetAD_Client_ID() == AD_Client_ID)
                    {
                        if (!list.Contains(child))
                        {
                            list.Add(child);
                        }
                    }
                }
                //	Remainder Nodes not connected
                for (int i = 0; i < nexts.Length; i++)
                {
                    if (nexts[i].IsActive())
                    {
                        AddNodesSF(list, nexts[i].GetAD_WF_Next_ID(), AD_Client_ID);
                    }
                }
            }
        }