Example #1
0
        protected override void visitConfigurationSpecification(ConfigurationSpecification specification)
        {
            writer.Append(KeywordEnum.FOR.ToString()).Append(' ');
            output.writeComponentSpecification(specification.ComponentSpecification);

            if (specification.EntityAspect != null)
            {
                writer.Append(' ').Append(KeywordEnum.USE.ToString()).Append(' ');
                writer.Append(specification.EntityAspect.ToString());
            }

            if (specification.GenericMap.Count != 0)
            {
                writer.NewLine();
                writer.Append(KeywordEnum.GENERIC.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().genericMap(specification.GenericMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }

            if (specification.PortMap.Count != 0)
            {
                writer.NewLine();
                writer.Append(KeywordEnum.PORT.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().portMap(specification.PortMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }

            writer.Append(';').NewLine();
        }
        protected override void visitComponentConfiguration(ComponentConfiguration configuration)
        {
            writer.Append(KeywordEnum.FOR.ToString()).Append(' ');
            output.writeComponentSpecification(configuration.ComponentSpecification);
            writer.Indent();

            bool hasBindingIndication = false;

            if (configuration.EntityAspect != null)
            {
                hasBindingIndication = true;
                writer.NewLine().Append(KeywordEnum.USE.ToString()).Append(' ');
                writer.Append(configuration.EntityAspect.ToString());
            }

            if (configuration.GenericMap.Count != 0)
            {
                hasBindingIndication = true;
                writer.NewLine();
                writer.Append(KeywordEnum.GENERIC.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().genericMap(configuration.GenericMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }

            if (configuration.PortMap.Count != 0)
            {
                hasBindingIndication = true;
                writer.NewLine();
                writer.Append(KeywordEnum.PORT.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().portMap(configuration.PortMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }

            if (hasBindingIndication)
            {
                writer.Append(";");
            }

            writer.NewLine();

            if (configuration.BlockConfiguration != null)
            {
                visit(configuration.BlockConfiguration);
            }
            writer.Dedent().Append(KeywordEnum.END.ToString()).Append(KeywordEnum.FOR.ToString());
            writer.Append(';').NewLine();
        }
        private void appendComponentInstantiationMaps(AbstractComponentInstantiation instantiation)
        {
            if (instantiation.GenericMap.Count != 0)
            {
                writer.NewLine();
                writer.Append(KeywordEnum.GENERIC.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().genericMap(instantiation.GenericMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }

            if (instantiation.PortMap.Count != 0)
            {
                writer.NewLine();
                writer.Append(KeywordEnum.PORT.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().portMap(instantiation.PortMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }
        }
Example #4
0
        protected override void visitPhysicalType(PhysicalType type)
        {
            //TODO: implement repeated label
            appendTypePrefix(type);
            writer.Append(' ').Append(KeywordEnum.RANGE.ToString()).Append(' ');
            output.writeDiscreteRange(type.Range);
            writer.Append(' ').NewLine();
            writer.Indent().Append(KeywordEnum.UNITS.ToString()).NewLine();
            writer.Indent().Append(type.PrimaryUnit).Append(';').NewLine().BeginAlign();
            foreach (PhysicalType.Unit unit in type.Units)
            {
                writer.AppendIdentifier(unit).Align().Append(" = ");
                if (unit.Factor != null)
                {
                    output.writeExpression(unit.Factor);
                    writer.Append(' ');
                }
                writer.Append(unit.BaseUnit).Append(';').NewLine();
            }
            writer.EndAlign().Dedent();

            writer.Append(KeywordEnum.END.ToString()).Append(KeywordEnum.UNITS.ToString()).Append(';').Dedent().NewLine();
        }