當前位置: 首頁>>代碼示例>>Java>>正文


Java ExamInstructor類代碼示例

本文整理匯總了Java中org.cpsolver.exam.model.ExamInstructor的典型用法代碼示例。如果您正苦於以下問題:Java ExamInstructor類的具體用法?Java ExamInstructor怎麽用?Java ExamInstructor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ExamInstructor類屬於org.cpsolver.exam.model包,在下文中一共展示了ExamInstructor類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAssignedExamsOfInstructor

import org.cpsolver.exam.model.ExamInstructor; //導入依賴的package包/類
@Override
public Collection<ExamAssignmentInfo> getAssignedExamsOfInstructor(Long instructorId) {
    Lock lock = currentSolution().getLock().readLock();
    lock.lock();
    try {
        ExamInstructor instructor = null;
        for (ExamInstructor i: ((ExamModel)currentSolution().getModel()).getInstructors()) {
            if (i.getId()==instructorId) {
                instructor = i; break;
            }
        }
        if (instructor==null) return null;
        Vector<ExamAssignmentInfo> ret = new Vector<ExamAssignmentInfo>();
        for (ExamPeriod period: ((ExamModel)currentSolution().getModel()).getPeriods()) {
            Set exams = instructor.getExams(currentSolution().getAssignment(), period);
            if (exams!=null)
                for (Iterator i=exams.iterator();i.hasNext();) {
                    Exam exam = (Exam)i.next();
                    ret.add(new ExamAssignmentInfo(currentSolution().getAssignment().getValue(exam), currentSolution().getAssignment()));                        
                }
        }
        return ret;
    } finally {
    	lock.unlock();
    }
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:27,代碼來源:ExamSolver.java

示例2: computeUnavailablility

import org.cpsolver.exam.model.ExamInstructor; //導入依賴的package包/類
private void computeUnavailablility(Exam exam, Vector<ExamResourceUnavailability> unavailabilities) {
    if (unavailabilities==null || unavailabilities.isEmpty()) return;
    for (ExamResourceUnavailability unavailability : unavailabilities) {
        Vector<Long> commonStudents = new Vector();
        for (ExamStudent student: exam.getStudents()) {
            if (unavailability.getStudentIds().contains(student.getId())) commonStudents.add(student.getId());
        }
        if (!commonStudents.isEmpty())
            iDirects.add(new DirectConflict(unavailability, commonStudents));
        Vector<Long> commonInstructors = new Vector();
        for (ExamInstructor instructor: exam.getInstructors()) {
            if (unavailability.getInstructorIds().contains(instructor.getId())) commonInstructors.add(instructor.getId());
        }
        if (!commonInstructors.isEmpty())
            iInstructorDirects.add(new DirectConflict(unavailability, commonInstructors));
    }
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:18,代碼來源:ExamAssignmentInfo.java

示例3: ExamInfo

import org.cpsolver.exam.model.ExamInstructor; //導入依賴的package包/類
public ExamInfo(org.cpsolver.exam.model.Exam exam) {
	iExamTypeId = ((ExamModel)exam.getModel()).getProperties().getPropertyLong("Exam.Type", null);
    iExamId = exam.getId();
    iExamLabel = exam.getName();
    iLength = exam.getLength();
    iMaxRooms = exam.getMaxRooms();
    iNrStudents = exam.getSize();//Students().size();
    iSeatingType = (exam.hasAltSeating()?Exam.sSeatingTypeExam:Exam.sSeatingTypeNormal);
    if (!exam.getOwners().isEmpty()) {
        iSections = new Vector();
        for (org.cpsolver.exam.model.ExamOwner ecs: exam.getOwners()) {
            HashSet<Long> studentIds = new HashSet<Long>();
            for (Iterator i=ecs.getStudents().iterator();i.hasNext();) 
                studentIds.add(((ExamStudent)i.next()).getId());
            iSections.add(new ExamSectionInfo(ecs.getId(), ecs.getName(), studentIds));
        }
    }
    iInstructors = new Vector();
    for (Constraint c: exam.constraints()) {
        if (c instanceof ExamInstructor) {
            ExamInstructor instructor = (ExamInstructor)c;
            iInstructors.add(new ExamInstructorInfo(instructor.getId(), null, instructor.getName()));
        }
    }
    iPrintOffset = (exam.getPrintOffset()==null?0:exam.getPrintOffset());
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:27,代碼來源:ExamInfo.java

示例4: getValue

import org.cpsolver.exam.model.ExamInstructor; //導入依賴的package包/類
@Override
public double getValue(Assignment<Exam, ExamPlacement> assignment, ExamPlacement value, Set<ExamPlacement> conflicts) {
    Exam exam = value.variable();
    int penalty = 0;
    Map<ExamInstructor, Set<Exam>> instructors = ((ExamModel)getModel()).getInstructorsOfDay(assignment, value.getPeriod());
    for (ExamInstructor s : exam.getInstructors()) {
        Set<Exam> exams = instructors.get(s);
        if (exams == null || exams.size() < 2) continue;
        int nrExams = exams.size() + (exams.contains(exam) ? 0 : 1);
        if (nrExams > 2)
            penalty++;
    }
    /*
    for (ExamInstructor s : exam.getInstructors()) {
        Set<Exam> exams = s.getExamsADay(assignment, value.getPeriod());
        int nrExams = exams.size() + (exams.contains(exam) ? 0 : 1);
        if (nrExams > 2)
            penalty++;
    }
    */
    return penalty;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:23,代碼來源:InstructorMoreThan2ADayConflicts.java

示例5: getValue

import org.cpsolver.exam.model.ExamInstructor; //導入依賴的package包/類
@Override
public double getValue(Assignment<Exam, ExamPlacement> assignment, ExamPlacement value, Set<ExamPlacement> conflicts) {
    Exam exam = value.variable();
    int penalty = 0;
    Map<ExamInstructor, Set<Exam>> instructors = ((ExamModel)getModel()).getInstructorsOfPeriod(assignment, value.getPeriod());
    for (ExamInstructor s : exam.getInstructors()) {
        Set<Exam> exams = instructors.get(s);
        if (exams == null) continue;
        int nrExams = exams.size() + (exams.contains(exam) ? 0 : 1);
        if (nrExams > 1)
            penalty++;
    }
    /*
    for (ExamInstructor s : exam.getInstructors()) {
        Set<Exam> exams = s.getExams(assignment, value.getPeriod());
        int nrExams = exams.size() + (exams.contains(exam) ? 0 : 1);
        if (nrExams > 1)
            penalty++;
    }
    */
    return penalty;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:23,代碼來源:InstructorDirectConflicts.java

示例6: getInstructor

import org.cpsolver.exam.model.ExamInstructor; //導入依賴的package包/類
protected ExamInstructor getInstructor(DepartmentalInstructor instructor) {
    if (instructor.getExternalUniqueId()!=null && instructor.getExternalUniqueId().trim().length()>0) {
        ExamInstructor i = (ExamInstructor)iInstructors.get(instructor.getExternalUniqueId());
        if (i!=null) return i;
    }
    return (ExamInstructor)iInstructors.get(instructor.getUniqueId());
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:8,代碼來源:ExamDatabaseLoader.java

示例7: getValue

import org.cpsolver.exam.model.ExamInstructor; //導入依賴的package包/類
@Override
public double getValue(Assignment<Exam, ExamPlacement> assignment, ExamPlacement value, Set<ExamPlacement> conflicts) {
    Exam exam = value.variable();
    // if (!exam.isAllowDirectConflicts()) return 0;
    int penalty = 0;
    for (ExamInstructor s : exam.getInstructors()) {
        if (!s.isAvailable(value.getPeriod()))
            penalty++;
    }
    return penalty;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:12,代碼來源:InstructorNotAvailableConflicts.java


注:本文中的org.cpsolver.exam.model.ExamInstructor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。