Ejemplo n.º 1
0
 public override void EnterTypeDefine(PlanningParser.TypeDefineContext context)
 {
     foreach (var type in context.listName().NAME())
     {
         Domain.AddToTypeList(type.GetText());
     }
 }
Ejemplo n.º 2
0
        private void BuildTypeDict(PlanningParser.TypeDefineContext context)
        {
            _typeDict = new Dictionary <string, PlanningType>();

            if (context != null)
            {
                _typeDict.Add(PlanningType.ObjectType.Name, PlanningType.ObjectType);
                _typeDict.Add(PlanningType.AgentType.Name, PlanningType.AgentType);

                foreach (var typeContext in context.typeDeclaration())
                {
                    PlanningType type;
                    string       name = typeContext.NAME().GetText();
                    if (typeContext.LB() == null)
                    {
                        type = new PlanningType {
                            Name = name
                        };
                    }
                    else
                    {
                        int min = GetValue(typeContext.constTerm(0));
                        int max = GetValue(typeContext.constTerm(1));
                        type = new PlanningNumericType {
                            Name = name, Min = min, Max = max
                        };
                    }

                    _typeDict.Add(name, type);
                }
            }
        }
Ejemplo n.º 3
0
        private void HandleTypeDefine(PlanningParser.TypeDefineContext context)
        {
            //foreach (var typeContext in context.typeDeclaration())
            //{
            //    PlanningType type;
            //    if (typeContext.LB() == null)
            //    {
            //        type = new PlanningType {Name = typeContext.GetText()};
            //    }
            //    else
            //    {
            //        string name = typeContext.GetText();
            //        int min = int.Parse(typeContext.constTerm(0).GetText());
            //        int max = int.Parse(typeContext.constTerm(1).GetText());
            //        type = new PlanningNumericType {Name = name, Min = min, Max = max};
            //    }

            //    _typeList.Add(type);
            //}
        }
Ejemplo n.º 4
0
 public TermInterpreter(PlanningParser.NumericSettingContext numericSettingContext, PlanningParser.TypeDefineContext typeDefineContext,
                        PlanningParser.ObjectDeclarationContext objDecContext)
 {
     BuildNumericConst(numericSettingContext);
     BuildTypeDict(typeDefineContext);
     BuildConstTypeMap(objDecContext);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="PlanningParser.typeDefine"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitTypeDefine([NotNull] PlanningParser.TypeDefineContext context)
 {
 }