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


Java Constants.preference2preferenceLevel方法代碼示例

本文整理匯總了Java中org.cpsolver.coursett.Constants.preference2preferenceLevel方法的典型用法代碼示例。如果您正苦於以下問題:Java Constants.preference2preferenceLevel方法的具體用法?Java Constants.preference2preferenceLevel怎麽用?Java Constants.preference2preferenceLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.cpsolver.coursett.Constants的用法示例。


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

示例1: loadInstructors

import org.cpsolver.coursett.Constants; //導入方法依賴的package包/類
protected void loadInstructors(org.hibernate.Session hibSession) throws Exception {
	List<DepartmentalInstructor> list = (List<DepartmentalInstructor>)hibSession.createQuery(
			"select distinct i from DepartmentalInstructor i, SolverGroup g inner join g.departments d where " +
			"g.uniqueId in :solverGroupId and i.department = d and i.teachingPreference.prefProlog != :prohibited and i.maxLoad > 0.0"
			).setParameterList("solverGroupId", iSolverGroupId).setString("prohibited", PreferenceLevel.sProhibited).list();
	iProgress.setPhase("Loading instructors...", list.size());
	for (DepartmentalInstructor i: list) {
		Instructor instructor = new Instructor(i.getUniqueId(), i.getExternalUniqueId(), i.getName(iInstructorFormat),
				Constants.preference2preferenceLevel(i.getTeachingPreference().getPrefProlog()), i.getMaxLoad());
		for (InstructorAttribute a: i.getAttributes())
			instructor.addAttribute(getAttribute(a));
		if (!iDepartmentAttribute.isEmpty())
			instructor.addAttribute(iDepartmentAttribute.get(i.getDepartment().getUniqueId()));
		for (org.unitime.timetable.model.Preference p: i.getPreferences()) {
			if (p instanceof InstructorCoursePref) {
				InstructorCoursePref cp = (InstructorCoursePref)p;
				instructor.addCoursePreference(new Preference<Course>(new Course(cp.getCourse().getUniqueId(), cp.getCourse().getCourseName()), Constants.preference2preferenceLevel(cp.getPrefLevel().getPrefProlog())));
			} else if (p instanceof DistributionPref) {
				loadDistributionPreferences(instructor, (DistributionPref)p);
			} else if (p instanceof TimePref) {
				loadTimePreferences(instructor, (TimePref)p);
			}
		}
		for (EnrolledClass ec: loadUnavailability(hibSession, i))
			instructor.addTimePreference(new Preference<TimeLocation>(ec, Constants.sPreferenceLevelProhibited));
		getModel().addInstructor(instructor);
		iInstructors.put(i.getUniqueId(), instructor);
		iProgress.incProgress();
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:31,代碼來源:InstructorSchedulingDatabaseLoader.java

示例2: ViolatedDistrPreference

import org.cpsolver.coursett.Constants; //導入方法依賴的package包/類
public ViolatedDistrPreference(Solver solver, FlexibleConstraint fc) {
	Assignment<Lecture, Placement> assignment = solver.currentSolution().getAssignment();
	iPreference = Constants.preference2preferenceLevel(fc.getPrologPreference());
	iType = fc.getReference();
	iName = fc.getName();
	iViolations = (int)Math.round(fc.getNrViolations(assignment, null, null));
	for (Lecture lecture: fc.variables()) {
		if (assignment.getValue(lecture)==null) continue;
		iClasses.add(new ClassAssignmentDetails(solver,lecture,false));
	}
	Collections.sort(iClasses);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:13,代碼來源:ViolatedDistrPreferencesReport.java

示例3: FlexibleConstraint

import org.cpsolver.coursett.Constants; //導入方法依賴的package包/類
/**
 * Constructor
 * @param id unique id
 * @param owner identifier of distribution preference the constraint was created for
 * @param preference time preference ("R" for required, "P" for prohibited, "-2",
 *            "-1", "1", "2" for soft preference)   
 * @param reference parameters of the constraint in String form            
 */
public FlexibleConstraint(Long id, String owner, String preference, String reference){
    super();                
    iId = id;
    iReference = reference;
    iPreference = Constants.preference2preferenceLevel(preference);
    iIsRequired = preference.equals(Constants.sPreferenceRequired);        
    iOwner = owner;                
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:17,代碼來源:FlexibleConstraint.java

示例4: SameLinkConstraint

import org.cpsolver.coursett.Constants; //導入方法依賴的package包/類
/**
 * Constructor
 * @param id constraint id
 * @param name link name
 * @param preference constraint preference (R for required, etc.)
 */
public SameLinkConstraint(Long id, String name, String preference) {
    iId = id;
    iName = name;
    iPreference = Constants.preference2preferenceLevel(preference);
    if (Constants.sPreferenceRequired.equals(preference)) {
        iRequired = true;
    } else if (Constants.sPreferenceProhibited.equals(preference)) {
        iProhibited = true;
    }
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:17,代碼來源:SameLinkConstraint.java

示例5: SameInstructorConstraint

import org.cpsolver.coursett.Constants; //導入方法依賴的package包/類
/**
 * Constructor
 * @param id constraint id
 * @param name constrain (link) name
 * @param preference preference (R for required, P for prohibited, etc.)
 */
public SameInstructorConstraint(Long id, String name, String preference) {
    iId = id;
    iName = name;
    iPreference = Constants.preference2preferenceLevel(preference);
    if (Constants.sPreferenceRequired.equals(preference)) {
        iRequired = true;
    } else if (Constants.sPreferenceProhibited.equals(preference)) {
        iProhibited = true;
    }
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:17,代碼來源:SameInstructorConstraint.java

示例6: GroupConstraint

import org.cpsolver.coursett.Constants; //導入方法依賴的package包/類
/**
 * Constructor
 * 
 * @param id
 *            constraint id
 * @param type
 *            constraString type (e.g, {@link ConstraintType#SAME_TIME})
 * @param preference
 *            time preference ("R" for required, "P" for prohibited, "-2",
 *            "-1", "1", "2" for soft preference)
 */
public GroupConstraint(Long id, ConstraintType type, String preference) {
    iConstraintId = id;
    iType = type;
    iIsRequired = preference.equals(Constants.sPreferenceRequired);
    iIsProhibited = preference.equals(Constants.sPreferenceProhibited);
    iPreference = Constants.preference2preferenceLevel(preference);
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:19,代碼來源:GroupConstraint.java


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