| 
    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 <ds.h>
Public Types | |
| typedef TLstNd< TVal > * | PLstNd | 
Public Member Functions | |
| TLst () | |
| TLst (const TLst &) | |
| ~TLst () | |
| TLst (TSIn &SIn) | |
| void | Save (TSOut &SOut) const | 
| TLst & | operator= (const TLst &) | 
| void | Clr () | 
| bool | Empty () const | 
| int | Len () const | 
| PLstNd | First () const | 
| PLstNd | Last () const | 
| TVal & | FirstVal () const | 
| TVal & | LastVal () const | 
| PLstNd | AddFront (const TVal &Val) | 
| PLstNd | AddBack (const TVal &Val) | 
| PLstNd | AddFrontSorted (const TVal &Val, const bool &Asc=true) | 
| PLstNd | AddBackSorted (const TVal &Val, const bool &Asc=true) | 
| void | PutFront (const PLstNd &Nd) | 
| void | PutBack (const PLstNd &Nd) | 
| PLstNd | Ins (const PLstNd &Nd, const TVal &Val) | 
| void | Del (const TVal &Val) | 
| void | Del (const PLstNd &Nd) | 
| void | DelFirst () | 
| void | DelLast () | 
| PLstNd | SearchForw (const TVal &Val) | 
| PLstNd | SearchBack (const TVal &Val) | 
Private Attributes | |
| int | Nds | 
| PLstNd | FirstNd | 
| PLstNd | LastNd | 
Friends | |
| class | TLstNd< TVal > | 
Definition at line 3612 of file ds.h.
References TLst< TVal >::AddBack(), Assert, TSIn::Load(), and TLst< TVal >::Nds.
: Nds(0), FirstNd(NULL), LastNd(NULL){ int CheckNds=0; SIn.Load(CheckNds); for (int NdN=0; NdN<CheckNds; NdN++){AddBack(TVal(SIn));} Assert(Nds==CheckNds); }

Definition at line 3637 of file ds.h.
References TLstNd< TVal >::NextNd, and TLstNd< TVal >::Val.
Referenced by TExpVal::MkClone(), and TLst< TVal >::TLst().
                                                {
  PLstNd Nd=new TLstNd<TVal>(LastNd, NULL, Val);
  if (LastNd!=NULL){LastNd->NextNd=Nd; LastNd=Nd;}
  else {FirstNd=Nd; LastNd=Nd;}
  Nds++; return Nd;
}

| TLstNd< TVal > * TLst< TVal >::AddBackSorted | ( | const TVal & | Val, | 
| const bool & | Asc = true  | 
        ||
| ) | 
Definition at line 3658 of file ds.h.
References TLstNd< TVal >::Prev(), and TLstNd< TVal >::Val.
                                                                       {
  PLstNd Nd=Last();
  while ((Nd!=NULL)&&((Asc&&(Val<Nd->Val))||(!Asc&&(Val>Nd->Val)))){
    Nd=Nd->Prev();}
  return Ins(Nd, Val);
}

Definition at line 3629 of file ds.h.
References TLstNd< TVal >::PrevNd, and TLstNd< TVal >::Val.
| TLstNd< TVal > * TLst< TVal >::AddFrontSorted | ( | const TVal & | Val, | 
| const bool & | Asc = true  | 
        ||
| ) | 
Definition at line 3645 of file ds.h.
References TLstNd< TVal >::Next(), TLstNd< TVal >::Prev(), and TLstNd< TVal >::Val.
                                                                        {
  PLstNd Nd=First();
  if (Nd==NULL){
    return Ins(Nd, Val);
  } else {
    while ((Nd!=NULL)&&((Asc&&(Val>Nd()))||(!Asc&&(Val<Nd())))){
      Nd=Nd->Next();}
    if (Nd==NULL){return Ins(Nd->Last(), Val);}
    else {return Ins(Nd->Prev(), Val);}
  }
}

Definition at line 3705 of file ds.h.
Referenced by TLst< TKey >::DelFirst(), and TLst< TKey >::DelLast().
                                   {
  PLstNd Nd=SearchForw(Val);
  if (Nd!=NULL){Del(Nd);}
}

Definition at line 3711 of file ds.h.
References Assert, TLstNd< TVal >::NextNd, and TLstNd< TVal >::PrevNd.
Definition at line 3588 of file ds.h.
Referenced by TExpVal::MkClone(), TExpVal::operator<(), TExpVal::operator==(), and TExpVal::SaveTxt().
{return FirstNd;}

Definition at line 3694 of file ds.h.
References TLstNd< TVal >::NextNd, TLstNd< TVal >::PrevNd, and TLstNd< TVal >::Val.
Definition at line 3587 of file ds.h.
Referenced by TExpVal::operator<(), TExpVal::operator==(), and TExpVal::SaveTxt().
{return Nds;}

Definition at line 3680 of file ds.h.
References Assert, TLstNd< TVal >::NextNd, and TLstNd< TVal >::PrevNd.
                                        {
  Assert(Nd!=NULL);
  // unchain
  if (Nd->PrevNd==NULL){FirstNd=Nd->NextNd;}
  else {Nd->PrevNd->NextNd=Nd->NextNd;}
  if (Nd->NextNd==NULL){LastNd=Nd->PrevNd;}
  else {Nd->NextNd->PrevNd=Nd->PrevNd;}
  // add to back
  Nd->PrevNd=LastNd; Nd->NextNd=NULL;
  if (LastNd!=NULL){LastNd->NextNd=Nd; LastNd=Nd;}
  else {FirstNd=Nd; LastNd=Nd;}
}
Definition at line 3666 of file ds.h.
References Assert, TLstNd< TVal >::NextNd, and TLstNd< TVal >::PrevNd.
                                         {
  Assert(Nd!=NULL);
  // unchain
  if (Nd->PrevNd==NULL){FirstNd=Nd->NextNd;}
  else {Nd->PrevNd->NextNd=Nd->NextNd;}
  if (Nd->NextNd==NULL){LastNd=Nd->PrevNd;}
  else {Nd->NextNd->PrevNd=Nd->PrevNd;}
  // add to front
  Nd->PrevNd=NULL; Nd->NextNd=FirstNd;
  if (FirstNd!=NULL){FirstNd->PrevNd=Nd; FirstNd=Nd;}
  else {FirstNd=Nd; LastNd=Nd;}
}
Definition at line 3620 of file ds.h.
References IAssert, TLstNd< TVal >::NextNd, TSOut::Save(), and TLstNd< TVal >::Val.
                                       {
  SOut.Save(Nds);
  PLstNd Nd=FirstNd; int CheckNds=0;
  while (Nd!=NULL){
    Nd->Val.Save(SOut); Nd=Nd->NextNd; CheckNds++;}
  IAssert(Nds==CheckNds);
}

| TLstNd< TVal > * TLst< TVal >::SearchBack | ( | const TVal & | Val | ) | 
Definition at line 3731 of file ds.h.
References TLstNd< TVal >::GetVal(), TLstNd< TVal >::Prev(), and TLstNd< TVal >::Val.
                                                   {
  PLstNd Nd=Last();
  while (Nd!=NULL){
    if (Nd->GetVal()==Val){return Nd;}
    Nd=Nd->Prev();
  }
  return NULL;
}

| TLstNd< TVal > * TLst< TVal >::SearchForw | ( | const TVal & | Val | ) | 
Definition at line 3721 of file ds.h.
References TLstNd< TVal >::GetVal(), TLstNd< TVal >::Next(), and TLstNd< TVal >::Val.
                                                   {
  PLstNd Nd=First();
  while (Nd!=NULL){
    if (Nd->GetVal()==Val){return Nd;}
    Nd=Nd->Next();
  }
  return NULL;
}

Definition at line 3570 of file ds.h.
Referenced by TLst< TKey >::Clr(), TLst< TKey >::DelFirst(), TLst< TKey >::First(), and TLst< TKey >::FirstVal().
Definition at line 3571 of file ds.h.
Referenced by TLst< TKey >::Clr(), TLst< TKey >::DelLast(), TLst< TKey >::Last(), and TLst< TKey >::LastVal().
Definition at line 3569 of file ds.h.
Referenced by TLst< TKey >::Clr(), TLst< TKey >::Empty(), TLst< TKey >::Len(), and TLst< TVal >::TLst().