/// <summary> /// Creates a new <see cref="ReactionPipelineStage"/> with the specified reaction being run if any of the specified stages are invalidated. /// </summary> /// <param name="reaction">The reaction to any invalidation.</param> /// <param name="stages">The stages to react to.</param> /// <exception cref="ArgumentNullException">If <paramref name="reaction"/> or <paramref name="stages"/> are null.</exception> public ReactionPipelineStage(Action reaction, params IPipelineStage[] stages) { Reaction = reaction ?? throw new ArgumentNullException(nameof(reaction)); Stages = stages?.ToArray() ?? throw new ArgumentNullException(nameof(stages)); Name = "Reaction to {" + string.Join(", ", Stages.Select(s => s.Name)) + "}"; this.AddDependencies(stages); }
public string GetLogMessage() { return(string.Format(@"------------- Launcher -------------- Launch mass (kg) = {0} Payload (kg) = {1} Stages: {2} Fairing mass (kg) = {3} Fairing jettision (s) = {4} ------------- Launcher --------------", LaunchMass, Payload, string.Join("\r\n", Stages.Select(s => s.GetLogMessage())), FairingMass, FairingJettision)); }
/// <summary> /// Gets a fields value as a string suitable for things like, oh, a velocity template /// </summary> /// <param name="field">A FormFields enum value</param> /// <returns>The value of the field, OR, and error message</returns> public string GetFieldAsString(FormFields field) { try { switch (field) { case FormFields.MainType: { return(MainType.Label); } case FormFields.SubTypes: { return(String.Join(", ", SubTypes.Select(st => st.Label))); } case FormFields.Stages: { return(String.Join(", ", Stages.Select(stg => stg.Label)));; } case FormFields.Findings: { return(String.Join(", ", Findings.Select(fin => fin.Label))); } case FormFields.Age: { return(Age.ToString()); } case FormFields.Phrase: { return(Phrase); } case FormFields.HealthyVolunteers: { switch (_healthyVols) { case HealthyVolunteerType.Healthy: { return("Only Accepting Healthy Volunteers"); } case HealthyVolunteerType.Infirmed: { return("Not Accepting Healthy Volunteers"); } default: { return("Accepting All Volunteers"); } } } case FormFields.Gender: { return(Gender); } case FormFields.TrialTypes: { return(String.Join(", ", TrialTypes.Select(tt => tt.Label))); } case FormFields.Drugs: { return(String.Join(", ", Drugs.Select(d => d.Label))); } case FormFields.OtherTreatments: { return(String.Join(", ", OtherTreatments.Select(ot => ot.Label)));; } case FormFields.TrialPhases: { return(String.Join(", ", TrialPhases.Select(tp => tp.Label))); } case FormFields.TrialIDs: { return(String.Join(", ", TrialIDs)); } case FormFields.Investigator: { return(Investigator); } case FormFields.LeadOrg: { return(LeadOrg); } case FormFields.IsVAOnly: { if (IsVAOnly) { return("True"); } else { return("False"); } } case FormFields.AtNIH: case FormFields.City: case FormFields.State: case FormFields.Country: case FormFields.Hospital: case FormFields.ZipCode: case FormFields.ZipRadius: { return(GetLocFieldAsString(field)); } default: { return("Error Retrieving Field"); } } } catch (Exception) { return("Error Retrieving Field"); } }