コード例 #1
0
        public override object VisitAnswer_set(DLV2Parser.Answer_setContext context)
        {
            answerSets.AddAnswerSet();

            if (context.cost() != null && !context.cost().IsEmpty)
            {
                costs = new Dictionary <int, int>();
                string[] FirstCost = context.cost().COST_LABEL().GetText().Split(' ')[1].Split('@');

                costs[Int32.Parse(FirstCost[1])] = Int32.Parse(FirstCost[0]);
            }

            if (costs != null)
            {
                foreach (KeyValuePair <int, int> entry in costs)
                {
                    answerSets.StoreCost(entry.Key, entry.Value);
                }
            }

            return(VisitChildren(context));
        }
コード例 #2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="DLV2Parser.answer_set"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitAnswer_set([NotNull] DLV2Parser.Answer_setContext context)
 {
     return(VisitChildren(context));
 }