cmsc433.p4.explorers
Class ForkJoinExplorer<N extends Node<N,V>,V>

java.lang.Object
  extended by cmsc433.p4.explorers.ForkJoinExplorer<N,V>
All Implemented Interfaces:
Explorer<N,V>

public class ForkJoinExplorer<N extends Node<N,V>,V>
extends Object
implements Explorer<N,V>

A fork join explorer for graphs. This is the class you must implement for project 4;


Constructor Summary
ForkJoinExplorer()
           
 
Method Summary
static
<N extends Node<N,V>,V>
ForkJoinExplorer<N,V>
build()
          Provide a static build method, so that the system will infer the correct generic types
 GraphExploration<N,V> explore(N start)
          Explore the graph from the designated start node.
 void setParallelism(int parallelism)
          Set the number of threads the explorer should use when exploring graphs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForkJoinExplorer

public ForkJoinExplorer()
Method Detail

setParallelism

public void setParallelism(int parallelism)
Description copied from interface: Explorer
Set the number of threads the explorer should use when exploring graphs. Only used by parallel explorers

Specified by:
setParallelism in interface Explorer<N extends Node<N,V>,V>

explore

public GraphExploration<N,V> explore(N start)
                                                throws InterruptedException
Description copied from interface: Explorer
Explore the graph from the designated start node. It may return before all computations have completed, but it all computations should have been initiated (e.g., don't postpone performing any computations under a request is made for the value associated with a node). The exploration should call neighbors() and compute() exactly once for each reached node. If interrupted, it should try to cancel the computation and return quickly.

Specified by:
explore in interface Explorer<N extends Node<N,V>,V>
Throws:
InterruptedException

build

public static <N extends Node<N,V>,V> ForkJoinExplorer<N,V> build()
Provide a static build method, so that the system will infer the correct generic types