Class AbstractFastFiller<U,​I>

java.lang.Object
es.uam.eps.ir.relison.links.recommendation.filler.AbstractFastFiller<U,​I>
Type Parameters:
U - Type of the users.
I - Type of the items.
All Implemented Interfaces:
FastFiller<U,​I>, Filler<U,​I>
Direct Known Subclasses:
IdFiller, RandomFiller

public abstract class AbstractFastFiller<U,​I>
extends java.lang.Object
implements FastFiller<U,​I>
Abstract implementation of a fast filler.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private int filled
    Accumulated number of filled items in recommendations
    protected es.uam.eps.ir.ranksys.fast.preference.FastPreferenceData<U,​I> prefData
    Fast preference data.
    private int total
    Total number of recommended items.
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractFastFiller​(es.uam.eps.ir.ranksys.fast.preference.FastPreferenceData<U,​I> prefData)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    es.uam.eps.ir.ranksys.fast.FastRecommendation fastFill​(es.uam.eps.ir.ranksys.fast.FastRecommendation rec, int cutoff, java.util.function.Function<U,​java.util.function.IntPredicate> pred)
    Given a recommendation, fills it with until it reaches the desired number of items (if possible).
    es.uam.eps.ir.ranksys.core.Recommendation<U,​I> fill​(es.uam.eps.ir.ranksys.core.Recommendation<U,​I> rec, int cutoff, java.util.function.Function<U,​java.util.function.Predicate<I>> pred)
    Given a recommendation, fills it with until it reaches the desired number of items (if possible).
    int numFilled()
    Number of elements filled.
    int numTotal()
    Number of total elements in the recommendation.
    void reset()
    Resets the filler.
    protected abstract void resetMethod()
    Resets the variables corresponding to the filler.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface es.uam.eps.ir.relison.links.recommendation.filler.FastFiller

    fillerList

    Methods inherited from interface es.uam.eps.ir.relison.links.recommendation.filler.Filler

    fillerList
  • Field Details

    • filled

      private int filled
      Accumulated number of filled items in recommendations
    • total

      private int total
      Total number of recommended items.
    • prefData

      protected es.uam.eps.ir.ranksys.fast.preference.FastPreferenceData<U,​I> prefData
      Fast preference data.
  • Constructor Details

    • AbstractFastFiller

      public AbstractFastFiller​(es.uam.eps.ir.ranksys.fast.preference.FastPreferenceData<U,​I> prefData)
      Constructor.
      Parameters:
      prefData - preference data.
  • Method Details

    • fastFill

      public es.uam.eps.ir.ranksys.fast.FastRecommendation fastFill​(es.uam.eps.ir.ranksys.fast.FastRecommendation rec, int cutoff, java.util.function.Function<U,​java.util.function.IntPredicate> pred)
      Description copied from interface: FastFiller
      Given a recommendation, fills it with until it reaches the desired number of items (if possible). If the cutoff is greater than the indicated one, the recommendation is trimmed. Uses the index values of items.
      Specified by:
      fastFill in interface FastFiller<U,​I>
      Parameters:
      rec - the recommendation.
      cutoff - the cutoff.
      pred - a predicate for filtering the possible recommendations.
      Returns:
      the new recommendation if everything is OK, null otherwise.
    • fill

      public es.uam.eps.ir.ranksys.core.Recommendation<U,​I> fill​(es.uam.eps.ir.ranksys.core.Recommendation<U,​I> rec, int cutoff, java.util.function.Function<U,​java.util.function.Predicate<I>> pred)
      Description copied from interface: Filler
      Given a recommendation, fills it with until it reaches the desired number of items (if possible). If the cutoff is greater than the indicated one, the recommendation is trimmed.
      Specified by:
      fill in interface Filler<U,​I>
      Parameters:
      rec - the recommendation.
      cutoff - the cutoff.
      pred - a predicate for filtering the possible recommendations.
      Returns:
      the new recommendation if everything is OK, null otherwise.
    • numFilled

      public int numFilled()
      Description copied from interface: Filler
      Number of elements filled.
      Specified by:
      numFilled in interface Filler<U,​I>
      Returns:
      the number of elements filled in the last recommendation.
    • numTotal

      public int numTotal()
      Description copied from interface: Filler
      Number of total elements in the recommendation.
      Specified by:
      numTotal in interface Filler<U,​I>
      Returns:
      the number of total elements in the recommendation.
    • reset

      public void reset()
      Description copied from interface: Filler
      Resets the filler.
      Specified by:
      reset in interface Filler<U,​I>
    • resetMethod

      protected abstract void resetMethod()
      Resets the variables corresponding to the filler.