Skip to content

Commit

Permalink
Student Scheduling: Student Campus
Browse files Browse the repository at this point in the history
- added student campus to AreaClassificationMajor
  • Loading branch information
tomas-muller committed Jan 23, 2024
1 parent 1573987 commit 9e9b6b9
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/org/cpsolver/studentsct/StudentSectioningXMLLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ protected Student loadStudent(Element studentEl, Map<Long, Offering> offeringTab
requestEl.attributeValue("concentration"), requestEl.attributeValue("concentrationName"),
requestEl.attributeValue("degree"), requestEl.attributeValue("degreeName"),
requestEl.attributeValue("program"), requestEl.attributeValue("programName"),
requestEl.attributeValue("campus"), requestEl.attributeValue("campusName"),
requestEl.attributeValue("weight") == null ? null : Double.valueOf(requestEl.attributeValue("weight"))));
else
student.getAreaClassificationMajors().add(new AreaClassificationMajor(
Expand All @@ -1037,6 +1038,7 @@ protected Student loadStudent(Element studentEl, Map<Long, Offering> offeringTab
requestEl.attributeValue("concentration"), requestEl.attributeValue("concentrationName"),
requestEl.attributeValue("degree"), requestEl.attributeValue("degreeName"),
requestEl.attributeValue("program"), requestEl.attributeValue("programName"),
requestEl.attributeValue("campus"), requestEl.attributeValue("campusName"),
requestEl.attributeValue("weight") == null ? null : Double.valueOf(requestEl.attributeValue("weight"))));
} else if ("group".equals(requestEl.getName())) {
student.getGroups().add(new StudentGroup(requestEl.attributeValue("type"), requestEl.attributeValue("reference"), requestEl.attributeValue("name")));
Expand Down
8 changes: 8 additions & 0 deletions src/org/cpsolver/studentsct/StudentSectioningXMLSaver.java
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,10 @@ protected void saveStudent(Element studentEl, Student student) {
acmEl.addAttribute("programName", acm.getProgramName());
if (acm.getWeight() != 1.0)
acmEl.addAttribute("weight", String.valueOf(acm.getWeight()));
if (acm.getCampus() != null)
acmEl.addAttribute("campus", acm.getCampus());
if (acm.getCampusName() != null && iShowNames)
acmEl.addAttribute("campusName", acm.getCampusName());
}
for (AreaClassificationMajor acm : student.getAreaClassificationMinors()) {
Element acmEl = studentEl.addElement("acm");
Expand Down Expand Up @@ -746,6 +750,10 @@ protected void saveStudent(Element studentEl, Student student) {
acmEl.addAttribute("programName", acm.getProgramName());
if (acm.getWeight() != 1.0)
acmEl.addAttribute("weight", String.valueOf(acm.getWeight()));
if (acm.getCampus() != null)
acmEl.addAttribute("campus", acm.getCampus());
if (acm.getCampusName() != null && iShowNames)
acmEl.addAttribute("campusName", acm.getCampusName());
}
for (StudentGroup g : student.getGroups()) {
Element grEl = studentEl.addElement("group");
Expand Down
58 changes: 58 additions & 0 deletions src/org/cpsolver/studentsct/model/AreaClassificationMajor.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class AreaClassificationMajor {
private Double iWeight;
private String iDegree, iDegreeName;
private String iProgram, iProgramName;
private String iCampus, iCampusName;

/**
* Constructor
Expand Down Expand Up @@ -219,6 +220,49 @@ public AreaClassificationMajor(
iProgramName = programName;
iWeight = weight;
}

/**
* Constructor
*
* @param areaCode academic area abbreviation
* @param areaName academic area name
* @param classificationCode academic classificationCode
* @param classificationName academic classificationName
* @param majorCode major code
* @param majorName major name
* @param concentrationCode concentration (optional)
* @param concentrationName concentration (optional)
* @param degreeCode degree (optional)
* @param degreeName degree (optional)
* @param programCode program (optional)
* @param programName program (optional)
* @param weight weight (optional)
*/
public AreaClassificationMajor(
String areaCode, String areaName,
String classificationCode, String classificationName,
String majorCode, String majorName,
String concentrationCode, String concentrationName,
String degreeCode, String degreeName,
String programCode, String programName,
String campus, String campusName,
Double weight) {
iArea = areaCode;
iAreaName = areaName;
iClassification = classificationCode;
iClassificationName = classificationName;
iMajor = majorCode;
iMajorName = majorName;
iConcentration = concentrationCode;
iConcentrationName = concentrationName;
iDegree = degreeCode;
iDegreeName = degreeName;
iProgram = programCode;
iProgramName = programName;
iCampus = campus;
iCampusName = campusName;
iWeight = weight;
}

/** Academic area
* @return academic area abbreviation
Expand Down Expand Up @@ -304,6 +348,20 @@ public String getProgramName() {
return iProgramName;
}

/** Campus (optional)
* @return campus name
**/
public String getCampus() {
return iCampus;
}

/** Campus (optional)
* @return campus name
**/
public String getCampusName() {
return iCampusName;
}

/** Weight (optional, defaults to 1.0)
*/
public double getWeight() { return iWeight == null ? 1.0 : iWeight.doubleValue(); }
Expand Down

0 comments on commit 9e9b6b9

Please sign in to comment.