示例#1
0
        /// <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());
        }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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));
        }
示例#4
0
 /// <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()));
 }