public override object Clone() { var clone = (GrassCoverErosionInwardsCalculation)base.Clone(); clone.Comments = (Comment)Comments.Clone(); clone.InputParameters = (GrassCoverErosionInwardsInput)InputParameters.Clone(); if (Output != null) { clone.Output = (GrassCoverErosionInwardsOutput)Output.Clone(); } return(clone); }
/// <summary>Submit a job to the service</summary> /// <param name="input">Structure describing the input parameters</param> /// <param name="content">Structure containing the input data</param> /// <returns>A string containing the job identifier</returns> public string RunApp(string email, string title, InputParameters input) { PrintDebugMessage("RunApp", "Begin", 1); PrintDebugMessage("RunApp", "email: " + email, 2); PrintDebugMessage("RunApp", "title: " + title, 2); PrintDebugMessage("RunApp", "input:\n" + ObjectValueToString(input), 2); string jobId = null; this.ServiceProxyConnect(); // Ensure we have a service proxy // Submit the job jobId = SrvProxy.run(email, title, input); PrintDebugMessage("RunApp", "jobId: " + jobId, 2); PrintDebugMessage("RunApp", "End", 1); return jobId; }
public void Execute() { UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name) { user = (UserAccount)_httpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } /* parameter processing */ Int32 contactId = 0; if (InputParameters.ContainsKey("ContactId")) { int.TryParse(InputParameters["ContactId"].ToString(), out contactId); } Guid loanId = Guid.Empty; if (InputParameters.ContainsKey("LoanId")) { Guid.TryParse(InputParameters["LoanId"].ToString(), out loanId); } var tempDetails = LoanServiceFacade.RetrieveWorkQueueItemDetails(loanId, contactId, -1); LoanDetailsViewModel loanDetails = new LoanDetailsViewModel(); string emptyField = "-"; if (tempDetails == null) { tempDetails = new WorkQueueItemDetails(); } else { CommonHelper.RetreiveLoanDetailsFromWorkQueueItemDetails(tempDetails, loanDetails, user, emptyField); loanDetails.Adjustments = LoanServiceFacade.RetrieveLoanAdjustment(loanId); } _viewName = "_programnamedetails"; _viewModel = loanDetails; }
void UcAttributeGroupDetail_Load(object sender, EventArgs e) { base.VerifyInputParameters(new List <string> { "Action", "IdArchive" }); this.IdArchive = (Guid)InputParameters["IdArchive"]; base.CreateWaitDialog(); try { this.comboBoxType.Items.AddRange(Enum.GetNames(typeof(AttributeGroupType))); this.CurrentAction = (action)InputParameters["Action"]; this.ArchiveName = InputParameters.ContainsKey("ArchiveName") ? InputParameters["ArchiveName"].ToString() : string.Empty; switch (this.CurrentAction) { #region Creazione nuovo AttributeGroup case action.create: this.btUpdate.Text = "Insert"; this.btUpdate.Click += this.InsertAttributeGroup; this.radPanelTitle.Text = "Insert Attribute Group for archive " + this.ArchiveName; break; #endregion #region Modifica di un AttributeGroup già esistente case action.update: VerifyInputParameters(new List <string> { "IdAttributeGroup" }); this.IdAttributeGroupModify = (Guid)InputParameters["IdAttributeGroup"]; this.btUpdate.Click += this.UpdateAttributeGroup; this.radPanelTitle.Text = "Updating Attribute Group"; this.LoadAttributeGroupFromClient(); break; #endregion } base.CloseWaitDialog(); } catch (Exception exx) { //Propaga l'eccezione. throw exx; } }
public override object Clone() { var clone = (StabilityStoneCoverWaveConditionsCalculation)base.Clone(); clone.Comments = (Comment)Comments.Clone(); clone.InputParameters = (StabilityStoneCoverWaveConditionsInput)InputParameters.Clone(); if (Output != null) { clone.Output = (StabilityStoneCoverWaveConditionsOutput)Output.Clone(); } return(clone); }
private static void Run( InputParameters inputParameters, PaymentOverviewConsolePrinter printer, LoanCalculationsFacade facade, IConsole console ) { var paymentOverview = facade.CalculatePaymentOverview( inputParameters.ToLoanParameters(), inputParameters.ToLoanTerms() ); printer.Print(paymentOverview, console); }
public void WriteFooter(InputParameters inputParameterse) { // TODO: include? //https://github.com/henkans/TheV var originalForegroundColor = Console.ForegroundColor; Console.ForegroundColor = LineColor; Console.WriteLine(new string(_emDash, AppWidth)); var footertext = $"Checked { DateTime.Now }"; Console.Write(new string(' ', AppWidth - footertext.Length)); Console.WriteLine(footertext); Console.ForegroundColor = originalForegroundColor; }
public VisualTreeRunContext( IDIIntegration diIntegration, DependencyObject root, string targetMethodName, IEnumerable <object?> inputParameters) { DIIntegration = diIntegration; Root = root; TargetMethodName = targetMethodName; InputParameters = inputParameters.ToArray(); Targets = TargetSelector.ResolveTarget( Root, diIntegration.GetRequired <TargetListCompositeExpander>()); CandidateParameters = DIIntegration.GetRequired <ParameterListCompositeExpander>() .Expand(InputParameters.Concat(Targets)); }
public virtual T GetInputParameter <T>(InputParameters parameterName) { VerifyInputParameter(parameterName); if (typeof(T).IsEnum) { var value = (OptionSetValue)ExecutionContext.InputParameters[parameterName.ToString()]; return((T)Enum.ToObject(typeof(T), value.Value)); } else { return((T)ExecutionContext.InputParameters[parameterName.ToString()]); } }
private IntermediateVariable CalculateIntermediateVariable(InputParameters inputParameter) { IntermediateVariable intermediateVariable = new IntermediateVariable(); //Future Growth Rate double futureGrowthRate = Financial.Rate(inputParameter.IntervalYears, 0, (double)inputParameter.StartEarningPerShare, (double)inputParameter.EarningPerShaereTrailingTwelveMonths); if (futureGrowthRate > 0.15 && futureGrowthRate <= 1) { intermediateVariable.FutureGrowthRate = 0.15; } else if (futureGrowthRate >= 0 && futureGrowthRate <= 0.15) { intermediateVariable.FutureGrowthRate = futureGrowthRate; } else { throw new ArgumentOutOfRangeException("FutureGrowthRate should be in range [0,1]"); } //futurePE double futurePE = intermediateVariable.FutureGrowthRate * 2; intermediateVariable.FuturePE = futurePE; //Future EPS double pv;//if inputParameter.StartEarningPerShare=1.43$; pv=-1.43 if (inputParameter.EarningPerShaereTrailingTwelveMonths > 0) { pv = -(double)inputParameter.EarningPerShaereTrailingTwelveMonths; } else { pv = (double)inputParameter.EarningPerShaereTrailingTwelveMonths; } double futureEPS = Financial.FV(intermediateVariable.FutureGrowthRate, 10.0, 0.0, pv); intermediateVariable.FutureEarningPerShare = (decimal)futureEPS; //Future Stock Price double futureStockPrice = futureEPS * futurePE * 100; intermediateVariable.FutureStockPrice = (decimal)futureStockPrice; return(intermediateVariable); }
public void Execute() { PipelineListState pipelineListState = _httpContext.Session["PipelineListState"] != null ? (PipelineListState)_httpContext.Session["PipelineListState"] : new PipelineListState(); if (!InputParameters.ContainsKey("BorroweStatusFilter")) { throw new ArgumentException("BorroweStatusFilter was expected!"); } pipelineListState.BorrowerStatusFilter = InputParameters["BorroweStatusFilter"].ToString() == "0" ? null : InputParameters["BorroweStatusFilter"].ToString(); UserAccount user = _httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name ? user = (UserAccount)_httpContext.Session[SessionHelper.UserData] : UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); if (user == null) { throw new InvalidOperationException("User is null"); } // on date filter change, reset page number pipelineListState.CurrentPage = 1; FilterViewModel userFilterViewModel = null; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null)) { userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString()); } else { userFilterViewModel = new FilterViewModel(); } PipelineViewModel pipelineViewModel = PipelineDataHelper.RetrievePipelineViewModel(pipelineListState, _httpContext.Session["UserAccountIds"] != null ? (List <int>)_httpContext.Session["UserAccountIds"] : new List <int> { }, user.UserAccountId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, CommonHelper.GetSearchValue(_httpContext)); _viewName = "Queues/_pipeline"; _viewModel = pipelineViewModel; /* Persist new state */ _httpContext.Session["PipelineViewModel"] = pipelineViewModel.ToXml(); _httpContext.Session["PipelineListState"] = pipelineListState; }
public async Task InvokeAsync <TPayload>( ISchematic <string, string> schematic, IStateMachine <string, string> machine, Status <string> status, InputParameters <string, TPayload> inputParameters, IReadOnlyDictionary <string, string> connectorSettings, CancellationToken cancellationToken = default) { // Processing // Move next await Task.WhenAll( machine.SendAsync("Continue", cancellationToken), machine.SendAsync("Complete", cancellationToken)); }
/** \brief Calculates output message as a string * \param inParams structure holding the input values * \param epsilon hit tolerance * \param d_offset distance between the target position and the landing position: the offset between the target position and the landing position (m) * \return output message as a string */ public static string func_s(InputParameters inParams, double epsilon, double d_offset) { if (Math.Abs(d_offset / inParams.p_target) < epsilon) { return("The target was hit."); } else if (d_offset < 0) { return("The projectile fell short."); } else { return("The projectile went long."); } }
private void saveParamsButtonClicked(object sender, RoutedEventArgs e) { InputParameters inputParameters = getInputParameters(); if (parametersValidator.validate(inputParameters)) { this.logs.Text = equationFormater.formatEquation(inputParameters["Equation"], int.Parse(inputParameters["VariablesCount"])); inputParameters["Equation"] = equationFormater.formatEquation(inputParameters["Equation"], int.Parse(inputParameters["VariablesCount"])); algorythm.setParameters(inputParameters); } else { MessageBox.Show("Błędne wartości parametrów"); } }
public SifarnikService(ILifetimeScope scope, Context context, IAuthService authService, IGetSifarniciService getSifarniciService, IGetPoljaSifarnikaService getPoljaSifarnikaService, IUpdateSifarnikService updateSifarnikService, ISnimiSifarnikService snimiSifarnikService) : base(scope) { this.context = context; inputParameters = new InputParameters() { Context = context, Scope = scope, SamoDatum = false, AuthService = authService, GetSifarniciService = getSifarniciService, GetPoljaSifarnikaService = getPoljaSifarnikaService, UpdateSifarnikService = updateSifarnikService, SnimiSifarnikService = snimiSifarnikService }; }
private InputParameters GetDummyInput(LoanDetailModel loanDetail) { InputParameters inputs = new InputParameters() { RevolUtil = 1, AllUtil = 1, AnnualIncJoint = 1, DtiJoint = 1, IntRate = 1, MthsSinceLastRecord = 3, TotalRecPrncp = 5 }; return(inputs); }
public void WriteVersion(IVersionChecker versionChecker, InputParameters inputParameters) { try { var checkerResults = versionChecker.GetVersion(inputParameters); if (checkerResults == null || !checkerResults.Any()) { return; } WriteTitle(versionChecker.Title); if (Console.IsOutputRedirected) { foreach (var checkerResult in checkerResults) { Console.WriteLine($"{checkerResult.Name} {checkerResult.Version}"); } return; } var maxlength = checkerResults.Max(c => c.Name.Length); if (maxlength < 20) { maxlength = 20; } foreach (var checkerResult in checkerResults) { var originalForegroundColor = Console.ForegroundColor; var originalBackgroundColor = Console.BackgroundColor; Console.ForegroundColor = NameColor; Console.Write($"{PaddingWithDots((string.IsNullOrWhiteSpace(checkerResult.Name) ? versionChecker.Title : checkerResult.Name), maxlength)}"); Console.ForegroundColor = VersionColor; Console.WriteLine($"{checkerResult.Version}"); Console.ForegroundColor = originalForegroundColor; Console.BackgroundColor = originalBackgroundColor; } } catch (Exception e) { Debug.WriteLine(e); WriteTitle(versionChecker.Title); WriteError(e.Message); } }
public override iInputState HandleInput(InputParameters parameters) { if (Input.GetKeyDown(KeyCode.Space)) { return(new ChannelingState()); } if (Input.GetMouseButtonDown(0)) { // Starting mouse position parameters.VectorInput.Add(Input.mousePosition); return(new SelectingBoundsState()); } return(this); }
/** \brief Calculates load resistance: the uniform lateral load that a glass construction can sustain based upon a given probability of breakage and load duration as defined in (pp. 1 and 53) Ref: astm2009 (Pa) * \param inParams structure holding the input values * \param NFL non-factored load: three second duration uniform load associated with a probability of breakage less than or equal to 8 lites per 1000 for monolithic AN glass (Pa) * \return load resistance: the uniform lateral load that a glass construction can sustain based upon a given probability of breakage and load duration as defined in (pp. 1 and 53) Ref: astm2009 (Pa) */ public static double func_LR(InputParameters inParams, double NFL) { StreamWriter outfile; outfile = new StreamWriter("log.txt", true); outfile.WriteLine("function func_LR called with inputs: {"); outfile.Write(" inParams = "); outfile.Write("Instance of InputParameters object"); outfile.WriteLine(", "); outfile.Write(" NFL = "); outfile.WriteLine(NFL); outfile.WriteLine(" }"); outfile.Close(); return(NFL * inParams.GTF * 1.0); }
/** \brief Calculates distance between the target position and the landing position: the offset between the target position and the landing position (m) * \param inParams structure holding the input values * \param p_land landing position: the distance from the launcher to the final position of the projectile (m) * \return distance between the target position and the landing position: the offset between the target position and the landing position (m) */ public static double func_d_offset(InputParameters inParams, double p_land) { StreamWriter outfile; outfile = new StreamWriter("log.txt", true); outfile.WriteLine("function func_d_offset called with inputs: {"); outfile.Write(" inParams = "); outfile.Write("Instance of InputParameters object"); outfile.WriteLine(", "); outfile.Write(" p_land = "); outfile.WriteLine(p_land); outfile.WriteLine(" }"); outfile.Close(); return(p_land - inParams.p_target); }
private void dispose(bool disposing) { if (disposing) { if (MetaData != null) { MetaData.Dispose(); } } MetaData = null; if (InputParameters != null) { InputParameters.Clear(); } }
internal static void WanderKinematic(InputParameters inputData, ref MovementResult result) { int range = 15; wanderCounter += inputData.currentUpdateDuration; if (wanderCounter > maxWanderDuration) { Vector3 randomTarget = inputData.targetTransform.position; randomTarget.x += (float)(r.NextDouble() - 0.5f) * range; randomTarget.z += (float)(r.NextDouble() - 0.5f) * range; inputData.targetTransform.position = randomTarget; wanderCounter = 0.0f; } SeekKinematic(inputData, ref result); }
public void TestSubtraction(string opValues, int expectedResult) { Console.WriteLine($"TestSubtraction. Input string parameter: {opValues}"); InputParameters inputParams = new InputParameters { AllowNegativeNumbers = false, CustomDelimiter = "", UpperBound = 1000, OperationValues = opValues }; Calculator calc = new Calculator(inputParams); int actualResult = calc.RunOperation(OperationType.Subtraction); Assert.AreEqual(expectedResult, actualResult); }
/** \brief Calculates stress distribution factor (Function) * \param inParams structure holding the input values * \param q_hat dimensionless load * \return stress distribution factor (Function) */ public static double func_J(InputParameters inParams, double q_hat) { StreamWriter outfile; outfile = new StreamWriter("log.txt", true); outfile.WriteLine("function func_J called with inputs: {"); outfile.Write(" inParams = "); outfile.Write("Instance of InputParameters object"); outfile.WriteLine(", "); outfile.Write(" q_hat = "); outfile.WriteLine(q_hat); outfile.WriteLine(" }"); outfile.Close(); return(Interpolation.interpZ("SDF.txt", inParams.AR, q_hat)); }
public List <UserLog> GetLogData(InputParameters param) { var data = db.GetLoggingData(param.IsSearch, param.StartDate, param.EndDate, param.Level, param.UserId, param.Id, param.PageNo, param.TotalRow); List <UserLog> uLog = (from a in data select new UserLog { Id = a.Id, Host = a.Host, Error = a.Message }).ToList(); return(uLog); }
/** \brief Calculates dimensionless load * \param inParams structure holding the input values * \param q applied load (demand): 3 second duration equivalent pressure (Pa) * \return dimensionless load */ public static double func_q_hat(InputParameters inParams, double q) { StreamWriter outfile; outfile = new StreamWriter("log.txt", true); outfile.WriteLine("function func_q_hat called with inputs: {"); outfile.Write(" inParams = "); outfile.Write("Instance of InputParameters object"); outfile.WriteLine(", "); outfile.Write(" q = "); outfile.WriteLine(q); outfile.WriteLine(" }"); outfile.Close(); return(q * Math.Pow(inParams.a * inParams.b, 2) / (7.17e10 * Math.Pow(inParams.h, 4) * inParams.GTF)); }
/** \brief Calculates tolerable load * \param inParams structure holding the input values * \param J_tol stress distribution factor (Function) based on Pbtol * \return tolerable load */ public static double func_q_hat_tol(InputParameters inParams, double J_tol) { StreamWriter outfile; outfile = new StreamWriter("log.txt", true); outfile.WriteLine("function func_q_hat_tol called with inputs: {"); outfile.Write(" inParams = "); outfile.Write("Instance of InputParameters object"); outfile.WriteLine(", "); outfile.Write(" J_tol = "); outfile.WriteLine(J_tol); outfile.WriteLine(" }"); outfile.Close(); return(Interpolation.interpY("SDF.txt", inParams.AR, J_tol)); }
/** \brief Calculates probability of glass breakage safety requirement * \param inParams structure holding the input values * \param P_b probability of breakage: the fraction of glass lites or plies that would break at the first occurrence of a specified load and duration, typically expressed in lites per 1000 (Ref: astm2016) * \return probability of glass breakage safety requirement */ public static Boolean func_is_safePb(InputParameters inParams, double P_b) { StreamWriter outfile; outfile = new StreamWriter("log.txt", true); outfile.WriteLine("function func_is_safePb called with inputs: {"); outfile.Write(" inParams = "); outfile.Write("Instance of InputParameters object"); outfile.WriteLine(", "); outfile.Write(" P_b = "); outfile.WriteLine(P_b); outfile.WriteLine(" }"); outfile.Close(); return(P_b < inParams.P_btol); }
/** \brief Calculates risk of failure * \param inParams structure holding the input values * \param J stress distribution factor (Function) * \return risk of failure */ public static double func_B(InputParameters inParams, double J) { StreamWriter outfile; outfile = new StreamWriter("log.txt", true); outfile.WriteLine("function func_B called with inputs: {"); outfile.Write(" inParams = "); outfile.Write("Instance of InputParameters object"); outfile.WriteLine(", "); outfile.Write(" J = "); outfile.WriteLine(J); outfile.WriteLine(" }"); outfile.Close(); return(2.86e-53 / Math.Pow(inParams.a * inParams.b, 7.0 - 1) * Math.Pow(7.17e10 * Math.Pow(inParams.h, 2), 7.0) * inParams.LDF * Math.Exp(J)); }
/** \brief Calculates non-factored load: three second duration uniform load associated with a probability of breakage less than or equal to 8 lites per 1000 for monolithic AN glass (Pa) * \param inParams structure holding the input values * \param q_hat_tol tolerable load * \return non-factored load: three second duration uniform load associated with a probability of breakage less than or equal to 8 lites per 1000 for monolithic AN glass (Pa) */ public static double func_NFL(InputParameters inParams, double q_hat_tol) { StreamWriter outfile; outfile = new StreamWriter("log.txt", true); outfile.WriteLine("function func_NFL called with inputs: {"); outfile.Write(" inParams = "); outfile.Write("Instance of InputParameters object"); outfile.WriteLine(", "); outfile.Write(" q_hat_tol = "); outfile.WriteLine(q_hat_tol); outfile.WriteLine(" }"); outfile.Close(); return(q_hat_tol * 7.17e10 * Math.Pow(inParams.h, 4.0) / Math.Pow(inParams.a * inParams.b, 2.0)); }
private static InputParameters ReadInput(string[] args) { InputParameters input = new InputParameters { Iteration = 1, Samples = 10000, Seed = 5678 }; if (args == null || args.Length == 0) return input; if (args.Length > 0) input.Iteration = ReadInt(args[0]); if (args.Length > 1) input.Samples = ReadInt(args[1]); if (args.Length > 2) input.Seed = ReadInt(args[2]); return input; }
//--------------------------------------------------------------------- // Since this class derives from Base Harvest's parser, then the Parse // method below must return Base Harvest's interface to the parameters. // But the method uses Biomass Harvest's class for editable parameters, // so that the new BiomassMaps parameter can be read and validated. // The method returns an instance of Biomass Harvest's Parameters, so // the caller must cast the reference to Biomass Harvest's parameters // interface in order to access the new BiomassMaps parameter. protected override BaseHarvest.IInputParameters Parse() { RoundedRepeatIntervals.Clear(); // ReadLandisDataVar(); InputVar<string> landisData = new InputVar<string>("LandisData"); ReadVar(landisData); if (landisData.Value.Actual != PlugIn.PlugInName) throw new InputValueException(landisData.Value.String, "The value is not \"{0}\"", PlugIn.PlugInName); InputParameters parameters = new InputParameters(); InputVar<int> timestep = new InputVar<int>("Timestep"); ReadVar(timestep); parameters.Timestep = timestep.Value; InputVar<string> mgmtAreaMap = new InputVar<string>("ManagementAreas"); ReadVar(mgmtAreaMap); parameters.ManagementAreaMap = mgmtAreaMap.Value; InputVar<string> standMap = new InputVar<string>("Stands"); ReadVar(standMap); parameters.StandMap = standMap.Value; ReadPrescriptions(parameters.Prescriptions, timestep.Value.Actual); ReadHarvestImplementations(parameters.ManagementAreas, parameters.Prescriptions); // Output file parameters InputVar<string> prescriptionMapNames = new InputVar<string>(Names.PrescriptionMaps); ReadVar(prescriptionMapNames); parameters.PrescriptionMapNames = prescriptionMapNames.Value; // TO DO: Probably should be required in the final release but made // it optional for now so that CBI doesn't have to update every // scenario in the short term. InputVar<string> biomassMapNames = new InputVar<string>("BiomassMaps"); if (ReadOptionalVar(biomassMapNames)) parameters.BiomassMapNames = biomassMapNames.Value; InputVar<string> eventLogFile = new InputVar<string>("EventLog"); ReadVar(eventLogFile); parameters.EventLog = eventLogFile.Value; InputVar<string> summaryLogFile = new InputVar<string>("SummaryLog"); ReadVar(summaryLogFile); parameters.SummaryLog = summaryLogFile.Value; CheckNoDataAfter("the " + eventLogFile.Name + " parameter"); return parameters; }