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

📄 coursecart.java

📁 本程序所写的排课
💻 JAVA
字号:
package com.briup.bean;import java.util.ArrayList;import java.util.HashMap;import java.util.HashSet;import java.util.List;import java.util.Map;import java.util.Set;public class CourseCart {	private Student student;	private Map<Course, String> map = new HashMap<Course, String>();	private int num;		public void setStudent(Student student)	{		this.student = student;		map = new HashMap<Course, String>();	}	public Student getStudent()	{		return student;	}		synchronized public void addCourse(Course course, String time)	{		for(Course c : map.keySet())		{			if(c.getId().equals(course.getId()))				return ;		}//		courseSet.add(course);		map.put(course, time);	}		synchronized public void delCourse(Long courseid)	{//		Set<Map.Entry<Course,String>> set = map.entrySet(); 		Set<Course> set = map.keySet();//		for(Map.Entry<Course, String> course : set)		for(Course course : set)		{			if(course.getId().equals(courseid))				map.remove(course);		}	}		public void delAll()	{		Set<Course> set = map.keySet();		for(Course course : set)		{			map.remove(course);		}	}		public Map<Course, String> getMap()	{		return map;	}	public int getNum() {		return num;	}	public void setNum(int num) {		this.num = num;	}		public Set<SC> getCourseofStudent()	{		Set<SC> scSet = new HashSet<SC>();		Set<Course> set = map.keySet();		for(Course course : set)		{			SC sc = new SC();			sc.setCourse(course);			sc.setStudent(student);			scSet.add(sc);		}		return scSet;	}		public List<String> getCourseTime(List<Deploy> deployList)	{		String[][] time = new String[3][5];		int i = 0, j = 0;		for(j = 0; j < 5; j++ )		{			for(i = 0; i < 3; i++)				time[i][j] = new String("   ");		}				i = 0; j = 0;		Set<Course> courseSet = map.keySet();		for(Course course : courseSet)		{			for(Deploy deploy: deployList)			{				if(course.getId().equals(deploy.getCourse().getId()))				{					String temp = deploy.getTime();//					time[temp.charAt(4)][temp.charAt(2)]										switch(temp.charAt(4))					{					case '一':						j = 0;						break;					case '二':						j = 1;						break;					case '三':						j = 2;						break;					default:						break;					}					switch(temp.charAt(2))					{					case '一':						i = 0;						break;					case '二':						i = 1;						break;					case '三':						i = 2;						break;					case '四':						i = 3;						break;					case '五':						i = 4;						break;					default:						break;					}					time[j][i] = course.getName();				}			}		}				List<String> list = new ArrayList<String>();		for(i = 0; i < 3; i++)		{			for(j = 0; j < 5; j++)			{				list.add(time[i][j]);			}		}		return list;	}}

⌨️ 快捷键说明

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