Difference between revisions of "Chess MapReduce Application"
Jump to navigation
Jump to search
(Created page with "=Code To Investigate and Implement= ==ChessMapper== {{CodeToImplement|ChessMapper|constructor<br/>isMoveAtIndexDesired<br/>map|mapreduce.apps.chess.exercise}} ===constructor...") |
|||
| Line 20: | Line 20: | ||
{{Sequential|public Map<Move, ResultTotalInfo> reduce(List<MoveResultPair> moveResultPairs)}} | {{Sequential|public Map<Move, ResultTotalInfo> reduce(List<MoveResultPair> moveResultPairs)}} | ||
| + | ===reduce=== | ||
{{Warning|This class inherits from ClassicReducer. Be sure to have completed that exercise first.}} | {{Warning|This class inherits from ClassicReducer. Be sure to have completed that exercise first.}} | ||
Revision as of 09:19, 7 March 2024
Contents
Code To Investigate and Implement
ChessMapper
| class: | ChessMapper.java | |
| methods: | constructor isMoveAtIndexDesired map |
|
| package: | mapreduce.apps.chess.exercise | |
| source folder: | student/src/main/java |
constructor and instance variable
method: public ChessMapper(IntPredicate isMoveAtIndexDesired)
(sequential implementation only)
Hang onto the value of the isMoveAtIndexDesired parameter as an instance variable for later use.
isMoveAtIndexDesired
This method exists largely as a reminder to use the isMoveAtIndexDesired passed to the constructor.
map
Note: the ChessMapper is constructed with an IntPredicate. This IntPredicate should be passed to each game's positionResponsePairs method to potentially limit how many pairs you will emit.
method: public List<Map.Entry<Position, MoveResultPair>> map(Game game)
(sequential implementation only)
ChessReducer
| class: | ChessReducer.java | |
| methods: | reduce | |
| package: | mapreduce.apps.chess.exercise | |
| source folder: | student/src/main/java |
method: public Map<Move, ResultTotalInfo> reduce(List<MoveResultPair> moveResultPairs)
(sequential implementation only)