Exemple #1
0
        private InPort Find(JInPort jInPort, Model sourceModel)
        {
            if (jInPort.Id is null)
            {
                throw logger.Error(new ModelException(sourceModel, "Property `id` not found."));
            }
            if (jInPort.InPortName is null)
            {
                throw logger.Error(new ModelException(sourceModel, "Property `in-port` not found."));
            }
            ModelSymbol modelSymbol = symbolTable.Lookup(jInPort.Id) as ModelSymbol;

            if (modelSymbol is null)
            {
                throw logger.Error(new LigralException($"Reference {jInPort.Id} not exist"));
            }
            Model  destinationModel = modelSymbol.GetValue() as Model;
            InPort inPort           = destinationModel.Expose(jInPort.InPortName) as InPort;

            if (inPort is null)
            {
                throw logger.Error(new LigralException($"{jInPort.InPortName} is not in port."));
            }
            return(inPort);
        }
Exemple #2
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);
            }
        }