Пример #1
0
 public AndIterator(LogExpr logExpr, Agent ag, Unifier un)
 {
     this.logExpr = logExpr;
     this.ag      = ag;
     this.un      = un;
     ileft        = (AndIterator <Unifier>)logExpr.GetLHS().LogicalConsequence(ag, un);
 }
Пример #2
0
        //public bool HasNext()
        //{
        //    if (needsUpdate) Get();
        //    return current != null;
        //}

        //public Unifier Next()
        //{
        //    if (needsUpdate) Get();
        //    if (current != null) needsUpdate = true;
        //    return current;
        //}

        private void Get()
        {
            needsUpdate = false;
            current     = default;
            while ((iright == null || iright.MoveNext()) && ileft.MoveNext())
            {
                iright = (AndIterator <Unifier>)logExpr.GetRHS().LogicalConsequence(ag, ileft.Current);
            }
            if (iright != null && iright.MoveNext())
            {
                current = iright.Current;
            }
        }