it.unimi.di.mg4j.index.cluster
Class IdentityDocumentalStrategy

java.lang.Object
  extended by it.unimi.di.mg4j.index.cluster.IdentityDocumentalStrategy
All Implemented Interfaces:
ClusteringStrategy, DocumentalClusteringStrategy, Serializable

public class IdentityDocumentalStrategy
extends Object
implements DocumentalClusteringStrategy, Serializable

A documental strategy that maps identically local to global pointers and viceversa.

When clustering a posteriory a set of previously built renumbered indices using a DocumentalMergedCluster, local document pointers are actually global document pointers. In this case, an instance of this class should be used as a strategy for the cluster.

Author:
Sebastiano Vigna
See Also:
Serialized Form

Constructor Summary
IdentityDocumentalStrategy(int numberOfLocalIndices, int numberOfDocuments)
          Creates a new identity documental clustering strategy.
 
Method Summary
 int globalPointer(int localIndex, int localPointer)
          Returns the global document pointer given a local index and a local document pointer.
 int localPointer(int globalPointer)
          Returns the local document pointer corresponding to a global document pointer.
 int numberOfDocuments(int localIndex)
          Returns the number of documents that will be assigned to the given local index.
 int numberOfLocalIndices()
          Returns the number of local indices handled by this strategy.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IdentityDocumentalStrategy

public IdentityDocumentalStrategy(int numberOfLocalIndices,
                                  int numberOfDocuments)
Creates a new identity documental clustering strategy.

Parameters:
numberOfLocalIndices - the number of local indices.
numberOfDocuments - the number of documents.
Method Detail

numberOfLocalIndices

public int numberOfLocalIndices()
Description copied from interface: ClusteringStrategy
Returns the number of local indices handled by this strategy.

Specified by:
numberOfLocalIndices in interface ClusteringStrategy
Returns:
the number of local indices handled by this strategy.

localPointer

public int localPointer(int globalPointer)
Description copied from interface: DocumentalClusteringStrategy
Returns the local document pointer corresponding to a global document pointer.

Specified by:
localPointer in interface DocumentalClusteringStrategy
Parameters:
globalPointer - a global document pointer.
Returns:
the corresponding local document pointer.

globalPointer

public int globalPointer(int localIndex,
                         int localPointer)
Description copied from interface: DocumentalClusteringStrategy
Returns the global document pointer given a local index and a local document pointer.

Specified by:
globalPointer in interface DocumentalClusteringStrategy
Parameters:
localIndex - the local index.
localPointer - the local document pointer in localIndex.
Returns:
the global document pointer.

numberOfDocuments

public int numberOfDocuments(int localIndex)
Description copied from interface: DocumentalClusteringStrategy
Returns the number of documents that will be assigned to the given local index.

Specified by:
numberOfDocuments in interface DocumentalClusteringStrategy
Parameters:
localIndex - the local index.
Returns:
the number of documents that will be assigned to localIndex.

toString

public String toString()
Overrides:
toString in class Object