/*************************************************************************** * UnaryCluster.c * * Jorge Vittes * * functions on unary clusters ************************************************************************/ #include #include #include "FreeList.h" #include "Data.h" #include "BaseCluster.h" #include "UnaryCluster.h" #include "BinCluster.h" #include "FinalCluster.h" /* Constructor for a unary cluster given unary data */ unary_cluster::unary_cluster(unary_data dat) { data = dat; parent = NULL; child = NULL; binaryCl[0] = NULL; affected = 0; for(int i=0;idata; i++; break; } } for(i=i;idata),&dat); } addData(&dat,&(((unary_cluster *)(child))->data),&dat); deprintf("Raking %d: bchild = %d\n",id,(GET_BC(binaryCl[0]))->id); rakeIn(getBinData(binaryCl[0]),&dat,&data); } /* Return the non non-vanishing endpoint */ int unary_cluster::getNonVanishing() { printf ("Fatal Moral Error: Unary clusters do not have non-vanishing end points (boundaries).\n"); assert (0); } /* Return the vanishing endpoint */ int unary_cluster::getVanishing() { return parent -> id; } /* siblings is just the set of binary clusters that are your siblings */ cluster** unary_cluster::getSiblings() { assert (parent); return (parent->getBinaryClusters ()); } /* return an array of all child clusters */ cluster** unary_cluster::getClusters() { int i; cluster** arr = (cluster**)malloc(sizeof(cluster*)*MAX_DEGREE); arr[0] = binaryCl[0]; for(i=0;i