Package es.uam.eps.ir.relison.index.fast
Class FastIndex<T>
java.lang.Object
es.uam.eps.ir.relison.index.fast.FastIndex<T>
- Type Parameters:
 T- Type of the objects.
- All Implemented Interfaces:
 Index<T>,ReducedIndex<T>
public class FastIndex<T> extends java.lang.Object implements Index<T>
Fast implementation of a generic index.
- 
Field Summary
Fields Modifier and Type Field Description private java.util.List<T>i2tmapObject for each integer value.private intnumObjectsNumber of objects.private it.unimi.dsi.fastutil.objects.Object2IntMap<T>t2imapInteger value for every object. - 
Constructor Summary
Constructors Constructor Description FastIndex()Constructor. - 
Method Summary
Modifier and Type Method Description intaddObject(T t)Adds an object to the index.booleancontainsObject(T i)Checks whether the index contains a given object.java.util.stream.Stream<T>getAllObjects()A stream of all the objects in the index.java.util.stream.IntStreamgetAllObjectsIds()A stream of all ids.Tidx2object(int idx)Gets the object corresponding to a certain index.intnumObjects()Index size.intobject2idx(T i)Gets the index of a given object.intremoveObject(T t)Removes an object from the index. 
- 
Field Details
- 
t2imap
Integer value for every object. - 
i2tmap
Object for each integer value. - 
numObjects
private int numObjectsNumber of objects. 
 - 
 - 
Constructor Details
- 
FastIndex
public FastIndex()Constructor. 
 - 
 - 
Method Details
- 
containsObject
Description copied from interface:IndexChecks whether the index contains a given object.- Specified by:
 containsObjectin interfaceIndex<T>- Parameters:
 i- The object to check.- Returns:
 - true if the index contains the object, false if not.
 
 - 
numObjects
public int numObjects()Description copied from interface:IndexIndex size.- Specified by:
 numObjectsin interfaceIndex<T>- Returns:
 - the number of objects in the index.
 
 - 
getAllObjects
Description copied from interface:IndexA stream of all the objects in the index.- Specified by:
 getAllObjectsin interfaceIndex<T>- Returns:
 - the stream.
 
 - 
object2idx
Description copied from interface:ReducedIndexGets the index of a given object.- Specified by:
 object2idxin interfaceReducedIndex<T>- Parameters:
 i- Object to obtain.- Returns:
 - the index if the object exists, -1 if not.
 
 - 
idx2object
Description copied from interface:ReducedIndexGets the object corresponding to a certain index.- Specified by:
 idx2objectin interfaceReducedIndex<T>- Parameters:
 idx- The index.- Returns:
 - the object corresponding to the index.
 
 - 
addObject
Description copied from interface:IndexAdds an object to the index. - 
removeObject
Description copied from interface:IndexRemoves an object from the index.- Specified by:
 removeObjectin interfaceIndex<T>- Parameters:
 t- The object to remove.- Returns:
 - the index of the removed object, -1 if it did not exist.
 
 - 
getAllObjectsIds
public java.util.stream.IntStream getAllObjectsIds()Description copied from interface:IndexA stream of all ids.- Specified by:
 getAllObjectsIdsin interfaceIndex<T>- Returns:
 - all ids.
 
 
 -