Class ClusterMembership

Object
ClusterMembership

public class ClusterMembership extends Object
A mapping of files to membership of particular clusters.
Author:
Owen Feehan
  • Constructor Details

    • ClusterMembership

      public ClusterMembership(ClusterIdentifier clusterIdentifierIfAbsent)
      Creates a new ClusterMembership instance.
      Parameters:
      clusterIdentifierIfAbsent - The cluster-identifier that is returned for get operations where no file-mapping exists in the map.

      This can be convenient to describe outliers that have not been placed in any cluster.

  • Method Details

    • associateFileWithCluster

      public void associateFileWithCluster(File file, long timestamp, ClusterIdentifier clusterIdentifier) throws OperationFailedException
      Indicates a particular file is a member of a particular cluster.
      Parameters:
      file - the file.
      timestamp - the timetamp (seconds since the epoch).
      clusterIdentifier - an identifier for the cluster.
      Throws:
      OperationFailedException - if the file is already associated with a cluster.
    • clusterFor

      public ClusterIdentifier clusterFor(File file)
      Finds the corresponding cluster for a particular file.
      Parameters:
      file - the file to find a cluster for.
      Returns:
      the identifier for the cluster from the map, or clusterIdentifierIfAbsent (as per constructor) if the file is not mapped.