コード例 #1
0
        private void Construct(JModel jModel)
        {
            ModelSymbol modelSymbol = symbolTable.Lookup(jModel.Id) as ModelSymbol;

            if (modelSymbol is null)
            {
                throw logger.Error(new NotFoundException($"Reference {jModel.Id}"));
            }
            Model model = modelSymbol.GetValue() as Model;

            if (jModel.OutPorts is null)
            {
                throw logger.Error(new ModelException(model, "Property `out-ports` not found."));
            }
            foreach (JOutPort jOutPort in jModel.OutPorts)
            {
                Connect(jOutPort, model);
            }
        }
コード例 #2
0
        private void Register(JModel jModel)
        {
            if (jModel.Type is null)
            {
                throw logger.Error(new NotFoundException("Property `type`"));
            }
            Model model = ModelManager.Create(jModel.Type);

            if (jModel.Id is null)
            {
                throw logger.Error(new ModelException(model, "Property `id` not found."));
            }
            model.Name = jModel.Id;
            TypeSymbol  typeSymbol  = symbolTable.Lookup("MODEL") as TypeSymbol;
            ModelSymbol modelSymbol = new ModelSymbol(jModel.Id, typeSymbol, model);

            symbolTable.Insert(modelSymbol);
            if (jModel.Parameters is null)
            {
                throw logger.Error(new ModelException(model, "Property `parameters` not found."));
            }
            Config(jModel.Parameters, model);
        }