Пример #1
0
        public static ITSLTopLevelElement GenerateCell(this TSLGeneratorContext context)
        {
            var name           = $"CellStruct_{context.TopLevelElementCount + 1}";
            var numberOfFields = DiscreteUniform.Sample(context.MasterRandom, StructSettings.MinFieldNumber, StructSettings.MaxFieldNumber);
            var fields         = context.RandomFields().Take(numberOfFields).ToArray();
            var result         = new TSLCell(name, fields);

            context.Cells.Add(result);
            return(result);
        }
Пример #2
0
        public static ITSLTopLevelElement GenerateStruct(this TSLGeneratorContext context)
        {
            var name           = $"Struct_{context.TopLevelElementCount + 1}";
            var numberOfFields = DiscreteUniform.Sample(context.MasterRandom, StructSettings.MinFieldNumber, StructSettings.MaxFieldNumber);
            var fields         = context.RandomFields().Take(numberOfFields);
            // TODO(leasunhy): generate attributes
            var result = new TSLStruct(name, fields);

            context.AddStruct(result);
            return(result);
        }