SNAP Library 2.0, Developer Reference
2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <xmath.h>
Public Member Functions | |
TComb () | |
TComb (const int &_Items, const int &_Order) | |
~TComb () | |
TComb (TSIn &) | |
void | Save (TSOut &) |
TComb & | operator= (const TComb &) |
bool | GetNext () |
TIntV & | GetItemV () |
int | GetCombN () const |
int | GetCombs () const |
void | Wr () |
Static Public Member Functions | |
static PComb | New (const int &Items, const int &Order) |
static PComb | Load (TSIn &SIn) |
Public Attributes | |
int | Items |
int | Order |
int | CombN |
TIntV | ItemV |
Private Attributes | |
TCRef | CRef |
Friends | |
class | TPt< TComb > |
TComb::TComb | ( | ) | [inline] |
TComb::TComb | ( | const int & | _Items, |
const int & | _Order | ||
) | [inline] |
TComb::~TComb | ( | ) | [inline] |
int TComb::GetCombN | ( | ) | const [inline] |
int TComb::GetCombs | ( | ) | const |
TIntV& TComb::GetItemV | ( | ) | [inline] |
bool TComb::GetNext | ( | ) |
Definition at line 724 of file xmath.cpp.
References CombN, TVec< TVal, TSizeTy >::Gen(), Items, ItemV, TVec< TVal, TSizeTy >::Last(), TVec< TVal, TSizeTy >::Len(), and Order.
{ if (ItemV.Len()==0){ ItemV.Gen(Order, Order); for (int OrderN=0; OrderN<Order; OrderN++){ ItemV[OrderN]=OrderN;} return true; } else { if (ItemV.Last()==Items-1){ int OrderN=Order-1; while ((OrderN>=0)&&(ItemV[OrderN]==Items-(Order-OrderN-1)-1)){OrderN--;} if (OrderN<0){ return false; } else { ItemV[OrderN]++; for (int SubOrderN=OrderN+1; SubOrderN<Order; SubOrderN++){ ItemV[SubOrderN]=ItemV[SubOrderN-1]+1;} CombN++; return true; } } else { ItemV.Last()++; CombN++; return true; } } }
static PComb TComb::Load | ( | TSIn & | SIn | ) | [inline, static] |
static PComb TComb::New | ( | const int & | Items, |
const int & | Order | ||
) | [inline, static] |
void TComb::Save | ( | TSOut & | ) | [inline] |
void TComb::Wr | ( | ) |
int TComb::CombN |
TCRef TComb::CRef [private] |
int TComb::Items |
Definition at line 316 of file xmath.h.
Referenced by GetCombs(), and GetNext().
int TComb::Order |
Definition at line 317 of file xmath.h.
Referenced by GetCombs(), GetNext(), and Wr().