⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 definitions_raj.h

📁 clustering for ns-2 simulation
💻 H
字号:
/** * Copyright (c) 2006 Michele Mastrogiovanni. * *   Licensed under the Apache License, Version 2.0 (the "License"); *   you may not use this file except in compliance with the License. *   You may obtain a copy of the License at * *       http://www.apache.org/licenses/LICENSE-2.0 * *   Unless required by applicable law or agreed to in writing, software *   distributed under the License is distributed on an "AS IS" BASIS, *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *   See the License for the specific language governing permissions and *   limitations under the License. * */ /** * Questo file contiene alcune definizioni utilizzate nell' * algoritmo rajaraman (e forse nel vezirani). */  //------------------------------------------------------// Tempo dell'algoritmo.//------------------------------------------------------typedef struct _AlgorithmTime {	// Round.	int				round;	// Fase.	int				fase;	// Valore massimo di fase.	int				last_fase;		public:		_AlgorithmTime() {			round = 0;			fase = 0;			last_fase = 0;		}			// Costruttore.		_AlgorithmTime(int r, int f, int l) {			round = r;			fase = f;			last_fase = l;		}		// Costruttore.		_AlgorithmTime(const _AlgorithmTime & t) {			round = t.round;			fase = t.fase;			last_fase = t.last_fase;		}				// Operatore di uguaglianza.		bool operator== (struct _AlgorithmTime & t) {			return ((t.fase == fase) && (t.round == round));		}		// Operatore minore.		bool operator < (struct _AlgorithmTime & t) {			if (round < t.round)				return true;			if (round > t.round)				return false;			if (fase < t.fase)				return true;			return false;		}		// Operatore maggiore.		bool operator > (struct _AlgorithmTime & t) {			if (round > t.round)				return true;			if (round < t.round)				return false;			if (fase > t.fase)				return true;			return false;		}				void operator++ () {			if (fase == last_fase) {				round++;				fase = 0;				return;			}			fase++;		}		void operator-- () {			if (fase == 0) {				round--;				fase = last_fase;				return;			}			fase--;		}} AlgorithmTime;boolstd::less<AlgorithmTime>::operator()(const AlgorithmTime & t1, const AlgorithmTime & t2) const{	if (t1.round < t2.round)		return true;	if (t1.round > t2.round)		return false;	if (t1.fase < t2.fase)		return true;	return false;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -