GetMapNode() public static method

public static GetMapNode ( Node initialNode ) : Node
initialNode Node
return Node
Exemplo n.º 1
0
        public bool Evaluate(Node initialSearchNode, Node node, Relationship relationship, Descriptor descriptor)
        {
            Guid searchId   = Guid.Empty;
            bool?evaluation = new bool?();

            switch (Context)
            {
            case ConditionContext.Node:
                searchId = node.NodeUid;
                break;

            case ConditionContext.Relationship:
                searchId = relationship.RelationshipUid;
                break;

            case ConditionContext.Descriptor:
                searchId = descriptor.DescriptorUid;
                break;

            case ConditionContext.NodeType:
                searchId = node.NodeTypeUid.Value;
                break;

            case ConditionContext.RelationshipType:
                searchId = relationship.RelationshipTypeUid.Value;
                break;

            case ConditionContext.DescriptorType:
                searchId = descriptor.DescriptorTypeUid.Value;
                break;

            case ConditionContext.MapMatch:
                searchId    = ConditionHelper.GetMapNode(initialSearchNode).NodeUid;
                SearchValue = ConditionHelper.GetMapId(node, descriptor);
                break;

            default:
                break;
            }

            switch (OperatorValue)
            {
            case ComparisonOperators.Equal:
                evaluation = SearchValue == searchId;
                break;

            case ComparisonOperators.NotEqual:
                evaluation = SearchValue != searchId;
                break;

            default:
                evaluation = false;
                break;
            }

            return(evaluation.Value);
        }
Exemplo n.º 2
0
        public bool Evaluate(Node initialSearchNode, Node node, Relationship relationship, Descriptor descriptor)
        {
            Guid searchId   = Guid.Empty;
            bool?evaluation = new bool?();

            if (relationship.RelationshipType.RelationshipTypeName == "MapContainerRelationship")
            {
                Node mapNode = ConditionHelper.GetMapNode(initialSearchNode);

                Node altNode      = ConditionHelper.GetAlternateNode(descriptor);
                bool isNodeParent = ConditionHelper.IsParentNode(descriptor);

                Guid mapId = Guid.Empty;
                if (!isNodeParent && altNode.NodeType.NodeTypeName != "DomainNode")
                {
                    mapId = altNode.NodeUid;
                }
                else
                {
                    mapId = node.NodeUid;
                }

                if (mapNode.NodeUid == mapId)
                {
                    evaluation = true;
                }
                else
                {
                    evaluation = false;
                }
            }
            else
            {
                evaluation = false;
            }



            return(evaluation.Value);
        }