diff options
Diffstat (limited to 'lib/PLList.cc')
| -rw-r--r-- | lib/PLList.cc | 44 | 
1 files changed, 38 insertions, 6 deletions
diff --git a/lib/PLList.cc b/lib/PLList.cc index 5234b91..48d294c 100644 --- a/lib/PLList.cc +++ b/lib/PLList.cc @@ -2,6 +2,23 @@  #include "config.h"  #include "PLList.h" +/*****************************************************\ +*                                                     * +* File de priorité basée sur une liste chaînée triée. * +*                                                     * +\*****************************************************/ + + /* + +  * Cette file de priorité a une structure non récursive. Elle se base sur +  * une SList pour fonctionner.  +  * +  */ + + + /* +  * La méthode "Union" est en fait l'algorithme "Fusion" du tri-fusion. +  */  PriorityList *PLList::Union(PriorityList * P)  { @@ -37,6 +54,13 @@ PriorityList *PLList::Union(PriorityList * P)  	return this;  } + + /* +  * Cette méthode va "décrocher" l'élément de la liste +  * et va tenter de trouver sa nouvelle place, en se déplaçant +  * depuis son ancienne place vers la "gauche". +  */ +  bool PLList::Lower_Key(Cell x, Key_t NKey)  {  	CList *T = ((CList *) x), *t; @@ -51,8 +75,7 @@ bool PLList::Lower_Key(Cell x, Key_t NKey)  	if (T->Right)  		T->Right->Left = T->Left; -	for (t = T->Left; ((t->Left->Left) && (NKey < t->Left->Key)); -	     t = t->Left) ; +	for (t = T->Left; ((t->Left->Left) && (NKey < t->Left->Key)); t = t->Left) ;  	T->Left = t->Left;  	T->Right = t; @@ -61,25 +84,34 @@ bool PLList::Lower_Key(Cell x, Key_t NKey)  } + /* +  * Toutes les autres méthodes sont "simples" (c'est à dire une lignes ou deux) +  * et parlent d'elles-même. Nul besoin de commentaires pour elles. Elles se +  * basent en grande partie sur la SList présente dans la structure. +  */ +  PLList::PLList(void)  {  	type = T_PLLIST;  	Key = 0;  	Datas = NULL; -}; +} +  PLList::~PLList(void)  {  	delete Head.Right; -}; +}  Key_t PLList::ReadKey(Cell C)  {  	return Head.ReadKey(C); -}; +} +  Datas_t PLList::ReadDatas(Cell C)  {  	return Head.ReadDatas(C); -}; +} +  int PLList::rn(void)  {  	int n = 0;  | 
