Example #1
0
        public object VisitSystem([NotNull] ArchelementContext context)
        {
            //     Console.WriteLine("VisitSystem: "+ context.system().ID());
            SystemConfig systemCfg = new SystemConfig(context.system().ID().GetText());

            if (context.feature() != null)
            {
                // parsing each define
                FeatureContext[] defines = context.feature();
                foreach (var ctx in defines)
                {
                    // visit declare
                    if (ctx.declare() != null)
                    {
                        ConfigDeclaration declare = (ConfigDeclaration)VisitDeclare(ctx.declare());
                        if (declare != null)
                        {
                            systemCfg.declareList.Add(declare);
                        }

                        // visit attach
                    }
                    else if (ctx.attach() != null)
                    {
                        Attachment attach = (Attachment)VisitAttach(ctx.attach());
                        if (attach != null)
                        {
                            systemCfg.attachList.Add(attach);
                        }

                        // visit glue
                    }
                    else if (ctx.execute() != null)
                    {
                        systemCfg.Exec = (SysProcess)VisitExecute(ctx.execute());
                    }
                }
                // parsing each attach
            }
            return(systemCfg);
        }
Example #2
0
        public Connector VisitConnector([NotNull] ArchelementContext context)
        {
            if (context.connector().ID() == null)
            {
                return(null);
            }
            Connector connector = new Connector(context.connector().ID().GetText());

            if (context.feature() != null)
            {
                // parsing each role
                FeatureContext[] roles = context.feature();
                foreach (var ctx in roles)
                {
                    Feature ftr = (Feature)Visit(ctx);
                    if (ftr != null)
                    {
                        connector.roleList.Add(ftr);
                    }
                }
            }
            return(connector);
        }
Example #3
0
        public Component VisitComponent([NotNull] ArchelementContext context)
        {
            if (context.component().ID() == null)
            {
                return(null);
            }

            Component comp = new Component(context.component().ID().GetText());

            if (context.feature() != null)
            {
                // parsing each port
                FeatureContext[] ports = context.feature();
                foreach (var ctx in ports)
                {
                    Feature port = (Feature)Visit(ctx);
                    if (port != null)
                    {
                        comp.portList.Add(port);
                    }
                }
            }
            return(comp);
        }