/// <summary> /// Gets the predefined construction from a <see cref="PredefinedConstructionType"/>. /// </summary> /// <param name="type">The type</param> /// <returns>The construction</returns> public static PredefinedConstruction GetPredefinedconstruction(PredefinedConstructionType type) { // Find the property info for the property handling our predefined type var propertyInfo = typeof(PredefinedConstructions).GetProperty(type.ToString()); // Check if it's not null if (propertyInfo == null) { throw new GeoGenException($"The type {type} of a construction doesn't have the implementation in the {nameof(PredefinedConstructions)} class."); } // Otherwise we invoke it and return the casted result return((PredefinedConstruction)propertyInfo.GetMethod.Invoke(obj: null, parameters: null)); }
/// <summary> /// Initializes a new instance of the <see cref="PredefinedConstruction"/> class. /// </summary> /// <param name="type">The type of the predefined construction.</param> /// <param name="parameters">The parameters representing the signature of the construction.</param> /// <param name="outputType">The output type of the construction.</param> public PredefinedConstruction(PredefinedConstructionType type, IReadOnlyList <ConstructionParameter> parameters, ConfigurationObjectType outputType) : base(type.ToString(), parameters, outputType) { Type = type; }
/// <summary> /// Initializes a new instance of the <see cref="PredefinedConstructorBase"/> class. /// </summary> /// <param name="tracer">The tracer for unexpected analytic exceptions.</param> protected PredefinedConstructorBase(IConstructorFailureTracer tracer) : base(tracer) { Type = FindTypeFromClassName(); }
/// <summary> /// Initializes a new instance of the <see cref="ConstructedConfigurationObject"/> class /// using a predefined construction of a given type and input objects. /// </summary> /// <param name="type">The type of the predefined construction to be performed.</param> /// <param name="input">The input objects in the flattened order (see <see cref="Arguments.FlattenedList")/></param> public ConstructedConfigurationObject(PredefinedConstructionType type, params ConfigurationObject[] input) : this(Constructions.GetPredefinedconstruction(type), input) { }