/*5*/void calcPrintData(hashTable arrayHash[]) { char*tempWord; double avgLinkedList; int linkedCount,from,i; int totalPrime = 0; int linkedListCount = 0; int longestLinkIndex = 0; int linkedListLengthTotal = 0; int longestLengthLinkedList = 0; for(i=0;i<MAX;i++){ if(arrayHash[i].elemStatus == 1){ //array is full if(arrayHash[i].collision != NULL){ linkedCount = listCount(arrayHash[i].collision); linkedListLengthTotal += linkedCount; totalPrime++; linkedListCount++; } else if(arrayHash[i].collision == NULL){ totalPrime++; } } } avgLinkedList = (double)linkedListLengthTotal/linkedListCount; for(i=0;i<MAX;i++){ //finding longest length linked list if(arrayHash[i].collision != NULL){ linkedCount = listCount(arrayHash[i].collision); if(linkedCount >= longestLengthLinkedList) longestLengthLinkedList = linkedCount; } } for(i=0;i<MAX;i++){ // print index with the linked list length at the index if(arrayHash[i].collision != NULL){ linkedCount = listCount(arrayHash[i].collision); printf("index %d list length %d\n",i,linkedCount); } } printf("\nTotal entries: %d\n",(totalPrime + linkedListLengthTotal)); printf("Entries in primary area: %d\n", totalPrime); printf("Number of linked lists: %d\n",linkedListCount); printf("Average list length %4.2f\n",avgLinkedList); printf("Longest list length: %d\nat index:",longestLengthLinkedList); for(i=0;i<MAX;i++){ if(arrayHash[i].collision != NULL){ linkedCount = listCount(arrayHash[i].collision); if(longestLengthLinkedList == linkedCount){ printf("\n%d:",i); from = 0; while((traverse(arrayHash[i].collision,from,(void**)&tempWord)) != 0){ printf(" %s",tempWord); from++; } } } } userInteraction(arrayHash); }//end calcPrintData
bool Animator::maySwitchToAnotherMenu() { // Exit if (key[KEY_ESC] || pArea->get_state("animator.b_close")) return true; bool need_refresh = sel_idx >= 0; if (amz != mouse_z) { zoom *= expf( (amz - mouse_z) * 0.1f ); need_refresh = true; } if (key[KEY_R]) { zoom = 0.1f; r1 = 0.0f, r2 = 0.0f, r3 = 0.0f; need_refresh = true; } if (key[KEY_X]) { if (TA3D_SHIFT_PRESSED) r1 = 0.0f, r2 = -90.0f, r3 = 0.0f; else r1 = 0.0f, r2 = 90.0f, r3 = 0.0f; need_refresh = true; } if (key[KEY_Y]) { if (TA3D_SHIFT_PRESSED) r1 = -90.0f, r2 = 0.0f, r3 = 0.0f; else r1 = 90.0f, r2 = 0.0f, r3 = 0.0f; need_refresh = true; } if (key[KEY_Z]) { if (TA3D_SHIFT_PRESSED) r1 = 0.0f, r2 = 180.0f, r3 = 0.0f; else r1 = 0.0f, r2 = 0.0f, r3 = 0.0f; need_refresh = true; } if (pArea->is_mouse_over("animator.render")) { if ((amx != mouse_x || amy != mouse_y) && mouse_b == 2) { r2 += mouse_x - amx; r1 += mouse_y - amy; need_refresh = true; } need_refresh |= userInteraction(); } if (need_refresh) renderModel(); return false; }