示例#1
0
        public List <IAllocatable> GetIAChildrenForIAllocatable(IAllocatable parentIA)
        {
            GraphNode parentNode = parentIA as GraphNode;

            List <IAllocatable> nodeList = new List <IAllocatable>();

            if (GraphNodes.Contains(parentNode))
            {
                if (ParentToChildrenMap.ContainsKey(parentNode))
                {
                    nodeList = ParentToChildrenMap[parentNode].Cast <IAllocatable>().ToList();
                }
            }
            else
            {
                throw new InvalidOperationException("Graph does not contain node specified!");
            }

            //add  AtomicRITE
            List <IAllocatable> aRiteList = new List <IAllocatable>();

            foreach (AtomicRITE aR in parentNode.ResidualAtomicRITEs)
            {
                IAllocatable aIA = aR as IAllocatable;
                aRiteList.Add(aIA);
            }

            return(nodeList.Union(aRiteList).ToList());
        }
示例#2
0
        //public abstract List<GraphNode> GetChildrenForNode(GraphNode parentNode);

        public List <GraphNode> GetChildrenForNode(GraphNode parentNode)
        {
            if (GraphNodes.Contains(parentNode))
            {
                if (ParentToChildrenMap.ContainsKey(parentNode))
                {
                    return(ParentToChildrenMap[parentNode]);
                }
                else
                {
                    return(new List <GraphNode>());//throw new InvalidOperationException("Node does not have any children!");
                }
            }
            else
            {
                throw new InvalidOperationException("Graph does not contain node specified!");
            }
        }