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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With