Program Listing for File ListMFSet.h
↰ Return to documentation for file (ADS/mfset/ListMFSet.h)
/*--------------------------------------------------------------------------*/
/*---------------------------- File ListMFSet.h ----------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/
#ifndef __ADS_ListMFSet
#define __ADS_ListMFSet
/* self-identification: #endif constant */
/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/
#include "ADS/Contract.h"
#include <stdexcept>
#include <utility>
#include <vector>
/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/
namespace ADS {
/*--------------------------------------------------------------------------*/
/*---------------------------- CLASS ListMFSet -----------------------------*/
/*--------------------------------------------------------------------------*/
class ListMFSet {
/*--------------------------------------------------------------------------*/
public:
explicit ListMFSet( int n );
[[nodiscard]] int n( void ) const;
[[nodiscard]] int find( int x ) const;
bool merge( int x , int y );
[[nodiscard]] long relabels( void ) const;
/*------------------------- THE STANDARD INTERFACE -------------------------*/
[[nodiscard]] const std::vector< int > & members( int x ) const;
/*--------------------------------------------------------------------------*/
private:
[[nodiscard]] bool listed( void ) const;
std::vector< int > f_head;
std::vector< std::vector< int > > f_list;
long f_relabels = 0;
}; // end( class ListMFSet )
} // end( namespace ADS )
/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/
#include "ADS/mfset/impl/ListMFSet.tpp"
/*--------------------------------------------------------------------------*/
#endif /* ListMFSet.h included */
/*--------------------------------------------------------------------------*/
/*-------------------------- End File ListMFSet.h --------------------------*/
/*--------------------------------------------------------------------------*/