Hello all,
I have defined 3 classes with their attributes including their unique ID. The relationship between these objcts are hirarchical. For example, I have school, class, and students. At the begining of the simulation I create the school and number of classes and put students in the classes and store the list of school's and classes students in a list. At some points in time I am gadering all the students at the school level and sorting them out. This is happening at the school object the school and put them in the same or different classes based on one of their attributes (lets say thier social behaviors). Most of the students should be assigned to their former class (because of some sort of bound that they have created) but some are gonna change class.
Here is the skech of my 3 classes:
public class School {
private ArrayList<Student> SchoolList = new ArrayList<Student>();
.//Some other related attributes
.
.
}
public class ClassRoom{
private int classSize;
private int ClassID;
private ArrayList<Student> classList = new ArrayList<Student>();
.
.
.
}
public class Student{
private int StID;
privar int ClassID;
.//Other attributes
.
}
My probelem is puting the sorted list of students from my schoolList to their classList in such a way that they maintain their old class unless they have to change it.
I guess, in short my problem is how to link the class Id and students in such a way that I can find them later.
PS: This supposed to be a quick project then i don't want to go to relational DBs and stuff. Also, I do have a classList and I can compare that with the new list of students to check if they are the same but this makes the program runs so slow that makes it out of the question.
I hope it made sense.
Thank you for any advice.