当前位置: 首页>>代码示例>>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;未经允许,请勿转载。