You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
package com.school;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Advisor class represents a club advisor in the club management system.
|
|
* Relationship: One-to-many with Club
|
|
*/
|
|
public class Advisor {
|
|
private int advisorId;
|
|
private String name;
|
|
private String department;
|
|
private List<Club> advisedClubs; // One-to-many relationship
|
|
|
|
public Advisor(int advisorId, String name, String department) {
|
|
this.advisorId = advisorId;
|
|
this.name = name;
|
|
this.department = department;
|
|
this.advisedClubs = new ArrayList<>();
|
|
}
|
|
|
|
public void addAdvisedClub(Club club) {
|
|
if (!advisedClubs.contains(club)) {
|
|
advisedClubs.add(club);
|
|
club.setAdvisor(this);
|
|
}
|
|
}
|
|
|
|
// Getters and Setters
|
|
public int getAdvisorId() { return advisorId; }
|
|
public void setAdvisorId(int advisorId) { this.advisorId = advisorId; }
|
|
public String getName() { return name; }
|
|
public void setName(String name) { this.name = name; }
|
|
public String getDepartment() { return department; }
|
|
public void setDepartment(String department) { this.department = department; }
|
|
public List<Club> getAdvisedClubs() { return advisedClubs; }
|
|
} |