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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TQQueue< TVal > Class Template Reference

#include <ds.h>

Collaboration diagram for TQQueue< TVal >:

List of all members.

Public Member Functions

 TQQueue (const int &_MxLast=64, const int &_MxLen=-1)
 TQQueue (const TQQueue &Queue)
 TQQueue (TSIn &SIn)
void Save (TSOut &SOut) const
TQQueueoperator= (const TQQueue &Queue)
const TVal & operator[] (const int &ValN) const
void Clr (const bool &DoDel=true)
void Gen (const int &_MxLast=64, const int &_MxLen=-1)
void GetSubValV (const int &_BValN, const int &_EValN, TVec< TVal > &SubValV) const
bool Empty () const
int Len () const
const TVal & Top () const
void Pop ()
void Push (const TVal &Val)
void Shuffle (TRnd &Rnd)

Private Attributes

TInt MxLast
TInt MxLen
TInt First
TInt Last
TVec< TVal > ValV

Detailed Description

template<class TVal>
class TQQueue< TVal >

Definition at line 3473 of file ds.h.


Constructor & Destructor Documentation

template<class TVal>
TQQueue< TVal >::TQQueue ( const int &  _MxLast = 64,
const int &  _MxLen = -1 
) [inline]

Definition at line 3479 of file ds.h.

                                                      :
    MxLast(_MxLast), MxLen(_MxLen), First(0), Last(0), ValV(){
    Assert(int(MxLast)>0); Assert((MxLen==-1)||(int(MxLen)>0));}
template<class TVal>
TQQueue< TVal >::TQQueue ( const TQQueue< TVal > &  Queue) [inline]

Definition at line 3482 of file ds.h.

                               :
    MxLast(Queue.MxLast), MxLen(Queue.MxLen),
    First(Queue.First), Last(Queue.Last), ValV(Queue.ValV){}
template<class TVal>
TQQueue< TVal >::TQQueue ( TSIn SIn) [inline, explicit]

Definition at line 3485 of file ds.h.

                             :
    MxLast(SIn), MxLen(SIn), First(SIn), Last(SIn), ValV(SIn){}

Member Function Documentation

template<class TVal>
void TQQueue< TVal >::Clr ( const bool &  DoDel = true) [inline]

Definition at line 3498 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), and TQQueue< TInt >::Shuffle().

{ValV.Clr(DoDel); First=Last=0;}

Here is the caller graph for this function:

template<class TVal>
bool TQQueue< TVal >::Empty ( ) const [inline]

Definition at line 3509 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), and TQQueue< TInt >::Shuffle().

{return First==Last;}

Here is the caller graph for this function:

template<class TVal>
void TQQueue< TVal >::Gen ( const int &  _MxLast = 64,
const int &  _MxLen = -1 
) [inline]

Definition at line 3499 of file ds.h.

                                                       {
    MxLast=_MxLast; MxLen=_MxLen; First=0; Last=0; ValV.Clr();}
template<class TVal>
void TQQueue< TVal >::GetSubValV ( const int &  _BValN,
const int &  _EValN,
TVec< TVal > &  SubValV 
) const [inline]

Definition at line 3501 of file ds.h.

                                                                                   {
    int BValN=TInt::GetMx(0, _BValN);
    int EValN=TInt::GetMn(Len()-1, _EValN);
    SubValV.Gen(EValN-BValN+1);
    for (int ValN=BValN; ValN<=EValN; ValN++){
      SubValV[ValN-BValN]=ValV[Last+ValN];}
  }
template<class TVal>
int TQQueue< TVal >::Len ( ) const [inline]

Definition at line 3510 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TQQueue< TInt >::GetSubValV(), TQQueue< TInt >::operator[](), TQQueue< TInt >::Push(), and TQQueue< TInt >::Shuffle().

{return First-Last;}

Here is the caller graph for this function:

template<class TVal>
TQQueue& TQQueue< TVal >::operator= ( const TQQueue< TVal > &  Queue) [inline]

Definition at line 3491 of file ds.h.

                                          {
    if (this!=&Queue){MxLast=Queue.MxLast; MxLen=Queue.MxLen;
      First=Queue.First; Last=Queue.Last; ValV=Queue.ValV;}
    return *this;}
template<class TVal>
const TVal& TQQueue< TVal >::operator[] ( const int &  ValN) const [inline]

Definition at line 3495 of file ds.h.

                                                {Assert((0<=ValN)&&(ValN<Len()));
    return ValV[Last+ValN];}
template<class TVal>
void TQQueue< TVal >::Pop ( ) [inline]

Definition at line 3513 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), TQQueue< TInt >::Push(), and TQQueue< TInt >::Shuffle().

            {
    IAssert(First!=Last); Last++;
    if (First==Last){ValV.Clr(); First=Last=0;}}

Here is the caller graph for this function:

template<class TVal>
void TQQueue< TVal >::Push ( const TVal &  Val) [inline]

Definition at line 3516 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), and TQQueue< TInt >::Shuffle().

                            {
    if (Last>MxLast){ValV.Del(0, Last-1); First-=Last; Last=0;}
    if ((MxLen!=-1)&&(MxLen==Len())){Pop();}
    First++; ValV.Add(Val);}

Here is the caller graph for this function:

template<class TVal>
void TQQueue< TVal >::Save ( TSOut SOut) const [inline]

Definition at line 3487 of file ds.h.

                               {
    MxLast.Save(SOut); MxLen.Save(SOut);
    First.Save(SOut); Last.Save(SOut); ValV.Save(SOut);}
template<class TVal>
void TQQueue< TVal >::Shuffle ( TRnd Rnd) [inline]

Definition at line 3521 of file ds.h.

                         {
    TVec<TVal> ValV(Len(), 0); while (!Empty()){ValV.Add(Top()); Pop();}
    ValV.Shuffle(Rnd); Clr();
    for (int ValN=0; ValN<ValV.Len(); ValN++){Push(ValV[ValN]);}}
template<class TVal>
const TVal& TQQueue< TVal >::Top ( ) const [inline]

Definition at line 3511 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), and TQQueue< TInt >::Shuffle().

                          {
    Assert(First!=Last); return ValV[Last];}

Here is the caller graph for this function:


Member Data Documentation

template<class TVal>
TInt TQQueue< TVal >::MxLast [private]
template<class TVal>
TInt TQQueue< TVal >::MxLen [private]

The documentation for this class was generated from the following file: