Package es.uam.eps.ir.relison.index.fast
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.
-
Field Summary
Fields inherited from class es.uam.eps.ir.relison.index.fast.FastWeightedRelation
firstIdxList, secondIdxList
-
Constructor Summary
Constructors Constructor Description FastWeightedPairwiseRelation()
Constructor.FastWeightedPairwiseRelation(java.util.List<java.util.List<IdxValue<W>>> weightsList)
Constructor. -
Method Summary
Modifier and Type Method Description boolean
addSecondItem(int secondIdx)
Adds a new second item to the relation (if it does not previously exist).java.util.stream.Stream<java.lang.Integer>
getAllSecond()
Gets all the elements of the second type.int
numSecond()
Gets the total number of elements of the second item in the relation.Methods inherited from class es.uam.eps.ir.relison.index.fast.FastWeightedRelation
addFirstItem, addRelation, containsPair, firstsWithSeconds, getAllFirst, getIdsFirst, getIdsSecond, getIsolatedFirsts, getIsolatedSeconds, getValue, hasFirsts, hasSeconds, numFirst, numFirst, numSecond, removePair, secondsWithFirsts, updatePair
-
Constructor Details
-
FastWeightedPairwiseRelation
public FastWeightedPairwiseRelation()Constructor. Builds an empty autorelation. -
FastWeightedPairwiseRelation
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.
-