Managing varying method parameters in bridge pattern

There are two types of loans which can be created, Term Loan and CF Loan. There are multiple external services which provide one or both kind of loan services. External service which is providing one kind of loan service, for now, are going to start new services very soon. I need to make the system flexible enough to accommodate new loan providing vendors in future.

I am attaching the class diagram Class diagram

Since all loan providers do not support all kind of loans, I have created different interfaces for loan types. Problem is that the classes which realise the interfaces might need different data. For example, Chaitanya might not need the phone number of the user to create a loan, but DMI might need it. Now, when the client calls createLoan method of any concrete loan implementor, I need polymorphism at that level. I have two options in my mind-

  1. Put conditionals in the createLoan method of concrete classes of loan and decide what parameters to send there. But it breaks open/close principle.
  2. Pass a superset of parameters when the concrete loan class calls methods of the interface realizers, and they themselves trim parameters. But this does not seem very good somehow and looks like code smell.

What is the correct way to solve it ? Also can someone please review the whole design as I am shifting to OOP(s) from functional paradigm.

Variable default_bundle in migration, Drupal 7 to 8? Field collection to varying paragraph types

I’m trying to migrate a D7 field collection to D8 paragraphs, but to a different paragraph bundle type depending on the value in one of the field collection’s fields.

The logic is as follows: If the field collection’s field_type value is “header”, the migration should create a header paragraph type. If the field collection’s field_type value is “card” it should migrate to a card paragraph type.

I’m trying to set a variable in process, and assign the value of that variable to default_bundle in the destination, but it’s not working, the paragraph type is empty for the entities created by this migration:

langcode: en status: true dependencies: { } id: d7_field_collection_list_items  class: null field_plugin_method: null cck_plugin_method: null migration_tags:  - 'Drupal 7' migration_group: migrate_drupal_7 label: FC source:   plugin: d7_field_collection_item   key: migrate   field_name: field_list_item process:       temp_bundle_type:     plugin: static_map     source: field_list_item_type     map:                   card: card       header: header     default_value: card  destination:   plugin: 'entity_reference_revisions:paragraph'   default_bundle: '@temp_bundle_type' migration_dependencies:   required: { }   optional: { } 

What is the correct way to achieve what I am trying to do? I have tried several other methods without success.

Varying the size of dots in a plot according to information contained in list

Suppose I have the following coordinates that I want to plot:

xy = {{0.05, -0.000264728}, {0.15, -0.0125407}, {0.25, -0.0569049}, {0.35,-0.133636}, {0.45, -0.235416}, {0.55, -0.358514}, {0.65, -0.50575},{0.75, -0.68979}, {0.85, -0.948287}, {0.95, -1.46034}} 

But suppose also, that I wish to vary the size of the dots in the plot using information contained in a corresponding list:

pointsize = {0.98, 0.94, 0.90, 0.83, 0.76, 0.66, 0.57, 0.41, 0.25, 0.09} 

How can that be achieved? I suppose I need a base-size for points, and then weight this base by the content of the pointsize list, but exactly how that can be done in Mathematica I do not know.

Min function accepting varying number of arguments in C++17

Come across this problem once again in the book The Modern C++ Challenge (problem 18). Wonder how simple and elegant the implementation could be using C++17. Following is my solution. Ideas? ^_^

#include <algorithm>  template <typename Less, typename T, typename... Ts> constexpr const T& min(Less less, const T& a, const T& b, const Ts&... rems) {   if constexpr (sizeof...(rems)) {     return min(less, std::min(a, b, less), rems...);   }   else {     return std::min(a, b, less);   } } 

Relation between time varying transfer function and autocorrleation function

Ma task: find E{Y(t)}, where Y(t) output of the system, in terms time varying transfer function H(f,t) Is not complicated to find expected value of the output in terms impulse response function.

But it is problem to find in terms H(f,t), becouse expected value if input, and auto correlation function of the input are given only. And i know that it is WSS random process.

maybe someone know, is there a relation between expected value and ACF?

yield new waitforsecond(1) counter time varying after ludo dice roll

in ludo 2d game I am using player turn timer 30 sec by using yield new waitforsecond(1) whenever timer goes to 0 and player don’t roll dice then dice will move to next player my problem is in starting timer work perfectly player chances skip if they don’t roll dice and timer work totally perfect for all 4 players until they roll dice but when dice roll I mean rolling animation start after timer start varying very fast whenever dice rolling and tits look like waitforsecond(1) depend on dice rolling and after some dice rolling time goes to 0 from 30 in few second and I want in 30 sec timer goes from 30 to 0.

here I have changed code two times

first with waitforsecond(1)

float currCountdownValue; public IEnumerator StartCountdown(float countdownValue = 30) { currCountdownValue = countdownValue; while (currCountdownValue > 0) { Debug.Log("Countdown: " + currCountdownValue); yield return new WaitForSeconds(1.0f); currCountdownValue--; }     if(!isdicerolled){     if(playerTurn == "RED"){ playerTurn = "BLUE";     InitializeDice();    }    else if(playerTurn == "BLUE"){     playerTurn = "GREEN";     InitializeDice();    }    else if(playerTurn == "GREEN"){     playerTurn = "YELLOW";     InitializeDice();    }   Ielse if(playerTurn == "YELLOW"){     playerTurn = "RED";     InitializeDice();    }    }   } 

and the second time I was using time.deltatime but it also giving me the same output

so what should I do now I want timer like teen Patti game, poker everything work but after rolling dice time is varying pls help me

3D Plot the result of local Minimize with varying parameter values

I’m faced with the following minimization problem: Find $ r\in[0,1]$ that minimizes $ \frac{d^2+k^2 (1-2r)r}{2(1-r)r}$ where each of $ d$ and $ k$ is bounded by zero and some positive real number, say, $ d\in[0,2]$ and $ k\in[0,0.5]$ .

I’m in need of help to 3D plot the value of $ r$ against $ d$ and $ k$ .

Here is what I tried:

Plot3D[NMinimize[{-((d^2 + k^2 (1 - 2 r) r)/(2 (-1 + r) r)), 0 <= d <= 2, 0 <= k <= 0.5, 0 <= r <= 1}, r], {d, 0, 2}, {k, 0, 0.5}]