本文整理汇总了Java中org.cpsolver.studentsct.model.Instructor.getEmail方法的典型用法代码示例。如果您正苦于以下问题:Java Instructor.getEmail方法的具体用法?Java Instructor.getEmail怎么用?Java Instructor.getEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cpsolver.studentsct.model.Instructor
的用法示例。
在下文中一共展示了Instructor.getEmail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toProto
import org.cpsolver.studentsct.model.Instructor; //导入方法依赖的package包/类
public static OnlineSectioningLog.Section.Builder toProto(SctAssignment a, Course c, Reservation r) {
OnlineSectioningLog.Section.Builder section = OnlineSectioningLog.Section.newBuilder();
if (a instanceof Section) {
Section s = (Section)a;
section.setClazz(
OnlineSectioningLog.Entity.newBuilder()
.setUniqueId(s.getId())
.setExternalId(c == null ? s.getName() : s.getName(c.getId()))
.setName(s.getName(-1l))
);
section.setSubpart(
OnlineSectioningLog.Entity.newBuilder()
.setUniqueId(s.getSubpart().getId())
.setName(s.getSubpart().getName())
.setExternalId(s.getSubpart().getInstructionalType())
);
if (s.hasInstructors()) {
for (Instructor i: s.getInstructors()) {
OnlineSectioningLog.Entity.Builder instructor = OnlineSectioningLog.Entity.newBuilder()
.setUniqueId(i.getId())
.setName(i.getName());
if (i.getExternalId() != null)
instructor.setExternalId(i.getExternalId());
else if (i.getEmail() != null)
instructor.setExternalId(i.getEmail());
section.addInstructor(instructor);
}
}
}
if (c != null) {
section.setCourse(
OnlineSectioningLog.Entity.newBuilder()
.setUniqueId(c.getId())
.setName(c.getName()));
}
if (a.getTime() != null) {
OnlineSectioningLog.Time.Builder time = OnlineSectioningLog.Time.newBuilder();
time.setDays(a.getTime().getDayCode());
time.setStart(a.getTime().getStartSlot());
time.setLength(a.getTime().getLength());
if (a.getTime().getDatePatternName() != null && !a.getTime().getDatePatternName().isEmpty())
time.setPattern(a.getTime().getDatePatternName());
else if (a instanceof FreeTimeRequest)
time.setPattern("Free Time");
section.setTime(time);
}
if (a.getRooms() != null) {
for (RoomLocation room: a.getRooms()) {
section.addLocation(OnlineSectioningLog.Entity.newBuilder()
.setUniqueId(room.getId())
.setName(room.getName())
);
}
}
if (r != null) {
OnlineSectioningLog.Entity.Builder reservation = OnlineSectioningLog.Entity.newBuilder()
.setUniqueId(r.getId());
if (r instanceof GroupReservation)
reservation.setType(OnlineSectioningLog.Entity.EntityType.GROUP_RESERVATION);
else if (r instanceof IndividualReservation)
reservation.setType(OnlineSectioningLog.Entity.EntityType.INDIVIDUAL_RESERVATION);
else if (r instanceof CurriculumReservation) {
reservation.setType(OnlineSectioningLog.Entity.EntityType.CURRICULUM_RESERVATION);
CurriculumReservation cr = (CurriculumReservation)r;
reservation.setName(cr.getAcademicArea() + (cr.getClassifications().isEmpty() ? "" : " " + cr.getClassifications()) + (cr.getMajors().isEmpty() ? "" : cr.getMajors()));
} else if (r instanceof CourseReservation)
reservation.setType(OnlineSectioningLog.Entity.EntityType.RESERVATION);
section.setReservation(reservation);
}
return section;
}
示例2: saveSection
import org.cpsolver.studentsct.model.Instructor; //导入方法依赖的package包/类
/**
* Save section
* @param sectionEl section element to be populated
* @param section section to be saved
*/
protected void saveSection(Element sectionEl, Section section) {
sectionEl.addAttribute("id", getId("section", section.getId()));
sectionEl.addAttribute("limit", String.valueOf(section.getLimit()));
if (section.isCancelled())
sectionEl.addAttribute("cancelled", "true");
if (iShowNames && section.getNameByCourse() != null)
for (Map.Entry<Long, String> entry: section.getNameByCourse().entrySet())
sectionEl.addElement("cname").addAttribute("id", getId("course", entry.getKey())).setText(entry.getValue());
if (section.getParent() != null)
sectionEl.addAttribute("parent", getId("section", section.getParent().getId()));
if (section.hasInstructors()) {
for (Instructor instructor: section.getInstructors()) {
Element instructorEl = sectionEl.addElement("instructor");
instructorEl.addAttribute("id", getId("instructor", instructor.getId()));
if (iShowNames && instructor.getName() != null)
instructorEl.addAttribute("name", instructor.getName());
if (iShowNames && instructor.getExternalId() != null)
instructorEl.addAttribute("externalId", instructor.getExternalId());
if (iShowNames && instructor.getEmail() != null)
instructorEl.addAttribute("email", instructor.getExternalId());
}
}
if (iShowNames)
sectionEl.addAttribute("name", section.getName());
if (section.getPlacement() != null) {
TimeLocation tl = section.getPlacement().getTimeLocation();
if (tl != null) {
Element timeLocationEl = sectionEl.addElement("time");
timeLocationEl.addAttribute("days", sDF[7].format(Long.parseLong(Integer
.toBinaryString(tl.getDayCode()))));
timeLocationEl.addAttribute("start", String.valueOf(tl.getStartSlot()));
timeLocationEl.addAttribute("length", String.valueOf(tl.getLength()));
if (tl.getBreakTime() != 0)
timeLocationEl.addAttribute("breakTime", String.valueOf(tl.getBreakTime()));
if (iShowNames && tl.getTimePatternId() != null)
timeLocationEl.addAttribute("pattern", getId("timePattern", tl.getTimePatternId()));
if (iShowNames && tl.getDatePatternId() != null)
timeLocationEl.addAttribute("datePattern", tl.getDatePatternId().toString());
if (iShowNames && tl.getDatePatternName() != null
&& tl.getDatePatternName().length() > 0)
timeLocationEl.addAttribute("datePatternName", tl.getDatePatternName());
timeLocationEl.addAttribute("dates", bitset2string(tl.getWeekCode()));
if (iShowNames)
timeLocationEl.setText(tl.getLongName(true));
}
for (RoomLocation rl : section.getRooms()) {
Element roomLocationEl = sectionEl.addElement("room");
roomLocationEl.addAttribute("id", getId("room", rl.getId()));
if (iShowNames && rl.getBuildingId() != null)
roomLocationEl.addAttribute("building", getId("building", rl.getBuildingId()));
if (iShowNames && rl.getName() != null)
roomLocationEl.addAttribute("name", rl.getName());
roomLocationEl.addAttribute("capacity", String.valueOf(rl.getRoomSize()));
if (rl.getPosX() != null && rl.getPosY() != null)
roomLocationEl.addAttribute("location", rl.getPosX() + "," + rl.getPosY());
if (rl.getIgnoreTooFar())
roomLocationEl.addAttribute("ignoreTooFar", "true");
}
}
if (iSaveOnlineSectioningInfo) {
if (section.getSpaceHeld() != 0.0)
sectionEl.addAttribute("hold", sStudentWeightFormat.format(section.getSpaceHeld()));
if (section.getSpaceExpected() != 0.0)
sectionEl.addAttribute("expect", sStudentWeightFormat
.format(section.getSpaceExpected()));
}
if (section.getIgnoreConflictWithSectionIds() != null && !section.getIgnoreConflictWithSectionIds().isEmpty()) {
Element ignoreEl = sectionEl.addElement("no-conflicts");
for (Long sectionId: section.getIgnoreConflictWithSectionIds())
ignoreEl.addElement("section").addAttribute("id", getId("section", sectionId));
}
}