Difference between revisions of "Fork Loop Assignment"
Jump to navigation
Jump to search
Line 8: | Line 8: | ||
: [https://www.cse.wustl.edu/~dennis.cosgrove/courses/cse231/fall22/apidocs/fj/FJ.html#join_fork_loop(java.lang.Iterable,fj.api.TaskFunction) join_fork_loop(iterable, function)] | : [https://www.cse.wustl.edu/~dennis.cosgrove/courses/cse231/fall22/apidocs/fj/FJ.html#join_fork_loop(java.lang.Iterable,fj.api.TaskFunction) join_fork_loop(iterable, function)] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Echoes== | ==Echoes== | ||
Line 26: | Line 18: | ||
===client=== | ===client=== | ||
{{CodeToInvestigate|EchoClient|main|forkloop.client|main}} | {{CodeToInvestigate|EchoClient|main|forkloop.client|main}} | ||
+ | |||
+ | =Code To Implement= | ||
+ | ==SquareRoots== | ||
+ | {{CodeToImplement|SquareRoots|toSquareRoots|forkloop.group}} | ||
+ | ===toSquareRoots=== | ||
+ | {{Parallel|public static Double[] toSquareRoots(Double[] values)}} | ||
+ | ===client=== | ||
+ | {{CodeToInvestigate|SquareRootClient|main|forkloop.client|main}} | ||
=Testing= | =Testing= | ||
{{TestSuite|_ForkLoopTestSuite|forkloop.group}} | {{TestSuite|_ForkLoopTestSuite|forkloop.group}} |
Revision as of 02:32, 29 January 2023
Contents
Motivation
There are many incantations of the fork_loop. We gain experience with selecting the right one for two scenarios.
Code To Use
FJ<E>
class FJ<E>
Echoes
class: | Echoes.java | |
methods: | toEchoes | |
package: | forkloop.group | |
source folder: | student/src/main/java |
toEchoes
method: public static List<String> toEchoes(List<String> texts)
(parallel implementation required)
for each text in parallel, produce text + " " + text.
client
class: | EchoClient.java | DEMO: |
methods: | main | |
package: | forkloop.client | |
source folder: | src/main/java |
Code To Implement
SquareRoots
class: | SquareRoots.java | |
methods: | toSquareRoots | |
package: | forkloop.group | |
source folder: | student/src/main/java |
toSquareRoots
method: public static Double[] toSquareRoots(Double[] values)
(parallel implementation required)
client
class: | SquareRootClient.java | DEMO: |
methods: | main | |
package: | forkloop.client | |
source folder: | src/main/java |
Testing
class: | _ForkLoopTestSuite.java | |
package: | forkloop.group | |
source folder: | testing/src/test/java |