本文整理汇总了Java中org.cpsolver.studentsct.model.Instructor类的典型用法代码示例。如果您正苦于以下问题:Java Instructor类的具体用法?Java Instructor怎么用?Java Instructor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Instructor类属于org.cpsolver.studentsct.model包,在下文中一共展示了Instructor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstructedOfferings
import org.cpsolver.studentsct.model.Instructor; //导入依赖的package包/类
@Override
public Collection<Long> getInstructedOfferings(String instructorExternalId) {
List<Long> ret = new ArrayList<Long>();
Set<Long> sections = new HashSet<Long>();
for (Student student: ((StudentSectioningModel)currentSolution().getModel()).getStudents())
if (instructorExternalId.equals(student.getExternalId()))
for (Unavailability unavailability: student.getUnavailabilities())
sections.add(unavailability.getId());
offerings: for (Offering offering: ((StudentSectioningModel)currentSolution().getModel()).getOfferings()) {
for (Config config: offering.getConfigs())
for (Subpart subpart: config.getSubparts())
for (Section section: subpart.getSections())
if (sections.contains(section.getId())) {
ret.add(offering.getId()); continue offerings;
} else if (section.hasInstructors())
for (Instructor instructor: section.getInstructors())
if (instructorExternalId.equals(instructor.getExternalId())) {
ret.add(offering.getId()); continue offerings;
}
}
return ret;
}
示例2: toInstructors
import org.cpsolver.studentsct.model.Instructor; //导入依赖的package包/类
public List<Instructor> toInstructors() {
if (getInstructors() == null || getInstructors().isEmpty()) return null;
List<Instructor> instructors = new ArrayList<Instructor>();
for (XInstructor instructor: getInstructors())
instructors.add(new Instructor(instructor.getIntructorId(), instructor.getExternalId(), instructor.getName(), instructor.getEmail()));
return instructors;
}
示例3: getInstructors
import org.cpsolver.studentsct.model.Instructor; //导入依赖的package包/类
private List<Instructor> getInstructors(Class_ clazz) {
if (!clazz.isDisplayInstructor().booleanValue()) return null;
List<Instructor> ret = new ArrayList<Instructor>();
TreeSet ts = new TreeSet(clazz.getClassInstructors());
NameFormat nameFormat = NameFormat.fromReference(ApplicationProperty.OnlineSchedulingInstructorNameFormat.value());
for (Iterator i=ts.iterator();i.hasNext();) {
ClassInstructor ci = (ClassInstructor)i.next();
if (!ci.isLead().booleanValue()) continue;
ret.add(new Instructor(ci.getInstructor().getUniqueId(), ci.getInstructor().getExternalUniqueId(), nameFormat.format(ci.getInstructor()), ci.getInstructor().getEmail()));
}
return ret;
}
示例4: getInstructors
import org.cpsolver.studentsct.model.Instructor; //导入依赖的package包/类
private List<Instructor> getInstructors(Class_ clazz) {
if (!clazz.isDisplayInstructor().booleanValue()) return null;
List<Instructor> ret = new ArrayList<Instructor>();
TreeSet ts = new TreeSet(clazz.getClassInstructors());
for (Iterator i=ts.iterator();i.hasNext();) {
ClassInstructor ci = (ClassInstructor)i.next();
if (!ci.isLead().booleanValue()) continue;
ret.add(new Instructor(ci.getInstructor().getUniqueId(), ci.getInstructor().getExternalUniqueId(), iInstructorNameFormat.format(ci.getInstructor()), ci.getInstructor().getEmail()));
}
return ret;
}
示例5: XSection
import org.cpsolver.studentsct.model.Instructor; //导入依赖的package包/类
public XSection(Section section) {
iUniqueId = section.getId();
iAllowOverlap = section.getSubpart().isAllowOverlap();
iName = section.getName();
iNameByCourse = section.getNameByCourse();
iSubpartName = section.getSubpart().getName();
iLimit = section.getLimit();
iParentId = (section.getParent() == null ? null : section.getParent().getId());
iSubpartId = section.getSubpart().getId();
iInstructionalType = section.getSubpart().getInstructionalType();
iNote = section.getNote();
iTime = section.getTime() == null ? null : new XTime(section.getTime());
iCancelled = section.isCancelled();
if (section.getNameByCourse() != null)
for (Map.Entry<Long, String> e: section.getNameByCourse().entrySet()) {
iNameByCourse.put(e.getKey(), e.getValue());
}
if (section.getNrRooms() > 0)
for (RoomLocation room: section.getRooms())
iRooms.add(new XRoom(room));
Set<String> instructorExternalIds = new HashSet<String>();
if (section.hasInstructors()) {
for (Instructor instructor: section.getInstructors()) {
iInstructors.add(new XInstructor(
instructor.getId(),
instructor.getExternalId(),
instructor.getName(),
instructor.getEmail(),
true, false, true));
if (instructor.getExternalId() != null) instructorExternalIds.add(instructor.getExternalId());
}
}
for (Unavailability u: section.getUnavailabilities()) {
if (u.getId() == section.getId() && u.getStudent().getExternalId() != null && instructorExternalIds.add(u.getStudent().getExternalId()))
iInstructors.add(new XInstructor(
u.getStudent().getId(),
u.getStudent().getExternalId(),
u.getStudent().getName(),
null,
false, u.isAllowOverlap(), false));
}
}
示例6: 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;
}
示例7: OnlineSection
import org.cpsolver.studentsct.model.Instructor; //导入依赖的package包/类
public OnlineSection(long id, int limit, String name, Subpart subpart, Placement placement, List<Instructor> instructors, Section parent) {
super(id, limit, name, subpart, placement, instructors, parent);
}
示例8: 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));
}
}