當前位置: 首頁>>代碼示例>>Python>>正文


Python Class.get_name方法代碼示例

本文整理匯總了Python中Class.get_name方法的典型用法代碼示例。如果您正苦於以下問題:Python Class.get_name方法的具體用法?Python Class.get_name怎麽用?Python Class.get_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Class的用法示例。


在下文中一共展示了Class.get_name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: addClass

# 需要導入模塊: import Class [as 別名]
# 或者: from Class import get_name [as 別名]
    def addClass(self,courseName,courseNumber,sessionNumber,credits,type,section, professorName,days,lecTime,roomNumber,campus,prereqs):
        #change parameters courseName & courseNumber to courseCode (basically fusing them together)
        #Type contains LEC,TUT,LAB/

        #incomplete

        classTime = self.convertTime(lecTime)
        name = str(courseName)+" "+str(courseNumber) #Ex. Concatenates ENGR + " " + 371 .
        newClass = Class(name,sessionNumber,type,section, professorName,days,classTime[0],classTime[1],roomNumber,campus,[])
        
        classNameArray = newClass.get_name().split(" ")
        courseList = self.courseMap.get(courseName)
       
        if(len(courseList)==0):
            self.courseMap.get(courseName).append(Course("Course Code",name,credits,prereqs,[newClass]))
            
        else:
            for i in xrange(0,len(courseList)):
                if(name == courseList[i].getCourseName()):
                    #Hit found in course list ("ENGR 371" == "ENGR 371"), therefore course exists.
                    #Proceed to appropriate tut or lab, or append new lecture to course
                    if(newClass.get_type() == "LEC"):
                        courseList[i].addClass(newClass)


                    if(newClass.get_type() == "TUT"):
                        #Will appropriate the tutorial to the correct lecture
                        #Compare the first letter of the lecture section to the first of the tut
                        # If they are the same, tutorial is appended to the lecture
                        lectureList = courseList[i].get_lectures()
                        for j in xrange(0,len(lectureList)):
                            if(lectureList[j].get_name()==classNameArray[0]):
                                lectureList[j].addClass(newClass)
                    if(newClass.get_type() == "LAB"):
                        lectureList = courseList[i].get_lectures()
                        for j in xrange(0,len(lectureList)):
                            lectureName = lectureList[j].get_name()
                            if(lectureName == classNameArray[0]):
                                if(lectureList[j].hasTutorial()==False):
                                    #Lecture doesn't have any tutorials, therefore lab is added
                                    #This situation doesn't happen often
                                    lectureList[j].addClass(newClass)
                                else:
                                    tutList = lectureList[j].get_section()
                                    for k in xrange(0,len(tutList)):
                                        tutName = tutList[k].get_name().split(" ")
                                        if(tutName[1] == classNameArray[1]):
                                            tutList[k].addClass(newClass)

                elif(i==(len(courseList)-1)):
                    #create Course and add it to map containing newClass
                    newCourse = Course("Course Code",name,credits,prereqs,[newClass])
                    self.courseMap.get(courseName).append(newCourse)
開發者ID:kazo0,項目名稱:SOEN341-Scheduler,代碼行數:55,代碼來源:CourseContainer.py


注:本文中的Class.get_name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。