// filles the options (dictonairy) of there respective factories. // calles all diferent options to register themselves at there factories public static void RegisterStrategies() { CalculationStrategyFactory.GetInstance().ResetDictionary(); CalculationStrategyDecoratorFactory.GetInstance().ResetDictionary(); AND.RegisterStrategy(); OR.RegisterStrategy(); NOT.RegisterStrategy(); NOTDecorator.RegisterStrategy(); }
public void AddStrategy(string strategyName) { ICalculationStrategy strategy; if (strategyName == "NAND") { strategy = CalculationStrategyFactory.GetInstance().CreateStrategy("AND"); strategy = CalculationStrategyDecoratorFactory.GetInstance().CreateStrategy(strategy, "NOTDecorator"); _node.AddStrategy(strategy); } else if (strategyName == "NOR") { strategy = CalculationStrategyFactory.GetInstance().CreateStrategy("OR"); strategy = CalculationStrategyDecoratorFactory.GetInstance().CreateStrategy(strategy, "NOTDecorator"); _node.AddStrategy(strategy); } else { strategy = CalculationStrategyFactory.GetInstance().CreateStrategy(strategyName); _node.AddStrategy(strategy); } }
public static void RegisterStrategy() { CalculationStrategyDecoratorFactory.GetInstance().AddNodeType <NOTDecorator>("NOTDecorator"); }