Package com.bugyal.imentor.frontend.server

Source Code of com.bugyal.imentor.frontend.server.DistanceScorer

package com.bugyal.imentor.frontend.server;

import java.util.List;

import com.beoui.geocell.GeocellUtils;
import com.beoui.geocell.model.Point;
import com.bugyal.imentor.frontend.shared.SearchResult;
import com.bugyal.imentor.server.data.Participant;

public class DistanceScorer implements Scorer {

  @Override
  public void applyScores(List<SearchResult> rList, Participant p) {
    for (int i = 0; i < rList.size(); i++) {
      SearchResult result = rList.get(i);
      result.applyScore(getScore(p, result));
    }
  }

  private double getScore(Participant p, SearchResult result) {
    return 1000 / GeocellUtils.distance(p.getLocation(), new Point(result
        .getLatitude(), result.getLongitude()));
  }
}
TOP

Related Classes of com.bugyal.imentor.frontend.server.DistanceScorer

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.