Back to index

fet  5.18.0
teacher.cpp
Go to the documentation of this file.
00001 //
00002 //
00003 // Description: This file is part of FET
00004 //
00005 //
00006 // Author: Liviu Lalescu <Please see http://lalescu.ro/liviu/ for details about contacting Liviu Lalescu (in particular, you can find here the e-mail address)>
00007 // Copyright (C) 2003 Liviu Lalescu <http://lalescu.ro/liviu/>
00008 //
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "teacher.h"
00019 #include "rules.h"
00020 
00021 Teacher::Teacher()
00022 {
00023 }
00024 
00025 Teacher::~Teacher()
00026 {
00027 }
00028 
00029 QString Teacher::getXmlDescription()
00030 {
00031        QString s="<Teacher>\n";
00032        s+="   <Name>"+protect(this->name)+"</Name>\n";
00033        s+="</Teacher>\n";
00034 
00035        return s;
00036 }
00037 
00038 QString Teacher::getDetailedDescription()
00039 {
00040        QString s=tr("Teacher");
00041        s+="\n";
00042        s+=tr("Name=%1", "The name of the teacher").arg(this->name);
00043        s+="\n";
00044 
00045        return s;
00046 }
00047 
00048 QString Teacher::getDetailedDescriptionWithConstraints(Rules& r)
00049 {
00050        QString s=this->getDetailedDescription();
00051 
00052        s+="--------------------------------------------------\n";
00053        s+=tr("Time constraints directly related to this teacher:");
00054        s+="\n";
00055        for(int i=0; i<r.timeConstraintsList.size(); i++){
00056               TimeConstraint* c=r.timeConstraintsList[i];
00057               if(c->isRelatedToTeacher(this)){
00058                      s+="\n";
00059                      s+=c->getDetailedDescription(r);
00060               }
00061        }
00062 
00063        s+="--------------------------------------------------\n";
00064        s+=tr("Space constraints directly related to this teacher:");
00065        s+="\n";
00066        for(int i=0; i<r.spaceConstraintsList.size(); i++){
00067               SpaceConstraint* c=r.spaceConstraintsList[i];
00068               if(c->isRelatedToTeacher(this)){
00069                      s+="\n";
00070                      s+=c->getDetailedDescription(r);
00071               }
00072        }
00073        s+="--------------------------------------------------\n";
00074 
00075        return s;
00076 }
00077 
00078 int teachersAscending(const Teacher* t1, const Teacher* t2)
00079 {
00080        return t1->name < t2->name;
00081 }