package de.hfu.studiportal.data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class ExamCategory implements Serializable {
	
	private static final long serialVersionUID = -5178814560848378523L;
	private List<Exam> examList;
	private String categoryName;
	
	public ExamCategory(String categoryName) {
		this.setCategoryName(categoryName);
		this.examList = new ArrayList<>();
		
	}
	
	public String getCategoryName() {
		return this.categoryName;
		
	}
	
	public void setCategoryName(String newName) {
		this.categoryName = newName.replace(":", "").replace("*", "");
		
	}
	
	public void addExam(Exam e) {
		this.examList.add(e);
		
	}
	
	public void removeExam(Exam e) {
		this.examList.remove(e);
		
	}
	
	public void removeExam(int index) {
		this.examList.remove(index);
		
	}
	
	public int getExamCount() {
		return this.examList.size();
		
	}
	
	public Exam getExam(int index) {
		return this.examList.get(index);
		
	}
	
	public List<Exam> getAllExams() {
		return new ArrayList<>(this.examList);
		
	}
}

@@ -544,68 +544,344 @@
 %7B%0A%09%09
-this.categoryName = newName.replace(%22:%22, %22%22).replace(%22*%22, %22%22
+//Replace long terms with short ones to keep the titles short.%0A%09%09//Replacing only parts of the title will reserve the meaning (even with unknown titles)%0A%09%09this.categoryName = newName.replace(%22:%22, %22%22).replace(%22*%22, %22%22)%0A%09%09%09%09.replace(%22Module/Teilmodule%22, %22Module%22).replace(%22(ECTS) %22, %22%22)%0A%09%09%09%09.replace(%22Bestandene Module%22, %22Bestanden%22).trim(
 );%0A%09

Optimize category titles through replacing