import java.util.ArrayList; import java.util.HashMap; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import javafx.collections.FXCollections; import javafx.collections.ObservableList; /* NOTE::editor: micro complains about all javafx things just ignore */ public class School { private ObservableList instructorList; private ObservableList courseList; private ObservableList studentList; private String name; private static School inst = null; private School(/*String file,*/ String schoolName) { instructorList = FXCollections.observableArrayList(); courseList = FXCollections.observableArrayList(); studentList = FXCollections.observableArrayList(); this.name = schoolName; } // These two methods secure the singleton pattern for ur public static School getSchool() { return inst; } public static void createSchool(String schoolName) { if(inst == null) { inst = new School(schoolName); } } public void editCourse(Course c) { /* Helper func to notify an actual change for the ui */ int k = courseList.indexOf(c); courseList.set(k,c); } public ObservableList uiGetInstructors() { return instructorList; } public ObservableList uiGetCourses() { return courseList; } public ObservableList uiGetStudents() { return studentList; } public void editStudent(Student s) { int k = studentList.indexOf(s); studentList.set(k,s); } public void readData(String filename) { try { BufferedReader reader = new BufferedReader(new FileReader(filename)); // first line is how many instructors we want to add int inst_count = Integer.parseInt(reader.readLine()); for(int i =0;i