public override void parse(string content, ChoiceParameter parent) { // { // { make_tuple("Wind-turbine", CHOICE_ELEMENT_NEW<CWindTurbine>, "World=Wind-turbine")}, //{ make_tuple("Underwater-vehicle", CHOICE_ELEMENT_NEW<CUnderwaterVehicle>, "World=Underwater-vehicle")}, //{ make_tuple("Pitch-control", CHOICE_ELEMENT_NEW<CPitchControl>, "World=Pitch-control")}, //{ make_tuple("Balancing-pole", CHOICE_ELEMENT_NEW<CBalancingPole>, "World=Balancing-pole")}, //{ make_tuple("Mountain-car", CHOICE_ELEMENT_NEW<CMountainCar>, "World=Mountain-car") } // }); string sChoiceElementPattern = @"{\s*make_tuple\s*\(\s*""([^""]+)""\s*,\s*CHOICE_ELEMENT_(NEW|FACTORY)\s*<(\w+)>\s*,\s*""([^""]*)""\s*\)\s*}"; foreach (Match choiceElementMatch in Regex.Matches(content, sChoiceElementPattern)) { string choiceElementName = choiceElementMatch.Groups[1].Value.Trim(' ', '"'); string choiceElementClass = choiceElementMatch.Groups[3].Value.Trim(' ', '"'); string choiceElementType = choiceElementMatch.Groups[2].Value.Trim(' ', '"'); string badgerMetadata = choiceElementMatch.Groups[4].Value.Trim(' ', '"'); ChoiceElementParameter.Type type; if (choiceElementType == "NEW") { type = ChoiceElementParameter.Type.New; } else { type = ChoiceElementParameter.Type.Factory; } ChoiceElementParameter choiceElement = new ChoiceElementParameter(choiceElementName , choiceElementClass, type, badgerMetadata); parent.AddParameter(choiceElement); } }
public override void parse(string content, ChoiceParameter parent) { // { // { make_tuple("Wind-turbine", CHOICE_ELEMENT_NEW<CWindTurbine>, "World=Wind-turbine")}, //{ make_tuple("Underwater-vehicle", CHOICE_ELEMENT_NEW<CUnderwaterVehicle>, "World=Underwater-vehicle")}, //{ make_tuple("Pitch-control", CHOICE_ELEMENT_NEW<CPitchControl>, "World=Pitch-control")}, //{ make_tuple("Balancing-pole", CHOICE_ELEMENT_NEW<CBalancingPole>, "World=Balancing-pole")}, //{ make_tuple("Mountain-car", CHOICE_ELEMENT_NEW<CMountainCar>, "World=Mountain-car") } // }); string sChoiceElementPattern = @"{\s*make_tuple\s*\(\s*""([^""]+)""\s*,\s*CHOICE_ELEMENT_(NEW|FACTORY)\s*<(\w+)>\s*,\s*""([^""]*)""\s*\)\s*}"; foreach (Match choiceElementMatch in Regex.Matches(content, sChoiceElementPattern)) { string choiceElementName = choiceElementMatch.Groups[1].Value.Trim(' ', '"'); string choiceElementClass = choiceElementMatch.Groups[3].Value.Trim(' ', '"'); string choiceElementType = choiceElementMatch.Groups[2].Value.Trim(' ', '"'); string badgerMetadata = choiceElementMatch.Groups[4].Value.Trim(' ', '"'); ChoiceElementParameter.Type type; if (choiceElementType == "NEW") type = ChoiceElementParameter.Type.New; else type = ChoiceElementParameter.Type.Factory; ChoiceElementParameter choiceElement = new ChoiceElementParameter(choiceElementName , choiceElementClass, type, badgerMetadata); parent.addParameter(choiceElement); } }
public override void parse(string content, ChoiceParameter parent) { // { // { "Deterministic-Policy-Gaussian-Noise",CHOICE_ELEMENT_NEW<CDeterministicPolicyGaussianNoise>}, //{ "Stochastic-Policy-Gaussian-Noise",CHOICE_ELEMENT_NEW<CStochasticPolicyGaussianNoise>} // }); string sChoiceElementPattern = @"{\s*""([^""]+)"",\s*CHOICE_ELEMENT_(NEW|FACTORY)\s*<(\w+)>\s*}"; foreach (Match choiceElementMatch in Regex.Matches(content, sChoiceElementPattern)) { string choiceElementName = choiceElementMatch.Groups[1].Value.Trim(' ', '"'); string choiceElementClass = choiceElementMatch.Groups[3].Value.Trim(' ', '"'); string choiceElementType = choiceElementMatch.Groups[2].Value.Trim(' ', '"'); ChoiceElementParameter.Type type; if (choiceElementType == "NEW") { type = ChoiceElementParameter.Type.New; } else { type = ChoiceElementParameter.Type.Factory; } ChoiceElementParameter choiceElement = new ChoiceElementParameter(choiceElementName , choiceElementClass, type); parent.AddParameter(choiceElement); } }
public override void parse(string content, ChoiceParameter parent) { // { // { "Deterministic-Policy-Gaussian-Noise",CHOICE_ELEMENT_NEW<CDeterministicPolicyGaussianNoise>}, //{ "Stochastic-Policy-Gaussian-Noise",CHOICE_ELEMENT_NEW<CStochasticPolicyGaussianNoise>} // }); string sChoiceElementPattern = @"{\s*""([^""]+)"",\s*CHOICE_ELEMENT_(NEW|FACTORY)\s*<(\w+)>\s*}"; foreach (Match choiceElementMatch in Regex.Matches(content, sChoiceElementPattern)) { string choiceElementName = choiceElementMatch.Groups[1].Value.Trim(' ', '"'); string choiceElementClass = choiceElementMatch.Groups[3].Value.Trim(' ', '"'); string choiceElementType = choiceElementMatch.Groups[2].Value.Trim(' ', '"'); ChoiceElementParameter.Type type; if (choiceElementType == "NEW") type = ChoiceElementParameter.Type.New; else type = ChoiceElementParameter.Type.Factory; ChoiceElementParameter choiceElement = new ChoiceElementParameter(choiceElementName , choiceElementClass, type); parent.addParameter(choiceElement); } }