/*
* Copyright (C) 2015 Information Retrieval Group at Universidad Autónoma
* de Madrid, http://ir.ii.uam.es
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package es.uam.eps.ir.ranksys.novdiv.reranking;
import es.uam.eps.ir.ranksys.core.Recommendation;
import static java.lang.Math.min;
/**
* Null re-ranker that does not perform an actual re-ranking.
*
* @author Saúl Vargas (saul.vargas@uam.es)
*
* @param <U> type of the users
* @param <I> type of the items
*/
public class NullReranker<U, I> extends PermutationReranker<U, I> {
/**
* Returns the permutation that is applied to the input recommendation
* to generate the re-ranked recommendation.
*
* @param recommendation input recommendation
* @param maxLength maximum length of the permutation
* @return permutation that encodes the re-ranking
*/
@Override
public int[] rerankPermutation(Recommendation<U, I> recommendation, int maxLength) {
return getBasePerm(min(maxLength, recommendation.getItems().size()));
}
}