libsrc/split.cxx File Reference

routines to split overfull loaves More...

#include <memory.h>
#include "udanax.h"

Include dependency graph for split.cxx:

Include dependency graph

Go to the source code of this file.

Functions

bool splitcrumupwards (typecuc *father)
 ???

void splitcrumseq (typecuc *father)
 ???

void splitcrumsp (typecuc *father)
 ???

void splitcrumpm (typecuc *father)
 ???

void splitcrum (typecuc *father)
 ???

void peelcrumoffnd (typecorecrum *ptr)
 ???


Detailed Description

routines to split overfull loaves

(to be defined)

Definition in file split.cxx.


Function Documentation

void peelcrumoffnd typecorecrum ptr  ) 
 

???

(to be defined)

Definition at line 225 of file split.cxx.

References adopt(), typecuc::age, typecorecrumhedr::age, assert, typecuc::cdsp, typecorecrumhedr::cdsp, typecuc::cenftype, createcrum(), disown(), findfather(), typecuc::height, isfullcrum(), ivemodified(), LEFTMOSTSON, movewisp, NEW, rejuvinate, reserve(), RESERVED, RIGHTBRO, setwispupwards(), and typecorecrum.

Referenced by splitcrumpm(), and splitcrumsp().

00227 {
00228     if (isfullcrum(ptr))
00229         assert(0); // peeloffcurmnd called with fullcrum
00230 
00231     typecuc *father     = findfather(ptr);
00232     int      ofatherage = father->age;
00233     int      optrage    = ptr->age;
00234 
00235     father->age = NEW;
00236     ptr->age    = NEW;
00237 
00238     reserve((typecorecrum *) father);
00239     father->modified = true;           /* an uncle will get ivemodified shortly in 10 lines */
00240     reserve(ptr);
00241     disown(ptr);
00242 
00243     typecorecrum *newcc = createcrum((int) father->height, (int) father->cenftype);
00244     adopt(newcc, RIGHTBRO, (typecorecrum *) father);
00245     movewisp(&father->cdsp, &newcc->cdsp);
00246     adopt(ptr, LEFTMOSTSON, newcc);
00247     rejuvinate(newcc);
00248     rejuvinate(ptr);
00249     rejuvinate((typecorecrum *) father);
00250 
00251     if (ofatherage == RESERVED)
00252         father->age = RESERVED;
00253 
00254     if (optrage == RESERVED)
00255         ptr->age = RESERVED;
00256 
00257     ivemodified(ptr);
00258     setwispupwards(father, 0);
00259     setwispupwards((typecuc *) newcc, 0);
00260     setwispupwards((typecuc *) ptr, 1);
00261 }

void splitcrum typecuc father  ) 
 

???

(to be defined)

Definition at line 204 of file split.cxx.

References assert, typecuc::cenftype, GRAN, POOM, setwispupwards(), SPAN, splitcrumpm(), splitcrumseq(), and splitcrumsp().

Referenced by splitcrumupwards().

00206 {
00207     switch (father->cenftype) {
00208     case GRAN:  splitcrumseq(father);  break;
00209     case POOM:  splitcrumpm(father);   break;
00210     case SPAN:  splitcrumsp(father);   break;
00211     default:
00212         assert(0); // splitcrum: bad enftype
00213     }
00214     setwispupwards(father, 0);
00215 }

void splitcrumpm typecuc father  )  [static]
 

???

(to be defined)

Definition at line 182 of file split.cxx.

References typecorecrumhedr::cdsp, typewid::dsas, findleftson(), findrightbro, GREATER, peelcrumoffnd(), SPANRANGE, tumblercmp(), and typecorecrum.

Referenced by splitcrum().

00184 {
00185     typecorecrum *ptr, *correctone;
00186 
00187     for (correctone = ptr = findleftson(father); ptr; ptr = findrightbro(ptr)) {
00188         if (tumblercmp(&ptr->cdsp.dsas[SPANRANGE], &correctone->cdsp.dsas[SPANRANGE]) == GREATER)
00189 /* if (comparecrumsdiagonally(ptr, correctone) == LESS) */
00190             correctone = ptr;
00191     }
00192     peelcrumoffnd(correctone);
00193 }

void splitcrumseq typecuc father  )  [static]
 

???

(to be defined)

Definition at line 128 of file split.cxx.

References adopt(), typecuc::cenftype, createcrum(), disown(), findleftbro(), findrightmostson(), typecuc::height, ivemodified(), LEFTMOSTSON, typecuc::numberofsons, rejuvinate, reserve(), RIGHTBRO, setwispupwards(), and typecorecrum.

Referenced by splitcrum().

00130 {
00131     typecorecrum *newcc, *ptr, *next;
00132     int i, halfsons;
00133 
00134     ivemodified((typecorecrum *) father);
00135     newcc = createcrum((int) father->height, (int) father->cenftype);
00136     reserve(newcc);
00137     adopt(newcc, RIGHTBRO, (typecorecrum *) father);
00138     rejuvinate(newcc);
00139     ivemodified(newcc);
00140     halfsons = father->numberofsons / 2;
00141     for (i = 0, ptr = findrightmostson(father); i < halfsons && ptr; ++i, ptr = next) {
00142         next = findleftbro(ptr);
00143         disown(ptr);
00144         adopt(ptr, LEFTMOSTSON, newcc);
00145         rejuvinate(ptr);
00146         ivemodified(ptr);              /* zzz */
00147     }
00148 
00149     setwispupwards(father, 0);
00150     setwispupwards((typecuc *) newcc, 0);
00151 }

void splitcrumsp typecuc father  )  [static]
 

???

(to be defined)

Definition at line 161 of file split.cxx.

References comparecrumsdiagonally(), findleftson(), findrightbro, GREATER, peelcrumoffnd(), and typecorecrum.

Referenced by splitcrum().

00163 {
00164     typecorecrum *ptr, *correctone;
00165 
00166     for (correctone = ptr = findleftson(father); ptr; ptr = findrightbro(ptr)) {
00167 /* if (tumblercmp(&ptr->cdsp.dsas[SPANRANGE], &correctone->cdsp.dsas[SPANRANGE]) == GREATER) */
00168         if (comparecrumsdiagonally(ptr, correctone) == GREATER)
00169             correctone = ptr;
00170     }
00171     peelcrumoffnd(correctone);
00172 }

bool splitcrumupwards typecuc father  ) 
 

???

(to be defined)

Definition at line 89 of file split.cxx.

References assert, asserttreeisok(), findfather(), findleftson(), typecuc::height, isfullcrum(), L, levelpush(), splitcrum(), toomanysons(), and typecorecrum.

Referenced by insertcbcnd(), insertseq(), and rearrangend().

00091 {
00092     bool splitsomething = false;
00093 
00094     if (father->height <= 0)
00095         assert(0); // splitcrumupwards on bottom crum
00096 
00097     for (; toomanysons(father); father = (typecuc *) findfather((typecorecrum *) father)) {
00098         if (isfullcrum((typecorecrum *) father)) {
00099             levelpush(father);
00100             splitcrum((typecuc *) findleftson(father));
00101 
00102 #ifndef DISTRIBUTION
00103             L("splitcrumupwards split something\n");
00104             asserttreeisok((typecorecrum *) father);
00105 #endif
00106             return true;
00107         }
00108         splitcrum(father);
00109         splitsomething = true;
00110     }
00111 
00112 #ifndef DISTRIBUTION
00113     asserttreeisok((typecorecrum *) father);
00114 #endif
00115 
00116     return splitsomething;
00117 }


Generated on Sun Aug 21 04:18:38 2005 for Udanax-Green by doxygen1.3.4