Package Dijkstra

Source Code of Dijkstra.AllPairsShortestPathCombiner

package Dijkstra;

import java.util.Hashtable;
import java.util.Map;

import cgl.imr.base.Combiner;
import cgl.imr.base.Key;
import cgl.imr.base.SerializationException;
import cgl.imr.base.TwisterException;
import cgl.imr.base.Value;
import cgl.imr.base.impl.JobConf;

public class AllPairsShortestPathCombiner implements Combiner {
 
  private Hashtable<Integer,Node> results;
 
  public AllPairsShortestPathCombiner(){
    this.results = new Hashtable<Integer, Node>();
  }

  public Hashtable<Integer, Node> getResults() {
    return this.results;
  }

  @Override
  public void combine(Map<Key, Value> keyValues) throws TwisterException {
   
    for (Value val : keyValues.values()) {
     
      try {
        Node node = new Node(val.getBytes());
        node.printNode("Nodes combined!");
        results.put(node.getID(), node);
      } catch (SerializationException e) {
        throw new TwisterException(e);
      }
     
    }   
  }

  @Override
  public void configure(JobConf arg0) throws TwisterException {
   
  }


}
TOP

Related Classes of Dijkstra.AllPairsShortestPathCombiner

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.