private InternalActionLiteral CheckInternalActionsInContext(ILogicalFormula f, Agent ag) { if (f != null) { if (f.GetType() == typeof(InternalActionLiteral)) { InternalActionLiteral ial = (InternalActionLiteral)f; if (!ial.GetIA(ag).CanBeUsedInContext()) { return(ial); } } else if (f.GetType() == typeof(LogExpr)) { LogExpr le = (LogExpr)f; InternalActionLiteral ial = CheckInternalActionsInContext(le.GetLHS(), ag); if (ial != null) { return(ial); } if (!le.IsUnary()) { return(CheckInternalActionsInContext(le.GetRHS(), ag)); } } } return(null); }
//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; } }
//public bool HasNext() //{ // if (needsUpdate) Get(); // return current != null; //} //public Unifier Next() //{ // if (needsUpdate) Get(); // if (current != default) needsUpdate = true; // return current; //} private void Get() { needsUpdate = false; current = default; if (ileft != null && ileft.MoveNext()) { current = ileft.Current; } else { if (iright == null) { iright = (OrIterator <Unifier>)logExpr.GetRHS().LogicalConsequence(ag, un); } if (iright != null && iright.MoveNext()) { current = iright.Current; } } }