Exemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of <see cref="GeneralResult{T}"/>
        /// </summary>
        /// <param name="governingWindDirection">The governing wind direction.</param>
        /// <param name="stochasts">The general alpha values.</param>
        /// <param name="topLevelIllustrationPoints">A collection of illustration points
        /// for every combination of wind directions and closing situations.</param>
        /// <exception cref="ArgumentNullException">Thrown when any of the input
        /// parameters is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when:
        /// <list type="bullet">
        /// <item>the stochasts in child nodes are not equal to the general result's stochasts;</item>
        /// <item>the general result's stochasts contains duplicates;</item>
        /// <item>the top level illustration points have a duplicate
        /// combination of closing situation and wind direction.</item>
        /// </list>
        /// </exception>
        public GeneralResult(WindDirection governingWindDirection,
                             IEnumerable <Stochast> stochasts,
                             IEnumerable <T> topLevelIllustrationPoints)
        {
            if (governingWindDirection == null)
            {
                throw new ArgumentNullException(nameof(governingWindDirection));
            }

            if (stochasts == null)
            {
                throw new ArgumentNullException(nameof(stochasts));
            }

            if (topLevelIllustrationPoints == null)
            {
                throw new ArgumentNullException(nameof(topLevelIllustrationPoints));
            }

            StochastValidator.ValidateStochasts(stochasts);
            ValidateTopLevelIllustrationPoints(topLevelIllustrationPoints);
            ValidateStochastInChildren(topLevelIllustrationPoints, stochasts);

            GoverningWindDirection = governingWindDirection;
            Stochasts = stochasts;
            TopLevelIllustrationPoints = topLevelIllustrationPoints;
        }
        /// <summary>
        /// Creates a new instance of <see cref="FaultTreeIllustrationPoint"/>.
        /// </summary>
        /// <param name="name">The name of the illustration point node.</param>
        /// <param name="beta">The beta value of this illustration point.</param>
        /// <param name="stochasts">A collection of <see cref="Stochasts"/>
        /// that are associated with this illustration point node.</param>
        /// <param name="combinationType">The way to combine two nodes into a single
        /// tree node element in the fault tree.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="name"/> or
        /// <paramref name="stochasts"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when the <see cref="stochasts"/> aren't unique.</exception>
        public FaultTreeIllustrationPoint(string name,
                                          double beta,
                                          IEnumerable <Stochast> stochasts,
                                          CombinationType combinationType)
            : base(name, beta)
        {
            if (stochasts == null)
            {
                throw new ArgumentNullException(nameof(stochasts));
            }

            StochastValidator.ValidateStochasts(stochasts);

            CombinationType = combinationType;
            Stochasts       = stochasts;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new instance of <see cref="SubMechanismIllustrationPoint"/>.
        /// </summary>
        /// <param name="name">The name of the illustration point result.</param>
        /// <param name="beta">The beta value that was realized.</param>
        /// <param name="stochasts">The stochasts for the sub mechanism illustration point.</param>
        /// <param name="illustrationPointResults">The output variables.</param>
        /// <exception cref="ArgumentNullException">Thrown when any of the following parameters is <c>null</c>:
        /// <list type="bullet">
        /// <item><paramref name="name"/>;</item>
        /// <item><paramref name="stochasts"/>;</item>
        /// <item><paramref name="illustrationPointResults"/>.</item>
        /// </list></exception>
        /// <exception cref="ArgumentException">Thrown when the <see cref="stochasts"/> aren't unique.</exception>
        public SubMechanismIllustrationPoint(string name,
                                             double beta,
                                             IEnumerable <SubMechanismIllustrationPointStochast> stochasts,
                                             IEnumerable <IllustrationPointResult> illustrationPointResults)
            : base(name, beta)
        {
            if (stochasts == null)
            {
                throw new ArgumentNullException(nameof(stochasts));
            }

            if (illustrationPointResults == null)
            {
                throw new ArgumentNullException(nameof(illustrationPointResults));
            }

            StochastValidator.ValidateStochasts(stochasts);
            ValidateResults(illustrationPointResults);

            Stochasts = stochasts;
            IllustrationPointResults = illustrationPointResults;
        }