示例#1
0
        public ConditionResult Evaluate(Node initialSearchNode, Node node, Relationship relationship, Descriptor descriptor)
        {
            ConditionResult result = new ConditionResult()
            {
                IncludeNode = this.IsIncluded, Value = true
            };

            if (TypeConditions != null)
            {
                foreach (TypeMatch typeMatch in TypeConditions)
                {
                    bool isMatch = typeMatch.Evaluate(initialSearchNode, node, relationship, descriptor);
                    if (!isMatch)
                    {
                        //as soon as it doesn't evaluate to true we can break we have our result
                        //we are ANDing all the TypeConditions
                        result.Value = false;
                        break;
                    }
                }
            }
            if (result.Value)
            {
                //if we still have a true result check the metadata next
                if (MetadataConditions != null)
                {
                    foreach (MetadataMatch metaMatch in MetadataConditions)
                    {
                        bool isMatch = metaMatch.Evaluate(initialSearchNode, node, relationship, descriptor);
                        if (!isMatch)
                        {
                            //as soon as it doesn't evaluate to true we can break we have our result
                            //we are ANDing all the TypeConditions
                            result.Value = false;
                            break;
                        }
                    }
                }
            }
            return(result);
        }
示例#2
0
        public ConditionResult Evaluate(Node initialSearchNode, Node node, Relationship relationship, Descriptor descriptor)
        {
            ConditionResult result = new ConditionResult()
            {
                Action = ActionValue, IncludeNode = true, Value = true
            };

            foreach (Match match in Matches)
            {
                ConditionResult matchResult = match.Evaluate(initialSearchNode, node, relationship, descriptor);
                if (matchResult.IncludeNode == false)
                {
                    result.IncludeNode = false;
                }
                if (!matchResult.Value)
                {
                    result.Value = false;
                    break;
                }
            }
            return(result);
        }
示例#3
0
 public ConditionResult Evaluate(Node initialSearchNode, Node node, Relationship relationship, Descriptor descriptor)
 {
     ConditionResult result = new ConditionResult() { IncludeNode = this.IsIncluded, Value = true };
     if (TypeConditions != null)
     {
         foreach (TypeMatch typeMatch in TypeConditions)
         {
             bool isMatch = typeMatch.Evaluate(initialSearchNode, node, relationship, descriptor);
             if (!isMatch)
             {
                 //as soon as it doesn't evaluate to true we can break we have our result
                 //we are ANDing all the TypeConditions
                 result.Value = false;
                 break;
             }
         }
     }
     if (result.Value) 
     {
         //if we still have a true result check the metadata next
         if (MetadataConditions != null)
         {
             foreach (MetadataMatch metaMatch in MetadataConditions)
             {
                 bool isMatch = metaMatch.Evaluate(initialSearchNode, node, relationship, descriptor);
                 if (!isMatch)
                 {
                     //as soon as it doesn't evaluate to true we can break we have our result
                     //we are ANDing all the TypeConditions
                     result.Value = false;
                     break;
                 }
             }
         }
     }
     return result;
 }
示例#4
0
 public ConditionResult Evaluate(Node initialSearchNode, Node node, Relationship relationship, Descriptor descriptor)
 {
     ConditionResult result = new ConditionResult() { Action = ActionValue, IncludeNode = true, Value = true };
     foreach (Match match in Matches)
     {
         ConditionResult matchResult = match.Evaluate(initialSearchNode, node, relationship, descriptor);
         if (matchResult.IncludeNode == false)
         {
             result.IncludeNode = false;
         }
         if (!matchResult.Value)
         {
             result.Value = false;
             break;
         }
     }
     return result;
 }