当前位置: 首页>>代码示例>>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;未经允许,请勿转载。