Exemple #1
0
int main()
{
	int i,size=15;
	ElementList E;
	Element e1;
	e1.id=2000;
	e1.regstatus=0;
	for(i=0;i<size;i++)
	{
			E[i].id=i;
			E[i].regstatus=(i%3); //0= Success, 1 = Conflict, 2 = Deny
	}
	// R containing All (size number) registered student records
	ListHead ks, kd, kc;
	ks=createList();
	kd=createList();
	kc=createList();	 				
	for (i = 0; i < size; i++) {
		if  (E[i].regstatus == 0) {
	  		insertAtTail (E[i], ks);
		} else if  (E[i].regstatus == 1) {
			insertAtHead (E[i], kc);
		} else {
			insertInPos (E[i], kd,2);
		}
	}
	insertAfterValue (e1, ks, 12);
	printf("\n\nSUCCESS LIST\n");
	printList(ks);

	printf("\n\nCONFLICT LIST\n");
	printList(kc);

	printf("\n\nDENY LIST\n");
	printList(kd);


	deleteFromHead(ks);
	deleteFromTail(kc);
	deleteValue(kd,8);
	deletePos(ks,0);

	printf("\n\nSUCCESS LIST After Deletion\n");
	printList(ks);

	printf("\n\nCONFLICT LIST After Deletion\n");
	printList(kc);

	printf("\n\nDENY LIST After Deletion\n");
	printList(kd);
	

}
Exemple #2
0
void EditSheet::delCol(int i) {
    ColumnEditSheet* c = (ColumnEditSheet*)ui->vboxLayout->takeAt(i);
    delete c;
    emit deletePos(i,ui->vboxLayout->count());
}
Exemple #3
0
//----------------------------------------------------------------------------
Boolean Plcm::compactSide(compactType whichDir,int ccx,int ccy)
//
// Compacing in one direction. Returns true if required magnification coeficient
// obtained.
//
{
  int actSize,savSize,otherSize,end;

  if(whichDir == HorizC)
  {
    otherSize=ccy;
    actSize=end=ccx;
  }
  else
  {
    otherSize=ccx;
    actSize=end=ccy;
  }

  int  mid,
       pos1=0,npos1=0,
       pos2=end-1,npos2=end-1;

  savSize=actSize;
  mid=end/2;
  end--;

  for( ;pos1 < mid && pos2 >= mid;pos1++,pos2--,npos2--) 
  {
    if (isEmpty(pos1,otherSize,whichDir) && 
	(pos1==0 || noConflicts(pos1,otherSize,whichDir) ) )
    {
      actSize--;
      deletePos(npos1,whichDir);
      npos2--;
    }
    else
      npos1++;

    if (isEmpty(pos2,otherSize,whichDir) &&
	(pos2== end || noConflicts(pos2,otherSize,whichDir) ) )
    {
      actSize--;
      deletePos(npos2,whichDir); 
    }
    
    if (sizeOk(actSize,otherSize) )    // further compaction not required
      break;
  }
  if (savSize-actSize >0)
    if(whichDir==HorizC)
    {
			cout << "\n         " << (savSize-actSize) << "  column[s] deleted." << endl;
      layoutToBuild->bbx[HOR]=actSize*thisImage.size[HOR]+thisImage.overlap[HOR];
    }
    else
    {
			cout << "\n         " << (savSize-actSize) << "  row[s] deleted." << endl;
      layoutToBuild->bbx[VER]=actSize*thisImage.size[VER]+thisImage.overlap[VER];;
    }
  return(sizeOk(actSize,otherSize));

}// Plcm::compactSide  //