Class ContiguousDocumentalStrategy
- java.lang.Object
-
- it.unimi.di.big.mg4j.index.cluster.ContiguousDocumentalStrategy
-
- All Implemented Interfaces:
ClusteringStrategy,DocumentalClusteringStrategy,DocumentalPartitioningStrategy,PartitioningStrategy,Serializable
public class ContiguousDocumentalStrategy extends Object implements DocumentalPartitioningStrategy, DocumentalClusteringStrategy, Serializable
A documental partitioning and clustering strategy that partitions an index into contiguous segments.To partition an index in contiguous parts, you must provide an array of cutpoints, which define each part. More precisely, given cutpoints c0,c2,…,ck, the global index will be partitioned into k local indices containing the documents from c0 (included) to c1 (excluded), from c1 (included) to c2 and so on. Note that necessarily c0=0 and ck=N, where N is the number of globally indexed documents.
The
properties()method provides two properties, pointerfrom and pointerto, that contain the first (included) and last (excluded) pointer in the local index.- Author:
- Alessandro Arrabito, Sebastiano Vigna
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ContiguousDocumentalStrategy(long... cutPoint)Creates a new contiguous strategy with the given cutpoints.
-
Method Summary
Modifier and Type Method Description longglobalPointer(int localIndex, long localPointer)Returns the global document pointer given a local index and a local document pointer.intlocalIndex(long globalPointer)Returns the index to which a given global document pointer is be mapped by this strategy.longlocalPointer(long globalPointer)Returns the local document pointer corresponding to a global document pointer.longnumberOfDocuments(int localIndex)Returns the number of documents that will be assigned to the given local index.intnumberOfLocalIndices()Returns the number of local indices created by this strategy.Properties[]properties()Returns an array of properties, one for each local index, that specify additional information about local indices.StringtoString()
-
-
-
Constructor Detail
-
ContiguousDocumentalStrategy
public ContiguousDocumentalStrategy(long... cutPoint)
Creates a new contiguous strategy with the given cutpoints.Note that
DocumentalStrategieshas ready-made factory methods for the common cases.- Parameters:
cutPoint- an array of cutpoints (see the class description}.
-
-
Method Detail
-
numberOfLocalIndices
public int numberOfLocalIndices()
Description copied from interface:PartitioningStrategyReturns the number of local indices created by this strategy.- Specified by:
numberOfLocalIndicesin interfaceClusteringStrategy- Specified by:
numberOfLocalIndicesin interfacePartitioningStrategy- Returns:
- the number of local indices created by this strategy.
-
localIndex
public int localIndex(long globalPointer)
Description copied from interface:DocumentalPartitioningStrategyReturns the index to which a given global document pointer is be mapped by this strategy.- Specified by:
localIndexin interfaceDocumentalPartitioningStrategy- Parameters:
globalPointer- a global document pointer.- Returns:
- the corresponding local index.
-
localPointer
public long localPointer(long globalPointer)
Description copied from interface:DocumentalPartitioningStrategyReturns the local document pointer corresponding to a global document pointer.- Specified by:
localPointerin interfaceDocumentalClusteringStrategy- Specified by:
localPointerin interfaceDocumentalPartitioningStrategy- Parameters:
globalPointer- a global document pointer.- Returns:
- the corresponding local document pointer.
-
globalPointer
public long globalPointer(int localIndex, long localPointer)Description copied from interface:DocumentalClusteringStrategyReturns the global document pointer given a local index and a local document pointer.- Specified by:
globalPointerin interfaceDocumentalClusteringStrategy- Parameters:
localIndex- the local index.localPointer- the local document pointer inlocalIndex.- Returns:
- the global document pointer.
-
numberOfDocuments
public long numberOfDocuments(int localIndex)
Description copied from interface:DocumentalPartitioningStrategyReturns the number of documents that will be assigned to the given local index.- Specified by:
numberOfDocumentsin interfaceDocumentalClusteringStrategy- Specified by:
numberOfDocumentsin interfaceDocumentalPartitioningStrategy- Parameters:
localIndex- the local index.- Returns:
- the number of documents that will be assigned to
localIndex.
-
properties
public Properties[] properties()
Description copied from interface:PartitioningStrategyReturns an array of properties, one for each local index, that specify additional information about local indices.- Specified by:
propertiesin interfacePartitioningStrategy- Returns:
- an array of properties, one for each local index; any element
can be
null(in that case, the set of properties is assumed to be empty).
-
-