Package es.uam.eps.ir.relison.index
Interface AutoRelation<W>
- Type Parameters:
W- Type of the weights.
- All Superinterfaces:
Relation<W>
- All Known Implementing Classes:
FastUnweightedAutoRelation,FastWeightedAutoRelation
public interface AutoRelation<W> extends Relation<W>
Interface for defining the relation of a set of objects with themselves.
-
Method Summary
Modifier and Type Method Description default booleanaddSecondItem(int secondIdx)Adds a new second item to the relation (if it does not previously exist).default java.util.stream.Stream<java.lang.Integer>getAllSecond()Gets all the elements of the second type.java.util.stream.IntStreamgetIsolated()Obtains the elements in an autorelation which are related to none.default booleanisIsolated(int idx)Checks whether an element is related to someone or not.default intnumSecond()Gets the total number of elements of the first item in the relation.default intnumSecond(int firstIdx)Gets the total number of elements of the second item related to a first item.booleanremove(int idx)Removes an element.Methods inherited from interface es.uam.eps.ir.relison.index.Relation
addFirstItem, addRelation, containsPair, firstsWithSeconds, getAllFirst, getIdsFirst, getIdsSecond, getIsolatedFirsts, getIsolatedSeconds, getValue, hasFirsts, hasSeconds, numFirst, numFirst, removePair, secondsWithFirsts, updatePair, updatePair
-
Method Details
-
numSecond
default int numSecond()Gets the total number of elements of the first item in the relation. -
numSecond
default int numSecond(int firstIdx)Gets the total number of elements of the second item related to a first item. -
getAllSecond
default java.util.stream.Stream<java.lang.Integer> getAllSecond()Gets all the elements of the second type.- Specified by:
getAllSecondin interfaceRelation<W>- Returns:
- a stream containing all the elements.
-
addSecondItem
default boolean addSecondItem(int secondIdx)Description copied from interface:RelationAdds a new second item to the relation (if it does not previously exist).- Specified by:
addSecondItemin interfaceRelation<W>- Parameters:
secondIdx- Identifier of the second item.- Returns:
- true if everything went OK, false if it did previously exist, or something went wrong.
-
remove
boolean remove(int idx)Removes an element. The identifiers of all remaining elements will be reduced by 1.- Parameters:
idx- The identifier of the element.- Returns:
- true if everything went OK, false otherwise.
-
getIsolated
java.util.stream.IntStream getIsolated()Obtains the elements in an autorelation which are related to none.- Returns:
- an int stream containing the indexes of the items which are related to none.
-
isIsolated
default boolean isIsolated(int idx)Checks whether an element is related to someone or not.- Parameters:
idx- The identifier of the element.- Returns:
- true if the node is isolated, false otherwise.
-