Package com.bugyal.imentor.frontend.shared

Examples of com.bugyal.imentor.frontend.shared.SearchResult


    p5 = new ParticipantVO(null, "name5", "m", "name5@k.c","100002992300278", 17.000000, 75.4, "",
        200000, Arrays.asList("science"), Arrays.asList("chemistry",
            "physics"));

    sr1.add(new SearchResult(p1, true, Arrays.asList("maths", "science"), 12));

    sr1.add(new SearchResult(p2, false, Arrays.asList("maths"), 2));
    sr1.add(new SearchResult(p3, false, Arrays.asList("maths", "science"), 8));
    sr1.add(new SearchResult(p4, false, Arrays.asList("maths"), 18));
    sr1.add(new SearchResult(p5, false, Arrays.asList("science"), 28));
  }
View Full Code Here


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));
    }
  }
View Full Code Here

        for (String s : p.getHasSubjects()) {
          if (needSubjects.contains(s)) {
            matchingSubs.add(s);
          }
        }
        has.add(new SearchResult(ValueObjectGenerator.create(p), true,
            matchingSubs, GeocellUtils
                .distance(pt, p.getLocation())));
      }
      temp = System.currentTimeMillis();
      participants = pm.searchParticipantsBySubjects(hasSubs, location,
          false);
      LOG.info("For TOME searchParticipantsBySubjects(hasSubs, location, false) "
              + (System.currentTimeMillis() - temp));

      for (Participant p : participants) {
        List<String> matchingSubs = new ArrayList<String>();
        for (String s : p.getNeedSubjects()) {
          if (hasSubjects.contains(s)) {
            matchingSubs.add(s);
          }
        }
        need.add(new SearchResult(ValueObjectGenerator.create(p),
            false, matchingSubs, GeocellUtils.distance(pt, p
                .getLocation())));
      }
      temp = System.currentTimeMillis();
      List<Opportunity> opportunities = om.searchOpportunities(location,
          hasSubs);
      LOG.info("For TOME searchOpportunities(location, hasSubs) "
          + (System.currentTimeMillis() - temp));

      for (Opportunity o : opportunities) {

        List<String> matchingSubs = new ArrayList<String>();
        for (String s : o.getSubjects()) {
          if (hasSubjects.contains(s)) {
            matchingSubs.add(s);
          }
        }
        need.add(new SearchResult(ValueObjectGenerator.create(o),
            matchingSubs, GeocellUtils
                .distance(pt, o.getLocation())));
      }
           
      for(SearchResult s: need) {
View Full Code Here

      LOG.info("For Local Activity searchParticipantsByLocation(location) "
              + (System.currentTimeMillis() - temp));
      for (Participant p : participants) {
        double distance = GeocellUtils.distance(pi.getLocation(), p
            .getLocation());
        has.add(new SearchResult(ValueObjectGenerator.create(p), true,
            p.getHasSubjects(), distance));
        need.add(new SearchResult(ValueObjectGenerator.create(p),
            false, p.getNeedSubjects(), distance));
      }

      temp = System.currentTimeMillis();
      List<Opportunity> opportunities = om.allOpportunites(location);
      LOG.info("For Local Activity allOpportunites(location) "
          + (System.currentTimeMillis() - temp));
      for (Opportunity o : opportunities) {
        need.add(new SearchResult(ValueObjectGenerator.create(o), o
            .getSubjects(), GeocellUtils.distance(pi.getLocation(),
            o.getLocation())));
      }
      response.setHas(has);
      response.setNeed(need);
View Full Code Here

      List<SearchResult> result = new ArrayList<SearchResult>();
      List<Participant> participants = new ArrayList<Participant>();
      if (p.getMentors().size() != 0) {
        participants = pm.getMentors(p);
        for (Participant pi : participants) {
          result.add(new SearchResult(
              ValueObjectGenerator.create(pi), true, pi
                  .getHasSubjects(), 0));
        }
      }
      return result;
View Full Code Here

      List<Participant> participants = new ArrayList<Participant>();

      if (p.getMentees().size() != 0) {
        participants = pm.getMentees(p);
        for (Participant pi : participants) {
          result.add(new SearchResult(
              ValueObjectGenerator.create(pi), false, pi
                  .getNeedSubjects(), 0));
        }
      }
      if (p.getMentoringOpportunities().size() != 0) {
        for (Key key : p.getMentoringOpportunities()) {
          Opportunity o = om.findById(key);
          result.add(new SearchResult(ValueObjectGenerator.create(o),
              o.getSubjects(), 0));
        }
      }
      return result;
    } catch (MentorException e) {
View Full Code Here

public class SubjectCorrelationScorer implements Scorer {

  @Override
  public void applyScores(List<SearchResult> rList, Participant p) {
    for (int i = 0; i < rList.size(); i ++) {
      SearchResult result = rList.get(i);
      double score = result.getSubjects().size() + 0.0;
      result.applyScore(score);
    }
  }
View Full Code Here

TOP

Related Classes of com.bugyal.imentor.frontend.shared.SearchResult

Copyright © 2018 www.massapicom. 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.