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 SummaryFields inherited from class es.uam.eps.ir.relison.index.fast.FastWeightedRelationfirstIdxList, secondIdxList
- 
Constructor SummaryConstructors Constructor Description FastWeightedPairwiseRelation()Constructor.FastWeightedPairwiseRelation(java.util.List<java.util.List<IdxValue<W>>> weightsList)Constructor.
- 
Method SummaryModifier and Type Method Description booleanaddSecondItem(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.intnumSecond()Gets the total number of elements of the second item in the relation.Methods inherited from class es.uam.eps.ir.relison.index.fast.FastWeightedRelationaddFirstItem, addRelation, containsPair, firstsWithSeconds, getAllFirst, getIdsFirst, getIdsSecond, getIsolatedFirsts, getIsolatedSeconds, getValue, hasFirsts, hasSeconds, numFirst, numFirst, numSecond, removePair, secondsWithFirsts, updatePair
- 
Constructor Details- 
FastWeightedPairwiseRelationpublic FastWeightedPairwiseRelation()Constructor. Builds an empty autorelation.
- 
FastWeightedPairwiseRelationConstructor. Builds an autorelation from previous information.- Parameters:
- weightsList- The list of weights.
 
 
- 
- 
Method Details- 
numSecondpublic int numSecond()Description copied from interface:RelationGets 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.
 
- 
getAllSecondpublic java.util.stream.Stream<java.lang.Integer> getAllSecond()Description copied from interface:RelationGets all the elements of the second type.- Returns:
- A stream containing all the elements.
 
- 
addSecondItempublic boolean addSecondItem(int secondIdx)Description copied from interface:RelationAdds 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.
 
 
-