示例#1
0
        public static ContractEvaluator DemandContract(IUIMap uiMap, string population, string installation, int amount)
        {
            var evaluator = new ContractEvaluator("contract", uiMap);

            new EvaluatorParameterizer().SetParameters(evaluator, population, amount, installation, false);
            return(evaluator);
        }
        protected override void Evaluate()
        {
            if (Parameters.Count != 4)
            {
                throw new Exception(string.Format("Expected 4 parameters, got {0} in function name {1}.",
                                                  Parameters.Count, Text));
            }

            var supplyContract = ContractEvaluator.SupplyContract(UIMap, Parameters[0], Parameters[3], Convert.ToInt32(Parameters[2]));
            var demandContract = ContractEvaluator.DemandContract(UIMap, Parameters[1], Parameters[3], Convert.ToInt32(Parameters[2]));

            supplyContract.Execute();
            demandContract.Execute();
        }