Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FORTRAN EXTERNAL concept in Java [duplicate]

Tags:

java

I'm pretty new to Java. What would be the "standard" way in Java to simulate the FORTRAN EXTERNAL concept? For example to compute the integral of a function where the function is not predefined?

For the reminder, FORTRAN EXTERNAL is a way to pass a "reference" of a function to another subprogram or function. It looks like: http://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vn9d/index.html

like image 325
mathcounterexamples.net Avatar asked Mar 11 '26 08:03

mathcounterexamples.net


1 Answers

Design an interface which has one method, called "apply()" or "calculate" or whatever, with the signature of the function you'll want to invoke.

Write your processing class so it gets passed an object which implements that interface, and calls it to invoke the external operation.

Write classes that implement the interface and perform the desired functions.

Then write whatever wrapper is needed to apply the processing class to the function classes.

like image 86
keshlam Avatar answered Mar 13 '26 22:03

keshlam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!