亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? floorplan.cpp

?? test the resut l llke mjhue hbjhw hhww
?? CPP
字號:
/* File: Floorplan.cpp * Author: Dan Gibson *         ECE 556 HW 3 * Contents: * Class Floorplan, representing a circuit * floorplan, and vital member functions * * Last modified: * Development platforms: Solaris 9, MS-DOS, WINNT * Intended platforms: Solaris 9 */#include <stdio.h>
#include <stdlib.h>#include "Floorplan.h"Floorplan::Floorplan() {  // panic - this shouldn't be called  list = tree = NULL;}/********************************************************** * Function name: Floorplan() - Constructor * Author: Dan Gibson * * Parameters: * * first_index		An integer, the index value of the *					first module * first_height		An integer, the height of the first mod. * first_width		An integer, the width of the first mod. * second_index		An integer, the index value of the *					second mod. * second_height	An integer, the height of the second mod. * second_width		An integer, the width of the second mod. * * Return value * * **********************************************************/Floorplan::Floorplan(int first_index,					 int first_height,					 int first_width,					 int second_index,					 int second_height,					 int second_width) {	tree = new Operator();	tree->myLeftChild = new Module();	tree->myRightChild = new Module();	// setup first node	tree->myLeftChild->myIndex = first_index;	tree->myLeftChild->myHeight = first_height;	tree->myLeftChild->myWidth = first_width;	// setup second node	tree->myRightChild->myIndex = second_index;	tree->myRightChild->myHeight = second_height;	tree->myRightChild->myWidth = second_width;	// setup primary operator	tree->myIndex = (rand()%2==0) ? 'V' : 'H';	GenerateList();	stack = NULL;}Floorplan::Floorplan(Operator * newTree) {	tree = newTree;	GenerateList();	stack = NULL;}Floorplan::~Floorplan() {	Module * current = list;	// seek to end of list	while(current->myNext!=NULL) current=current->myNext;	// iteratively delete the end of the list	while(current!=list) {		current = current->myPrev;		if(current->myNext->myType==OperatorType) {			delete ((Operator *)current->myNext);		} else {			delete ((Module *)current->myNext);		}			}	delete list;	if(stack!=NULL) delete stack;}void Floorplan::AddModule(int index, int width, int height) {	Operator * op = new Operator();	op->myLeftChild = tree;	op->myIndex = (rand()%2==0) ? 'V' : 'H';	tree = op;	tree->myRightChild = new Module();	tree->myRightChild->myIndex = index;	tree->myRightChild->myWidth = width;	tree->myRightChild->myHeight = height;	GenerateList();	return;	}// arg index_of_first is from 1 to nModules,// and represents the MODULE index, ignoring// the role of operators completelybool Floorplan::M1(unsigned int index_of_first) {	return SwapAdjacentOperands(index_of_first);}bool Floorplan::SwapAdjacentOperands(unsigned int index_of_first) {	Module * first, *second;	Operator *first_parent, *second_parent;	first = list->FindModuleWithIndex(index_of_first);	// index cannot be found	if(first==NULL) return false;	second = first->myNext;	while(second!=NULL) {		if(second->myType==ModuleType) {			// second op has been found			break;		}		second = second->myNext;	};	// can't swap the last module	if(second==NULL) return false;	// now have the two operands to be swapped,	// so do the swapping!	first_parent = (Operator *) first->FindParent();	second_parent = (Operator *) second->FindParent();	// now replace "first" with "second"	if(first_parent->myRightChild == first) {		// first is the right child of its parent		first_parent->myRightChild = second;	} else {		// first is the left child of its parent		first_parent->myLeftChild = second;	}	// now replace "second" with "first"	if(second_parent->myRightChild == second ) {		// second is the right child of its parent		second_parent->myRightChild = first;	} else {		// second is the left child of its parent		second_parent->myLeftChild = first;	}	// all this tree restructuring has made the list	// pointers out-of-date, so regenerate the list	// from the tree	GenerateList();	return true;}// both of these return the # of inversions done,// so 0 is an erroneous return valueunsigned int Floorplan::M2(unsigned int first_operator) {	return ChainInvert(first_operator);}unsigned int Floorplan::ChainInvert(unsigned int first_operator) {	// number of inversions performed	unsigned int inversions = 0;	// can't invert operators that don't exist	if(first_operator>=nOperators) return inversions;	// seek to the correct operator	Module * current = list; 	int current_number = -1;	// iterate to the correct operator	while((unsigned int)current_number!=first_operator) {				// advance to the next operator if needed		if(current_number!=-1) current = current->myNext;		// iterate to the next operator		while(current!=NULL && current->myType==ModuleType) {			current = current->myNext;				}		current_number++;		if(current==NULL) {			// this should theoretically never happen,			// that is, the first operator couldn't be found			return inversions;		}	}	// iterate now points to the specified operator	// but that may not be the first operator in a chain--	// if its not, just seek backward to the first operator	while(current->myType==OperatorType) current = current->myPrev;	current = current->myNext;	// current now points to the first operator to be inverted	while(current!=NULL && current->myType==OperatorType) {		// this is an operator in the chain:		// invert it!!		if(current->myIndex == 'V') {			current->myIndex = 'H';		} else {			current->myIndex = 'V';		}		current = current->myNext;		inversions++;	}	return inversions;}bool Floorplan::M3OK() {	return list->M3OK(false,false);}unsigned int Floorplan::M3(unsigned int index) {	return SwapAdjacentOperandAndOperator(index);}unsigned int Floorplan::SwapAdjacentOperandAndOperator(unsigned int index) {	Module *first, *second, *current;	bool mod_before_op;	// can't find operands/operators that don't exist	if(index>nModules+nOperators) return 1;	// find the first to swap	first = list->FindNthModule(index,0);	if(first==NULL) {		// this should theoretically never happen		return 2;	}//	fprintf(stdout,"Looking for the next...\n");	if(first->myType==ModuleType) {		// next must be an operator for this to be		// a potentially valid swap		if(first->myNext==NULL || first->myNext->myType==ModuleType) {			// can't swap two modules in this function--call M1			return 3;		} else {			second = first->myNext;			mod_before_op = true;		}	} else {		// next must be an operand for this to be		// a potentially valid swap		if(first->myNext==NULL || first->myNext->myType==OperatorType) {			// can't swap two operators			return 4;		} else {			second = first->myNext;			mod_before_op = false;		}	}//	fprintf(stdout,"Discovered that the %s is before the %s\n",//		(mod_before_op) ? "Module" : "Operator",//		(mod_before_op) ? "Operator" : "Module");	// A legitimate operand/operator pair or	// operator/operand pair has been found.	// check to ensure that e(i-1)!=e(i+1)	// AKA that swapping the two will yield a	// normalized tree	if(mod_before_op) {		// first is a module		// second is an operator		if(first->myPrev!=NULL) {			if(first->myPrev->myType==OperatorType) {				if(first->myPrev->myIndex==second->myIndex) {					// swap will create a non-normalized tree					return 5;				}			}		}	} else {		// first is an operator		// second is a module		if(second->myNext!=NULL) {			if(second->myNext->myType==OperatorType) {				if(second->myNext->myIndex==first->myIndex) {					// swap will create a non-normalized tree					return 6;				}			}		}	}//	fprintf(stdout,"Normalization property OK\n");	// check the balloting property: do balloting up to	// this point, do some special handling for mod and op,	// then finish the balloting	int ballot = 0;	current = list;	while(current!=NULL) {		if(current==first) {			// pretend that first and second			// have been interchanged			// If first is an operand, decrement the ballot,			// otherwise second is the operand, so decrement			// the ballot			if(mod_before_op)				ballot--;			else				ballot++;		} else if (current==second) {			// pretend that mod and op			// have been interchanged			if(mod_before_op)				ballot++;			else				ballot--;		} else {			// do normal balloting			if(current->myType==ModuleType) {				ballot++;			} else {				ballot--;			}		}		if(ballot<=0) return 7; // balloting failed		current = current->myNext;	}//	fprintf(stdout,"Balloting property OK\n");	// if we get here, then both the normalized	// and balloting properties hold for the proposed move,	// so the move is legal and should be accepted.	// So do the swap!!	// put second into first's place	if(first->myPrev==NULL) {		list = second;	} else {		first->myPrev->myNext = second;	}	first->myNext = second->myNext;	second->myNext = first;	GenerateListBackward();	// We've now done terrible things to the tree,	// so we have to regrow it//	fprintf(stdout,"Swap complete...Dumping list:\n");//	dumpList();//	fprintf(stdout,"Generating tree...\n");	GenerateTree();	return 0;}bool Floorplan::M4(unsigned int index_of_module) {	return RotateModule(index_of_module);}bool Floorplan::RotateModule(unsigned int index_of_module) {	Module * mod = list->FindModuleWithIndex(index_of_module);	if(mod==NULL) return false;	// got the module, now rotate it	unsigned short temp;	temp = mod->myHeight;	mod->myHeight = mod->myWidth;	mod->myWidth = temp;	return true;}int Floorplan::getArea() {
	Rect * myRects = tree->getRectangles();
	Rect * rect = myRects; // current rectangle
	int min_area = rect->x * rect->y;
	
	while(rect!=NULL) {
		// see if current rect smaller than
		// min_area
		if(min_area> rect->x * rect->y)
			min_area = rect->x * rect->y;

		rect = rect->myNext;
	}

	// cleanup the last of the memory
	rect = myRects;
	myRects = rect->myNext;
	while(rect!=NULL) {
		delete rect;
		rect = myRects;
		if(myRects!=NULL) myRects = myRects->myNext;
	}

	return min_area;
/*	return tree->getWidth() * tree->getHeight(); */}/********************************************************** * Function name: Clone() * Author: Dan Gibson * * Parameters: * * Return value * * Clone() returns a new Floorplan object, identical to * (this) * **********************************************************/Floorplan * Floorplan::Clone() {	Operator * newTree;	newTree = tree->Clone();	Floorplan * retval = new Floorplan(newTree);	return retval;	}void Floorplan::dumpTree() {	tree->dumpTree();}void Floorplan::dumpList() {	list->dumpList();}void Floorplan::GenerateListBackward() {	list->myPrev = NULL;	Module * current = list;	nModules = 0; nOperators = 0;	while(current!=NULL) {	//	printf("Visiting ");		// tally the operators and modules along the way		if(current->myType==OperatorType) {			nOperators++;		//	printf("Operator ");		} else {			nModules++;		//	printf("Module   ");		}	//	int printed = printf("%i ",current->myIndex);	//	for(int i=0;i<3-printed;i++) printf(" ");		if(current->myNext!=NULL) {			current->myNext->myPrev = current;	//		printed = printf(": %i",current->myNext->myIndex);	//		for(int j=0;j<4-printed;j++) printf(" ");	//		printf(" is myNext",current->myNext->myIndex);		}	//	printf("\n");		current = current->myNext;	}/*	while(!current->myNext==NULL) {		printf("Visiting current = %i:",current->myIndex);		if(current->myType==OperatorType) {			printf("Operator\n");			nOperators++;		} else {			printf("Module\n");			nModules++;		}		current->myNext->myPrev = current;		current = current->myNext;		int a = 0;		for(int i=0;i<100000000;i++) { a++; }	}*/	nOperators++; // count the last operator (the root)}void Floorplan::GenerateList() {		list = tree->GenerateListForward(NULL);		GenerateListBackward();	}void Floorplan::GenerateTree() {	// going to need a stack for this	if(stack==NULL) {		stack = new ModuleStack(getLength());	}	// add all the nodes to the stack	Module * current = list;	while(current!=NULL) {		stack->push(current);		current = current->myNext;	}	// Pop the root of the tree from the stack	tree = (Operator *) stack->pop();	// Recursively regenerate the tree	tree->GenerateTree(stack);}unsigned int Floorplan::getLength() {	return nModules+nOperators;}unsigned int Floorplan::getModuleCount() {	return nModules;}unsigned int Floorplan::getOperatorCount() {	return nOperators;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品乱码妇女bbbb| 精品国产乱码久久久久久1区2区| 日韩av在线免费观看不卡| 亚洲精品欧美专区| 日韩伦理av电影| 亚洲欧美综合色| 国产精品区一区二区三| 中文字幕不卡的av| 亚洲免费毛片网站| 樱桃国产成人精品视频| 亚洲一区二区三区自拍| 亚洲高清免费观看 | 免费观看日韩av| 日韩高清不卡一区二区| 免费成人av在线播放| 久久99久久99小草精品免视看| 美女在线视频一区| 国内精品在线播放| 日韩免费看网站| 精品国产乱码久久久久久牛牛| 精品捆绑美女sm三区| 久久久久青草大香线综合精品| 久久久久久久久久久久久夜| 欧美国产精品专区| 一区二区三区国产豹纹内裤在线 | 99精品视频一区二区三区| 91视频国产观看| 欧美日韩国产不卡| 久久久欧美精品sm网站| 亚洲免费观看高清完整| 日韩av网站在线观看| 福利电影一区二区| 欧美性做爰猛烈叫床潮| 日韩精品一区二区三区视频播放| 国产欧美一区二区三区网站| 亚洲综合激情小说| 国产精品自拍网站| 欧美视频中文一区二区三区在线观看| 日韩女优视频免费观看| 18欧美乱大交hd1984| 麻豆一区二区三区| 色屁屁一区二区| 久久久久久麻豆| 亚洲国产欧美另类丝袜| 91精品国产欧美日韩| 久久精品人人做| 午夜激情一区二区三区| 白白色亚洲国产精品| 欧美电影免费观看高清完整版在| 日韩一区欧美一区| 久久精品999| 欧美人牲a欧美精品| 日韩一区在线免费观看| 国产电影一区在线| 日韩久久久久久| 亚洲成人1区2区| 99热这里都是精品| 国产午夜亚洲精品理论片色戒| 亚洲一卡二卡三卡四卡无卡久久 | 亚洲影院久久精品| 成人综合在线观看| 精品欧美乱码久久久久久1区2区 | 欧美日韩不卡在线| 亚洲另类在线视频| 不卡视频在线看| 日本一区二区成人在线| 国产美女主播视频一区| 欧美成人在线直播| 奇米精品一区二区三区四区| 欧美日韩精品一区二区三区| 亚洲精品日韩一| 色哟哟日韩精品| 亚洲免费av网站| 91婷婷韩国欧美一区二区| 中文字幕一区av| 91麻豆免费观看| 亚洲乱码日产精品bd| 91免费看片在线观看| 亚洲三级在线免费观看| 色诱视频网站一区| 亚洲综合激情另类小说区| 欧美亚洲国产一区在线观看网站 | 欧美一二三区在线观看| 视频一区视频二区中文字幕| 欧美日韩亚洲不卡| 日韩制服丝袜av| 欧美一区二区在线免费播放| 老司机午夜精品| 久久久久久毛片| 99精品视频在线播放观看| 亚洲人成电影网站色mp4| 色婷婷av一区二区| 日韩成人dvd| 国产色一区二区| 日本精品裸体写真集在线观看| 一区二区三区在线免费播放 | 精品一区二区三区影院在线午夜| 欧美成人精精品一区二区频| 国产成人av在线影院| 亚洲人xxxx| 日韩欧美二区三区| www.在线欧美| 午夜精品久久久久| 久久网站最新地址| 99re成人精品视频| 日本va欧美va精品发布| 国产偷v国产偷v亚洲高清| 一本大道av一区二区在线播放| 天天爽夜夜爽夜夜爽精品视频| 精品成人免费观看| 97se亚洲国产综合自在线不卡 | 日韩一区二区三区三四区视频在线观看| 日韩精品一二三区| 中文字幕在线不卡一区| 欧美精品久久99| av在线综合网| 免费不卡在线视频| 亚洲女与黑人做爰| 久久精品亚洲精品国产欧美kt∨ | 亚洲成人动漫精品| 久久午夜老司机| 欧美高清视频www夜色资源网| 国产精品亚洲一区二区三区在线| 亚洲综合视频网| 国产精品视频你懂的| 日韩限制级电影在线观看| 91在线免费播放| 国产电影一区二区三区| 日韩av成人高清| 一级日本不卡的影视| 国产日产亚洲精品系列| 日韩免费电影一区| 91.xcao| 在线精品视频一区二区三四| 成人性生交大片免费看中文网站| 午夜免费欧美电影| 亚洲制服欧美中文字幕中文字幕| 国产精品网站导航| 久久久久久久网| 精品国产1区2区3区| 777奇米成人网| 欧美高清一级片在线| 在线国产电影不卡| 色就色 综合激情| 97久久久精品综合88久久| 日韩精品中午字幕| 成人av免费观看| 久久成人av少妇免费| 一区二区在线免费| 日韩一区二区三区精品视频| 色综合激情久久| 欧美高清一级片在线| 日韩视频在线你懂得| 中文字幕欧美三区| 日韩精品成人一区二区三区 | 色婷婷香蕉在线一区二区| 欧美精品三级日韩久久| 欧美极品xxx| 视频一区视频二区中文| 成人免费观看视频| 欧美日韩电影一区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 8x8x8国产精品| 国产精品传媒入口麻豆| 蜜桃av一区二区在线观看| 不卡视频在线看| 精品成人私密视频| 亚洲mv在线观看| jvid福利写真一区二区三区| 日韩视频免费观看高清在线视频| 国产精品女主播av| 美女国产一区二区三区| 日本高清视频一区二区| 久久婷婷一区二区三区| 青青草原综合久久大伊人精品优势| 99久久精品99国产精品| 国产婷婷色一区二区三区四区| 亚洲国产成人高清精品| 91在线一区二区| 中文字幕av不卡| 国产精品自拍av| 日韩一区二区高清| 婷婷成人激情在线网| 色婷婷精品大在线视频| 国产精品美女一区二区三区| 黄色精品一二区| 日韩欧美国产综合| 天堂在线亚洲视频| 欧美日韩视频在线第一区 | av激情成人网| 日本一区二区电影| 国产成人在线观看免费网站| 日韩欧美在线一区二区三区| 视频在线在亚洲| 91精品国产一区二区三区香蕉| 一区二区三区久久| 欧美性受xxxx黑人xyx| 亚洲午夜久久久久久久久久久 | 欧美三级电影网站| 亚洲一区二区黄色|