Class FastWeightedPairwiseRelation<W>

java.lang.Object
es.uam.eps.ir.relison.index.fast.FastWeightedRelation<W>
es.uam.eps.ir.relison.index.fast.FastWeightedPairwiseRelation<W>
Type Parameters:
W - Type of the weight.
All Implemented Interfaces:
Relation<W>

public class FastWeightedPairwiseRelation<W>
extends FastWeightedRelation<W>
Fast implementation for a weighted relation. Represented items have indexes between 0 and N-1, where N is the number of items.
  • Constructor Details

    • FastWeightedPairwiseRelation

      public FastWeightedPairwiseRelation()
      Constructor. Builds an empty autorelation.
    • FastWeightedPairwiseRelation

      public FastWeightedPairwiseRelation​(java.util.List<java.util.List<IdxValue<W>>> weightsList)
      Constructor. Builds an autorelation from previous information.
      Parameters:
      weightsList - The list of weights.
  • Method Details

    • numSecond

      public int numSecond()
      Description copied from interface: Relation
      Gets the total number of elements of the second item in the relation.
      Returns:
      the number of different elements of the second item in the relation.
    • getAllSecond

      public java.util.stream.Stream<java.lang.Integer> getAllSecond()
      Description copied from interface: Relation
      Gets all the elements of the second type.
      Returns:
      A stream containing all the elements.
    • addSecondItem

      public boolean addSecondItem​(int secondIdx)
      Description copied from interface: Relation
      Adds a new second item to the relation (if it does not previously exist).
      Parameters:
      secondIdx - Identifier of the second item.
      Returns:
      true if everything went OK, false if it did previously exist, or something went wrong.