Exemplo n.º 1
0
  private double computeRawProximity(List<OverlapItem> overlaps) {
    double potential = 0;
    double actual = 0;

    for (OverlapItem item : overlaps) {
      if (item.getEdit1() > 0 && item.getEdit2() > 0) {
        potential += ProximityWeight.EDIT_OVERLAP.weight();
        actual += ProximityWeight.EDIT_OVERLAP.weight();
      } else if (item.getEdit1() > 0 || item.getEdit2() > 0) {
        potential += ProximityWeight.EDIT_OVERLAP.weight();
        if (item.getSelection1() > 0 && item.getSelection2() > 0)
          actual += ProximityWeight.MIXED_OVERLAP.weight();
      } else {
        potential += ProximityWeight.SELECTION_OVERLAP.weight();
        if (item.getSelection1() > 0 && item.getSelection2() > 0)
          actual += ProximityWeight.SELECTION_OVERLAP.weight();
      }
    }

    return roundProximityScore(actual / potential);
  }
Exemplo n.º 2
0
  private int countOverlappingEvents(List<OverlapItem> overlaps) {
    int overlapCount = 0;
    // calculate number of overlapping events
    for (OverlapItem oi : overlaps) {
      overlapCount =
          overlapCount
              + Math.min(oi.getEdit1(), oi.getEdit2())
              + Math.min(oi.getSelection1(), oi.getSelection2());
    }

    return overlapCount;
  }