All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.oliviercailloux.grade.PerCriterionWeighter Maven / Gradle / Ivy

The newest version!
package io.github.oliviercailloux.grade;

import com.google.common.collect.ImmutableMap;
import java.util.Set;

/**
 * A criteria weighter able to decide whether a given criterion is accepted (not depending on the
 * rest of the set of criteria); and to attribute a fixed weight to each criterion, independently of
 * the rest of the criteria or of the mark.
 */
public interface PerCriterionWeighter extends CriteriaWeighter {

  /**
   * @throws AggregatorException iff the given criterion is rejected.
   */
  public double weight(Criterion criterion) throws AggregatorException;

  @Override
  default ImmutableMap weightsFromCriteria(Set criteria)
      throws AggregatorException {
    return criteria.stream().collect(ImmutableMap.toImmutableMap(c -> c, this::weight));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy