Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SubSystemBudgetResult{T}"/> class
 /// </summary>
 /// <param name="subsystem">The corresponding <see cref="SubSystem"/></param>
 /// <param name="config">The <see cref="Config.BudgetConfig"/></param>
 /// <param name="option">The current <see cref="Option"/></param>
 /// <param name="domain">The current <see cref="DomainOfExpertise"/></param>
 protected SubSystemBudgetResult(SubSystem subsystem, BudgetConfig config, Option option, DomainOfExpertise domain)
 {
     this.SubSystem     = subsystem;
     this.BudgetConfig  = config;
     this.Option        = option;
     this.CurrentDomain = domain;
 }
Example #2
0
        /// <summary>
        /// Determines whether the <paramref name="usage"/> is a sub-system
        /// </summary>
        /// <param name="usage">The <see cref="ElementUsage"/></param>
        /// <param name="subSystemList">The list of sub-systems</param>
        /// <param name="config">The current <see cref="BudgetConfig"/></param>
        protected void FindSubSystem(ElementUsage usage, List <SubSystem> subSystemList, BudgetConfig config)
        {
            var associatedSubSystems = config.SubSystemDefinition.Where(x => x.IsThisSubSystem(usage)).ToList();

            if (associatedSubSystems.Count > 1)
            {
                throw new BudgetComputationException($"multiple sub-system definitions match the element usage {usage.Name}.");
            }

            if (associatedSubSystems.Count == 1)
            {
                var associatedSubSystem = associatedSubSystems.Single();

                var subSystem = new SubSystem(associatedSubSystem, usage);
                if (subSystemList.Any(x => x.SubSystemDefinition == associatedSubSystem))
                {
                    throw new BudgetComputationException("multiple same subsystems found.");
                }

                subSystemList.Add(subSystem);
            }
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SubSystemGenericOfTBudgetResult{T}"/> class
 /// </summary>
 /// <param name="subsystem">The corresponding <see cref="SubSystem"/></param>
 /// <param name="config">The <see cref="BudgetConfig"/></param>
 /// <param name="option">The current <see cref="Option"/></param>
 /// <param name="domain">The current <see cref="DomainOfExpertise"/></param>
 protected SubSystemGenericOfTBudgetResult(SubSystem subsystem, BudgetConfig config, Option option, DomainOfExpertise domain) : base(subsystem, config, option, domain)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SubSystemGenericBudgetResult"/> class
 /// </summary>
 /// <param name="subsystem">The corresponding <see cref="SubSystem"/></param>
 /// <param name="config">The <see cref="BudgetConfig"/></param>
 /// <param name="option">The current <see cref="Option"/></param>
 /// <param name="domain">The current <see cref="DomainOfExpertise"/></param>
 public SubSystemGenericBudgetResult(SubSystem subsystem, BudgetConfig config, Option option, DomainOfExpertise domain) : base(subsystem, config, option, domain)
 {
     this.ComputeValuesFromSubSystem();
     this.ComputeValuesFromEquipment();
 }