Exemple #1
0
            public override bool MoveNext()
            {
                retry:

                // First, try the next child of the current parent.
                if (childIndex >= 0)
                {
                    Current = parentEnumerator.Current.Children[childIndex--];
                    this.variable.Value = Term.CopyInstantiation(Current.Key);
                    return true;
                }

                // Ran out of children on the current parent.
                if (parentEnumerator.MoveNext())
                {
                    // ReSharper disable once PossibleNullReferenceException
                    if (parentEnumerator.Current.IsExclusive)
                        throw new ELNodeExclusionException(
                            "Non-exclusive query of an exclusive node",
                            parentEnumerator.Current,
                            this.variable);

                    childIndex = parentEnumerator.Current.Children.Count - 1;

                    goto retry;
                }
                this.variable.ForciblyUnbind();
                return false;
            }
Exemple #2
0
 public override bool MoveNext()
 {
     while (parentEnumerator.MoveNext())
     {
         if (exclusive)
         {
             if (parentEnumerator.Current.IsNonExclusive)
             {
                 throw new ELNodeExclusionException("Exclusive query of an non-exclusive node", parentEnumerator.Current, variable.Value);
             }
         }
         else if (parentEnumerator.Current.IsExclusive)
         {
             throw new ELNodeExclusionException("Non-exclusive query of an exclusive node", parentEnumerator.Current, variable.Value);
         }
         foreach (var c in parentEnumerator.Current.Children)
         {
             if (c.Key.Equals(variable.Value))
             {
                 Current = c;
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #3
0
 private static System.Collections.Generic.IEnumerable<CutState> DeleteSuccessive(ELNodeEnumerator enumerator)
 {
     while (enumerator.MoveNext())
     {
         enumerator.Current.DeleteSelf();
         yield return CutState.Continue;
     }
 }
Exemple #4
0
 private static IEnumerable <CutState> DeleteSuccessive(ELNodeEnumerator enumerator)
 {
     while (enumerator.MoveNext())
     {
         enumerator.Current.DeleteSelf();
         yield return(CutState.Continue);
     }
 }
Exemple #5
0
 public override bool MoveNext()
 {
     if (nodeEnumerator.MoveNext())
     {
         Current = nodeEnumerator.Current;
         variableToBind.Value = Current;
         return true;
     }
     variableToBind.ForciblyUnbind();
     return false;
 }
Exemple #6
0
 public override bool MoveNext()
 {
     while (parentEnumerator.MoveNext())
     {
         if (parentEnumerator.Current.IsNonExclusive)
         {
             throw new ELNodeExclusionException("Exclusive query of an non-exclusive node", parentEnumerator.Current, key);
         }
         if (parentEnumerator.Current.TryLookup(key, out Current))
             return true;
     }
     return false;
 }
Exemple #7
0
 public override bool MoveNext()
 {
     while (parentEnumerator.MoveNext())
     {
         // ReSharper disable once PossibleNullReferenceException
         if (parentEnumerator.Current.IsExclusive)
             throw new ELNodeExclusionException("Non-exclusive query of an exclusive node", parentEnumerator.Current, childKey);
         // ReSharper disable once PossibleNullReferenceException
         if (parentEnumerator.Current.TryLookup(childKey, out Current))
             return true;
     }
     return false;
 }
Exemple #8
0
 public override bool MoveNext()
 {
     while (parentEnumerator.MoveNext())
     {
         if (parentEnumerator.Current.IsNonExclusive)
         {
             throw new ELNodeExclusionException("Exclusive query of an non-exclusive node", parentEnumerator.Current, this.variable);
         }
         if (parentEnumerator.Current.Children.Count > 0)
         {
             Current = parentEnumerator.Current.Children[0];
             this.variable.Value = Term.CopyInstantiation(Current.Key);
             return true;
         }
     }
     this.variable.ForciblyUnbind();
     return false;
 }
Exemple #9
0
 private static System.Collections.Generic.IEnumerable<CutState> DeleteSuccessive(ELNodeEnumerator enumerator)
 {
     while (enumerator.MoveNext())
     {
         enumerator.Current.DeleteSelf();
         yield return CutState.Continue;
     }
 }
Exemple #10
0
        private static IEnumerable<CutState> EnumerateAndBindNode(ELNodeEnumerator enumerator, object varToBindTo)
        {
            while (enumerator.MoveNext())
#pragma warning disable 414, 168, 219
                // ReSharper disable once UnusedVariable
                foreach (var ignore in Term.Unify(varToBindTo, enumerator.Current))
#pragma warning restore 414, 168, 219
                    yield return CutState.Continue;
        }