示例#1
0
        /// <summary>
        /// Creates an instance of <see cref="AggregatedSerializableFailureMechanismSectionAssembly"/> based on its input parameters.
        /// </summary>
        /// <param name="idGenerator">The id generator to generate the id for the serializable components.</param>
        /// <param name="serializableFailureMechanism">The <see cref="SerializableFailureMechanism"/> the section assembly belongs to.</param>
        /// <param name="serializableCollection">The <see cref="SerializableFailureMechanismSectionCollection"/> the section assembly belongs to.</param>
        /// <param name="failureMechanismSectionAssemblyResult">An aggregated failure mechanism section assembly result to
        /// create an <see cref="AggregatedSerializableFailureMechanismSectionAssembly"/> for.</param>
        /// <returns>An <see cref="AggregatedSerializableFailureMechanismSectionAssembly"/>.</returns>
        /// <exception cref="AssemblyCreatorException">Thrown when <paramref name="failureMechanismSectionAssemblyResult"/> is invalid to create a serializable counterpart for.</exception>
        /// <exception cref="NotSupportedException">Thrown when an <see cref="AggregatedSerializableFailureMechanismSectionAssembly"/>
        /// cannot be created for <paramref name="failureMechanismSectionAssemblyResult"/>.</exception>
        private static AggregatedSerializableFailureMechanismSectionAssembly CreateFailureMechanismSectionAssembly(
            IdentifierGenerator idGenerator,
            SerializableFailureMechanism serializableFailureMechanism,
            SerializableFailureMechanismSectionCollection serializableCollection,
            ExportableFailureMechanismSectionAssemblyWithProbabilityResult failureMechanismSectionAssemblyResult)
        {
            SerializableFailureMechanismSection failureMechanismSection = SerializableFailureMechanismSectionCreator.Create(
                idGenerator, serializableCollection, failureMechanismSectionAssemblyResult.FailureMechanismSection);

            var failureMechanismSectionAssembly = new SerializableFailureMechanismSectionAssembly(
                idGenerator.GetNewId(Resources.SerializableFailureMechanismSectionAssembly_IdPrefix),
                serializableFailureMechanism, failureMechanismSection,
                SerializableFailureMechanismSectionAssemblyResultCreator.Create(failureMechanismSectionAssemblyResult));

            return(new AggregatedSerializableFailureMechanismSectionAssembly(failureMechanismSection, failureMechanismSectionAssembly));
        }
示例#2
0
        /// <summary>
        /// Creates an instance of <see cref="AggregatedSerializableCombinedFailureMechanismSectionAssembly"/>
        /// based on its input parameters.
        /// </summary>
        /// <param name="idGenerator">The generator to generate ids for the serializable components.</param>
        /// <param name="serializableTotalAssemblyResult">The <see cref="SerializableTotalAssemblyResult"/> the serializable
        /// components belongs to.</param>
        /// <param name="serializableFailureMechanismSectionCollection">The <see cref="SerializableFailureMechanismSectionCollection"/>
        /// the serializable failure mechanism sections belong to.</param>
        /// <param name="combinedSectionAssembly">The <see cref="ExportableCombinedSectionAssembly"/> to create an
        /// <see cref="AggregatedSerializableCombinedFailureMechanismSectionAssembly"/> for.</param>
        /// <returns>An <see cref="AggregatedSerializableCombinedFailureMechanismSectionAssembly"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        /// <exception cref="AssemblyCreatorException">Thrown when <paramref name="combinedSectionAssembly"/>
        /// is invalid to create a serializable counterpart for.</exception>
        public static AggregatedSerializableCombinedFailureMechanismSectionAssembly Create(IdentifierGenerator idGenerator,
                                                                                           SerializableTotalAssemblyResult serializableTotalAssemblyResult,
                                                                                           SerializableFailureMechanismSectionCollection serializableFailureMechanismSectionCollection,
                                                                                           ExportableCombinedSectionAssembly combinedSectionAssembly)
        {
            if (idGenerator == null)
            {
                throw new ArgumentNullException(nameof(idGenerator));
            }

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

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

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

            SerializableFailureMechanismSection failureMechanismSection = SerializableFailureMechanismSectionCreator.Create(
                idGenerator, serializableFailureMechanismSectionCollection, combinedSectionAssembly.Section);

            return(new AggregatedSerializableCombinedFailureMechanismSectionAssembly(
                       failureMechanismSection,
                       new SerializableCombinedFailureMechanismSectionAssembly(
                           idGenerator.GetNewId(Resources.SerializableCombinedFailureMechanismSectionAssembly_IdPrefix),
                           serializableTotalAssemblyResult,
                           failureMechanismSection,
                           combinedSectionAssembly.FailureMechanismResults
                           .Select(SerializableCombinedFailureMechanismSectionAssemblyResultCreator.Create)
                           .ToArray(),
                           new SerializableFailureMechanismSubSectionAssemblyResult(
                               SerializableAssemblyMethod.BOI3C1,
                               SerializableFailureMechanismSectionAssemblyGroupCreator.Create(
                                   combinedSectionAssembly.CombinedSectionAssemblyResult.AssemblyGroup)))));
        }