internal void AddParant(RelationshipOrientedGraphNode parentNode)
 {
     if (_parentNodes.Contains(parentNode) == false)
     {
         _parentNodes.Add(parentNode);
     }
 }
        private void Expand(RelationshipOrientedGraphNode node)
        {
            IEnumerable <EntityToken> nativeParentEntityTokens = SecurityAncestorFacade.GetParents(node.EntityToken);

            if (nativeParentEntityTokens != null)
            {
                nativeParentEntityTokens.ForEach(f => AddEntityToken(node, f));
            }


            IEnumerable <EntityToken> auxiliaryParentEntityTokens = AuxiliarySecurityAncestorFacade.GetParents(node.EntityToken);

            if (auxiliaryParentEntityTokens != null)
            {
                auxiliaryParentEntityTokens.ForEach(f => AddEntityToken(node, f));
            }


            IEnumerable <EntityToken> hookingParentEntityTokens = HookingFacade.GetHookies(node.EntityToken);

            if (hookingParentEntityTokens != null)
            {
                hookingParentEntityTokens.ForEach(f => AddEntityToken(node, f));
            }
        }
        /// <exclude />
        public bool Equals(RelationshipOrientedGraphNode node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node.EntityToken.Equals(this.EntityToken));
        }
        /// <exclude />
        public static IEnumerable <IEnumerable <EntityToken> > GetAllPaths(this RelationshipOrientedGraphNode node)
        {
            List <List <EntityToken> > allPaths = new List <List <EntityToken> >();
            List <EntityToken>         path     = new List <EntityToken> {
                node.EntityToken
            };

            allPaths.Add(path);

            GetAllPathsImpl(node, path, allPaths, new List <RelationshipOrientedGraphNode>());

            return(allPaths);
        }
        private void AddEntityToken(RelationshipOrientedGraphNode node, EntityToken parentEntityToken)
        {
            RelationshipOrientedGraphNode existingParentNode =
                (from n in _nodes
                 where n.EntityToken.Equals(parentEntityToken)
                 select n).SingleOrDefault();

            if (existingParentNode != null)
            {
                node.AddParant(existingParentNode);
            }
            else
            {
                RelationshipOrientedGraphNode parentNode = CreateNewNode(parentEntityToken);
                _nodes.Add(parentNode);

                node.AddParant(parentNode);
            }
        }
        private static void GetAllPathsImpl(RelationshipOrientedGraphNode node, List <EntityToken> currentPath, List <List <EntityToken> > allPaths, List <RelationshipOrientedGraphNode> processedNodes)
        {
            processedNodes.Add(node);

            int count = node.Parents.Count();

            if (count == 0)
            {
                return;
            }

            if (count == 1)
            {
                RelationshipOrientedGraphNode parentNode = node.Parents.Single();
                if (!processedNodes.Contains(parentNode))
                {
                    currentPath.Add(parentNode.EntityToken);

                    GetAllPathsImpl(parentNode, currentPath, allPaths, processedNodes);
                }
                return;
            }

            allPaths.Remove(currentPath);
            foreach (RelationshipOrientedGraphNode parentNode in node.Parents)
            {
                if (!processedNodes.Contains(parentNode))
                {
                    var newCurrentPath = new List <EntityToken>(currentPath);
                    allPaths.Add(newCurrentPath);
                    newCurrentPath.Add(parentNode.EntityToken);

                    GetAllPathsImpl(parentNode, newCurrentPath, allPaths, new List <RelationshipOrientedGraphNode>(processedNodes));
                }
            }
        }
Example #7
0
        private static void GetAllPathsImpl(RelationshipOrientedGraphNode node, List<EntityToken> currentPath, List<List<EntityToken>> allPaths, List<RelationshipOrientedGraphNode> processedNodes)
        {
            processedNodes.Add(node);

            int count = node.Parents.Count();

            if (count == 0)
            {
                return;
            }

            if (count == 1)
            {
                RelationshipOrientedGraphNode parentNode = node.Parents.Single();
                if (!processedNodes.Contains(parentNode))
                {
                    currentPath.Add(parentNode.EntityToken);

                    GetAllPathsImpl(parentNode, currentPath, allPaths, processedNodes);
                }
                return;
            }
            
            allPaths.Remove(currentPath);
            foreach (RelationshipOrientedGraphNode parentNode in node.Parents)
            {
                if (!processedNodes.Contains(parentNode))
                {
                    var newCurrentPath = new List<EntityToken>(currentPath);
                    allPaths.Add(newCurrentPath);
                    newCurrentPath.Add(parentNode.EntityToken);

                    GetAllPathsImpl(parentNode, newCurrentPath, allPaths, new List<RelationshipOrientedGraphNode>(processedNodes));
                }
            }
        }
        /// <exclude />
        public RelationshipOrientedGraph(EntityToken sourceEntityToken)
        {
            RelationshipOrientedGraphNode node = CreateNewNode(sourceEntityToken);

            _nodes.Add(node);
        }
Example #9
0
 internal void AddParant(RelationshipOrientedGraphNode parentNode)
 {
     if (_parentNodes.Contains(parentNode) == false)
     {
         _parentNodes.Add(parentNode);
     }
 }
Example #10
0
        /// <exclude />
        public bool Equals(RelationshipOrientedGraphNode node)
        {
            if (node == null) return false;

            return node.EntityToken.Equals(this.EntityToken);
        }
Example #11
0
        private void Expand(RelationshipOrientedGraphNode node)
        {
            IEnumerable<EntityToken> nativeParentEntityTokens = SecurityAncestorFacade.GetParents(node.EntityToken);
            if (nativeParentEntityTokens != null)
            {
                nativeParentEntityTokens.ForEach(f => AddEntityToken(node, f));
            }

            IEnumerable<EntityToken> auxiliaryParentEntityTokens = AuxiliarySecurityAncestorFacade.GetParents(node.EntityToken);
            if (auxiliaryParentEntityTokens != null)
            {
                auxiliaryParentEntityTokens.ForEach(f => AddEntityToken(node, f));
            }

            IEnumerable<EntityToken> hookingParentEntityTokens = HookingFacade.GetHookies(node.EntityToken);
            if (hookingParentEntityTokens != null)
            {
                hookingParentEntityTokens.ForEach(f => AddEntityToken(node, f));
            }
        }
Example #12
0
        private void AddEntityToken(RelationshipOrientedGraphNode node, EntityToken parentEntityToken)
        {
            RelationshipOrientedGraphNode existingParentNode =
                (from n in _nodes
                 where n.EntityToken.Equals(parentEntityToken)
                 select n).SingleOrDefault();

            if (existingParentNode != null)
            {
                node.AddParant(existingParentNode);
            }
            else
            {
                RelationshipOrientedGraphNode parentNode = CreateNewNode(parentEntityToken);
                _nodes.Add(parentNode);

                node.AddParant(parentNode);
            }
        }