Package es.uam.eps.ir.relison.index.fast
Class FastWeightedAutoRelation<W>
java.lang.Object
es.uam.eps.ir.relison.index.fast.FastWeightedRelation<W>
es.uam.eps.ir.relison.index.fast.FastWeightedAutoRelation<W>
- Type Parameters:
W- Type of the weights.
- All Implemented Interfaces:
AutoRelation<W>,Relation<W>
public class FastWeightedAutoRelation<W> extends FastWeightedRelation<W> implements AutoRelation<W>
Fast implementation for a weighted auto 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 FastWeightedAutoRelation()Constructor.FastWeightedAutoRelation(java.util.List<java.util.List<IdxValue<W>>> weightsList)Constructor. -
Method Summary
Modifier and Type Method Description java.util.stream.IntStreamfirstsWithSeconds()Obtains the elements in first set with relations to the ones in the second.java.util.stream.IntStreamgetIsolated()Obtains the elements in an autorelation which are related to none.booleanremove(int idx)Removes an element.java.util.stream.IntStreamsecondsWithFirsts()Obtains the elements in second set with relations to the ones in the first.Methods inherited from class es.uam.eps.ir.relison.index.fast.FastWeightedRelation
addFirstItem, addRelation, containsPair, getAllFirst, getIdsFirst, getIdsSecond, getIsolatedFirsts, getIsolatedSeconds, getValue, hasFirsts, hasSeconds, numFirst, numFirst, numSecond, removePair, updatePairMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface es.uam.eps.ir.relison.index.AutoRelation
addSecondItem, getAllSecond, isIsolated, numSecond, numSecondMethods inherited from interface es.uam.eps.ir.relison.index.Relation
addFirstItem, addRelation, containsPair, getAllFirst, getIdsFirst, getIdsSecond, getIsolatedFirsts, getIsolatedSeconds, getValue, hasFirsts, hasSeconds, numFirst, numFirst, removePair, updatePair, updatePair
-
Constructor Details
-
FastWeightedAutoRelation
public FastWeightedAutoRelation()Constructor. Builds an empty autorelation. -
FastWeightedAutoRelation
Constructor. Builds an autorelation from previous information.- Parameters:
weightsList- List of weights.
-
-
Method Details
-
remove
public boolean remove(int idx)Description copied from interface:AutoRelationRemoves an element. The identifiers of all remaining elements will be reduced by 1.- Specified by:
removein interfaceAutoRelation<W>- Parameters:
idx- The identifier of the element.- Returns:
- true if everything went OK, false otherwise.
-
getIsolated
public java.util.stream.IntStream getIsolated()Description copied from interface:AutoRelationObtains the elements in an autorelation which are related to none.- Specified by:
getIsolatedin interfaceAutoRelation<W>- Returns:
- an int stream containing the indexes of the items which are related to none.
-
firstsWithSeconds
public java.util.stream.IntStream firstsWithSeconds()Description copied from interface:RelationObtains the elements in first set with relations to the ones in the second.- Specified by:
firstsWithSecondsin interfaceRelation<W>- Overrides:
firstsWithSecondsin classFastWeightedRelation<W>- Returns:
- the elements in first set with relations to the ones in the second.
-
secondsWithFirsts
public java.util.stream.IntStream secondsWithFirsts()Description copied from interface:RelationObtains the elements in second set with relations to the ones in the first.- Specified by:
secondsWithFirstsin interfaceRelation<W>- Overrides:
secondsWithFirstsin classFastWeightedRelation<W>- Returns:
- the elements in second set with relations to the ones in the first.
-