/// <summary> /// Builds PDDL effect from the input data. /// </summary> /// <param name="effect">Input data effect.</param> /// <returns>Built effect.</returns> public IEffect Build(InputData.PDDL.Effect effect) { Debug.Assert(EffectsStack.Count == 0); EffectsStack.Clear(); effect.Accept(this); Debug.Assert(EffectsStack.Count == 1); return(EffectsStack.Pop()); }
/// <summary> /// Visits the given input data node. /// </summary> /// <param name="data">Input data node.</param> public override void PostVisit(InputData.PDDL.ForallEffect data) { List <IEffect> argumentEffects = new List <IEffect>(); for (int i = 0; i < data.Effects.Count; ++i) { argumentEffects.Add(EffectsStack.Pop()); } argumentEffects.Reverse(); EffectsStack.Push(new ForallEffect(new Parameters(data.Parameters, IdManager), argumentEffects)); IdManager.Variables.UnregisterLocalParameters(data.Parameters); }
/// <summary> /// Visits the given input data node. /// </summary> /// <param name="data">Input data node.</param> public override void PostVisit(InputData.PDDL.WhenEffect data) { List <PrimitiveEffect> argumentEffects = new List <PrimitiveEffect>(); for (int i = 0; i < data.Effects.Count; ++i) { argumentEffects.Add((PrimitiveEffect)EffectsStack.Pop()); } argumentEffects.Reverse(); ExpressionsBuilder expressionsBuilder = new ExpressionsBuilder(IdManager); IExpression argumentExpression = expressionsBuilder.Build(data.Expression); EffectsStack.Push(new WhenEffect(argumentExpression, argumentEffects)); }
/// <summary> /// Visits the given input data node. /// </summary> /// <param name="data">Input data node.</param> public override void PostVisit(InputData.PDDL.NotEffect data) { EffectsStack.Push(new NotEffect((AtomicFormulaEffect)EffectsStack.Pop())); }