本文整理汇总了Java中org.cpsolver.exam.model.ExamOwner类的典型用法代码示例。如果您正苦于以下问题:Java ExamOwner类的具体用法?Java ExamOwner怎么用?Java ExamOwner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExamOwner类属于org.cpsolver.exam.model包,在下文中一共展示了ExamOwner类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAssignedExams
import org.cpsolver.exam.model.ExamOwner; //导入依赖的package包/类
@Override
public Collection<ExamAssignmentInfo> getAssignedExams(Long subjectAreaId) {
if (subjectAreaId==null || subjectAreaId<0) return getAssignedExams();
String sa = new SubjectAreaDAO().get(subjectAreaId).getSubjectAreaAbbreviation()+" ";
Lock lock = currentSolution().getLock().readLock();
lock.lock();
try {
Vector<ExamAssignmentInfo> ret = new Vector<ExamAssignmentInfo>();
for (Exam exam: currentSolution().getModel().variables()) {
boolean hasSubjectArea = false;
for (Iterator<ExamOwner> f=exam.getOwners().iterator();!hasSubjectArea && f.hasNext();) {
ExamOwner ecs = (ExamOwner)f.next();
hasSubjectArea = ecs.getName().startsWith(sa);
}
if (hasSubjectArea) {
ExamPlacement placement = currentSolution().getAssignment().getValue(exam);
if (placement!=null)
ret.add(new ExamAssignmentInfo(placement, currentSolution().getAssignment()));
}
}
return ret;
} finally {
lock.unlock();
}
}
示例2: getUnassignedExams
import org.cpsolver.exam.model.ExamOwner; //导入依赖的package包/类
@Override
public Collection<ExamInfo> getUnassignedExams(Long subjectAreaId) {
if (subjectAreaId==null || subjectAreaId<0) return getUnassignedExams();
String sa = new SubjectAreaDAO().get(subjectAreaId).getSubjectAreaAbbreviation()+" ";
Lock lock = currentSolution().getLock().readLock();
lock.lock();
try {
Vector<ExamInfo> ret = new Vector<ExamInfo>();
for (Exam exam: currentSolution().getModel().variables()) {
boolean hasSubjectArea = false;
for (Iterator<ExamOwner> f=exam.getOwners().iterator();!hasSubjectArea && f.hasNext();) {
ExamOwner ecs = f.next();
hasSubjectArea = ecs.getName().startsWith(sa);
}
if (hasSubjectArea) {
ExamPlacement placement = currentSolution().getAssignment().getValue(exam);
if (placement==null)
ret.add(new ExamInfo(exam));
}
}
return ret;
} finally {
lock.unlock();
}
}
示例3: getChangesToInitial
import org.cpsolver.exam.model.ExamOwner; //导入依赖的package包/类
@Override
public Collection<ExamAssignmentInfo[]> getChangesToInitial(Long subjectAreaId) {
String sa = (subjectAreaId!=null && subjectAreaId>=0 ? new SubjectAreaDAO().get(subjectAreaId).getSubjectAreaAbbreviation()+" ":null);
Vector<ExamAssignmentInfo[]> changes = new Vector<ExamAssignmentInfo[]>();
Lock lock = currentSolution().getLock().readLock();
lock.lock();
try {
for (Exam exam: currentSolution().getModel().variables()) {
if (sa!=null) {
boolean hasSubjectArea = false;
for (Iterator<ExamOwner> f=exam.getOwners().iterator();!hasSubjectArea && f.hasNext();) {
ExamOwner ecs = f.next();
hasSubjectArea = ecs.getName().startsWith(sa);
}
if (!hasSubjectArea) continue;
}
if (!ToolBox.equals(exam.getInitialAssignment(),currentSolution().getAssignment().getValue(exam))) {
changes.add(new ExamAssignmentInfo[] {
new ExamAssignmentInfo(exam,exam.getInitialAssignment(), currentSolution().getAssignment()),
new ExamAssignmentInfo(exam,currentSolution().getAssignment().getValue(exam), currentSolution().getAssignment())});
}
}
} finally {
lock.unlock();
}
return changes;
}
示例4: getChangesToBest
import org.cpsolver.exam.model.ExamOwner; //导入依赖的package包/类
@Override
public Collection<ExamAssignmentInfo[]> getChangesToBest(Long subjectAreaId) {
String sa = (subjectAreaId!=null && subjectAreaId>=0 ? new SubjectAreaDAO().get(subjectAreaId).getSubjectAreaAbbreviation()+" ":null);
Vector<ExamAssignmentInfo[]> changes = new Vector<ExamAssignmentInfo[]>();
Lock lock = currentSolution().getLock().readLock();
lock.lock();
try {
for (Exam exam: currentSolution().getModel().variables()) {
if (sa!=null) {
boolean hasSubjectArea = false;
for (Iterator<ExamOwner> f=exam.getOwners().iterator();!hasSubjectArea && f.hasNext();) {
ExamOwner ecs = f.next();
hasSubjectArea = ecs.getName().startsWith(sa);
}
if (!hasSubjectArea) continue;
}
if (!ToolBox.equals(exam.getBestAssignment(),currentSolution().getAssignment().getValue(exam))) {
changes.add(new ExamAssignmentInfo[] {
new ExamAssignmentInfo(exam,exam.getBestAssignment(),currentSolution().getAssignment()),
new ExamAssignmentInfo(exam,currentSolution().getAssignment().getValue(exam),currentSolution().getAssignment())});
}
}
} finally {
lock.unlock();
}
return changes;
}
示例5: loadStudents
import org.cpsolver.exam.model.ExamOwner; //导入依赖的package包/类
protected void loadStudents() {
loadStudents(
new ExamDAO().getSession().createQuery(
"select x.uniqueId, o.uniqueId, e.student.uniqueId from "+
"Exam x inner join x.owners o, "+
"StudentClassEnrollment e inner join e.clazz c "+
"where x.session.uniqueId=:sessionId and x.examType.uniqueId=:examTypeId and "+
"o.ownerType="+org.unitime.timetable.model.ExamOwner.sOwnerTypeClass+" and "+
"o.ownerId=c.uniqueId").setLong("sessionId", iSessionId).setLong("examTypeId", iExamTypeId).list(),
"class");
loadStudents(
new ExamDAO().getSession().createQuery(
"select x.uniqueId, o.uniqueId, e.student.uniqueId from "+
"Exam x inner join x.owners o, "+
"StudentClassEnrollment e inner join e.clazz c " +
"inner join c.schedulingSubpart.instrOfferingConfig ioc " +
"where x.session.uniqueId=:sessionId and x.examType.uniqueId=:examTypeId and "+
"o.ownerType="+org.unitime.timetable.model.ExamOwner.sOwnerTypeConfig+" and "+
"o.ownerId=ioc.uniqueId").setLong("sessionId", iSessionId).setLong("examTypeId", iExamTypeId).list(),
"config");
loadStudents(
new ExamDAO().getSession().createQuery(
"select x.uniqueId, o.uniqueId, e.student.uniqueId from "+
"Exam x inner join x.owners o, "+
"StudentClassEnrollment e inner join e.courseOffering co " +
"where x.session.uniqueId=:sessionId and x.examType.uniqueId=:examTypeId and "+
"o.ownerType="+org.unitime.timetable.model.ExamOwner.sOwnerTypeCourse+" and "+
"o.ownerId=co.uniqueId").setLong("sessionId", iSessionId).setLong("examTypeId", iExamTypeId).list(),
"course");
loadStudents(
new ExamDAO().getSession().createQuery(
"select x.uniqueId, o.uniqueId, e.student.uniqueId from "+
"Exam x inner join x.owners o, "+
"StudentClassEnrollment e inner join e.courseOffering.instructionalOffering io " +
"where x.session.uniqueId=:sessionId and x.examType.uniqueId=:examTypeId and "+
"o.ownerType="+org.unitime.timetable.model.ExamOwner.sOwnerTypeOffering+" and "+
"o.ownerId=io.uniqueId").setLong("sessionId", iSessionId).setLong("examTypeId", iExamTypeId).list(),
"offering");
}
示例6: sameOwners
import org.cpsolver.exam.model.ExamOwner; //导入依赖的package包/类
private boolean sameOwners(Exam x1, Exam x2) {
if (x1.getOwners().isEmpty() || x1.getOwners().size()!=x2.getOwners().size()) return false;
owners: for (ExamOwner o1: x1.getOwners()) {
org.unitime.timetable.model.ExamOwner w1 = iOwners.get(o1.getId());
for (ExamOwner o2: x2.getOwners()) {
org.unitime.timetable.model.ExamOwner w2 = iOwners.get(o2.getId());
if (w1.getOwnerType().equals(w2.getOwnerType()) && w1.getOwnerId().equals(w2.getOwnerId())) continue owners;
}
return false;
}
return true;
}
示例7: getOwners
import org.cpsolver.exam.model.ExamOwner; //导入依赖的package包/类
private List<ExamOwner> getOwners(Exam exam) {
if (!exam.getOwners().isEmpty())
return exam.getOwners();
ExamOwner cs = new ExamOwner(exam, exam.getId(), exam.getName());
cs.getStudents().addAll(exam.getStudents());
List<ExamOwner> ret = new ArrayList<ExamOwner>(1);
ret.add(cs);
return ret;
}
示例8: report
import org.cpsolver.exam.model.ExamOwner; //导入依赖的package包/类
/**
* generate report
* @param assignment current assignment
* @return resultant report
*/
public CSVFile report(Assignment<Exam, ExamPlacement> assignment) {
CSVFile csv = new CSVFile();
csv.setHeader(new CSVField[] { new CSVField("Section/Course"), new CSVField("Enrl"), new CSVField("Alt"),
new CSVField("Period"), new CSVField("Date"), new CSVField("Time"), new CSVField("Room"),
new CSVField("Cap") });
for (Exam exam : iModel.variables()) {
ExamPlacement placement = assignment.getValue(exam);
for (ExamOwner owner : exam.getOwners()) {
List<CSVField> fields = new ArrayList<CSVField>();
fields.add(new CSVField(owner.getName()));
fields.add(new CSVField(owner.getStudents().size()));
fields.add(new CSVField(exam.hasAltSeating() ? "Yes" : "No"));
if (placement == null) {
fields.add(new CSVField(""));
fields.add(new CSVField(""));
fields.add(new CSVField(""));
fields.add(new CSVField(""));
fields.add(new CSVField(""));
} else {
fields.add(new CSVField(placement.getPeriod().getIndex() + 1));
fields.add(new CSVField(placement.getPeriod().getDayStr()));
fields.add(new CSVField(placement.getPeriod().getTimeStr()));
String rooms = "";
String roomSizes = "";
for (Iterator<ExamRoomPlacement> i = placement.getRoomPlacements().iterator(); i.hasNext();) {
ExamRoomPlacement room = i.next();
rooms += room.getName();
roomSizes += room.getSize(exam.hasAltSeating());
if (i.hasNext()) {
rooms += ", ";
roomSizes += ", ";
}
}
fields.add(new CSVField(rooms));
fields.add(new CSVField(roomSizes));
}
csv.addLine(fields);
}
}
return csv;
}