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

📄 courseclass.cpp

📁 遗传算法的四个源程序和源代码
💻 CPP
字号:

/*
 * 
 * website: http://www.coolsoft-sd.com/
 * contact: support@coolsoft-sd.com
 *
 */

/*
 * Genetic Algorithm Library
 * Copyright (C) 2007-2008 Coolsoft Software Development
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 */

#include "stdafx.h"
#include "CourseClass.h"

// Initializes class object
CourseClass::CourseClass(Professor* professor, Course* course, const list<StudentsGroup*>& groups,
						 bool requiresLab, int duration) : 
						 _professor(professor),
						 _course(course),
						 _numberOfSeats(0),
						 _requiresLab(requiresLab),
						 _duration(duration)
{
	// bind professor to class
	_professor->AddCourseClass( this );

	// bind student groups to class
	for( list<StudentsGroup*>::const_iterator it = groups.begin(); it != groups.end(); it++ )
	{
		( *it )->AddClass( this );
		_groups.push_back( *it );
		_numberOfSeats += ( *it )->GetNumberOfStudents();
	}
}

// Frees used memory
CourseClass::~CourseClass() { }

// Returns TRUE if another class has one or overlapping student groups.
bool CourseClass::GroupsOverlap(const CourseClass& c ) const
{
	for( list<StudentsGroup*>::const_iterator it1 = _groups.begin(); it1 != _groups.end(); it1++ )
	{
		for( list<StudentsGroup*>::const_iterator it2 = c._groups.begin(); it2 != c._groups.end(); it2++ )
		{
			if( *it1 == *it2 )
				return true;
		}
	}

	return false;
}

⌨️ 快捷键说明

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