Exemple #1
0
 public UntilRangeTemplateElement(AbstractTemplateElement parent) : base(parent)
 {
     Minimum = new VariableConditionPart {
         VariableName = "Min2"
     };
     Maximum = new OperationConditionPart
     {
         LeftSide = new VariableConditionPart {
             VariableName = "Max2"
         },
         RightSide = new LiteralConditionPart {
             Value = "1"
         },
         Operator = ConditionPartOperatorEnum.Add
     };
     InludeMaximum = false;
     Elements      = new AbstractTemplateElement[]
     {
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine
         },
         new DefineITemplateElement(this),
         new StaticTemplateElement(this)
         {
             Content = " " + Environment.NewLine + "-)   Counting From {Min2} UNTIL {Max2} : {I}  {FAV}    " + Environment.NewLine
         }
     };
 }
Exemple #2
0
 public DefineITemplateElement(AbstractTemplateElement parent) : base(parent)
 {
     IsArray  = false;
     Variable = new VariableConditionPart {
         VariableName = "FAV"
     };
     Elements = new AbstractTemplateElement[]
     {
         new I42ConditionalTemplateElement(this),
     };
 }
Exemple #3
0
 public ChoicesEnumeratorTemplateElement(AbstractTemplateElement parent) : base(parent)
 {
     EnumerationCondition = new VariableConditionPart {
         VariableName = "Choice"
     };
     Elements = new AbstractTemplateElement[]
     {
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine + "- {Choice}" + Environment.NewLine
         }
     };
 }
Exemple #4
0
 public ChoiceDefineTemplateElement(AbstractTemplateElement parent) : base(parent)
 {
     IsArray  = true;
     Variable = new VariableConditionPart {
         VariableName = "Choice"
     };
     Elements = new AbstractTemplateElement[]
     {
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine + "Choice1" + Environment.NewLine + "Choice2" + Environment.NewLine + "Choice3" + Environment.NewLine + "BadChoice" + Environment.NewLine
         }
     };
 }
Exemple #5
0
 public AnimalDefineTemplateElement(AbstractTemplateElement parent) : base(parent)
 {
     IsArray  = false;
     Variable = new VariableConditionPart {
         VariableName = "Animal"
     };
     Elements = new AbstractTemplateElement[]
     {
         new StaticTemplateElement(this)
         {
             Content = "Rabbit"
         }
     };
 }
Exemple #6
0
 public ChocolatesEnumeratorTemplateElement(AbstractTemplateElement parent) : base(parent)
 {
     EnumerationCondition = new VariableConditionPart {
         VariableName = "Chocolate"
     };
     Elements = new AbstractTemplateElement[]
     {
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine
         },
         new FruitsEnumeratorTemplateElement(this),
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine
         },
     };
 }
Exemple #7
0
        private void SerializeVarPart(TextWriter tw, VariableConditionPart varPart)
        {
            string enumerationVariable = varPart.VariableName;

            var arrs = new Dictionary <string, IEnumerable <string> >(Arrays);

            arrs.Remove(enumerationVariable);

            var vars = new Dictionary <string, string>(Variables)
            {
                { enumerationVariable, null }
            };

            foreach (var value in Arrays[enumerationVariable])
            {
                vars[enumerationVariable] = value;
                foreach (var elem in Element.Elements)
                {
                    TemplateSerializationFactory.Serialize(tw, elem, vars, arrs, Parms);
                }
            }
        }
Exemple #8
0
 public FruitsEnumeratorTemplateElement(AbstractTemplateElement parent) : base(parent)
 {
     EnumerationCondition = new VariableConditionPart {
         VariableName = "Fruit"
     };
     Elements = new AbstractTemplateElement[]
     {
         new StaticTemplateElement(this)
         {
             Content = "    " + Environment.NewLine
         },
         new BobAndBillyConditionalTemplateElement(this),
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine
         },
         new ChocolateConditionalTemplateElement(this),
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine
         },
     };
 }
Exemple #9
0
 public PeopleEnumeratorTemplateElement(AbstractTemplateElement parent) : base(parent)
 {
     EnumerationCondition = new VariableConditionPart {
         VariableName = "Person"
     };
     Elements = new AbstractTemplateElement[]
     {
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine + "Hello I am {Person} ({BigNumber}) "
         },
         new BigNumberConditionalTemplateElement(this),
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine + Environment.NewLine + "*******" + Environment.NewLine
         },
         new ChocolatesEnumeratorTemplateElement(this),
         new StaticTemplateElement(this)
         {
             Content = Environment.NewLine
         },
     };
 }