本文整理汇总了Java中org.cpsolver.coursett.Constants.FIRST_SLOT_TIME_MIN属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.FIRST_SLOT_TIME_MIN属性的具体用法?Java Constants.FIRST_SLOT_TIME_MIN怎么用?Java Constants.FIRST_SLOT_TIME_MIN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.cpsolver.coursett.Constants
的用法示例。
在下文中一共展示了Constants.FIRST_SLOT_TIME_MIN属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTimeString
public static String getTimeString(int slot, int breakTime) {
int min = slot * Constants.SLOT_LENGTH_MIN + Constants.FIRST_SLOT_TIME_MIN - breakTime;
int h = min / 60;
int m = min % 60;
if (CFG.useAmPm())
return (h > 12 ? h - 12 : h) + ":" + (m < 10 ? "0" : "") + m + (h >= 12 ? "p" : "a");
else
return h + ":" + (m < 10 ? "0" : "") + m;
}
示例2: time
public static int time(int slot) {
int s = slot % Constants.SLOTS_PER_DAY;
int min = (s * Constants.SLOT_LENGTH_MIN + Constants.FIRST_SLOT_TIME_MIN);
if (min < 450) return 0; // morning
int idx = 1 + (min - 450) / 60;
return (idx > 11 ? 11 : idx); // 11+ is evening
}
示例3: getStartTimeHeader
/** Start time for printing purposes
* @param useAmPm use 12-hour format
* @return time header (e.g., 7:30a)
**/
public String getStartTimeHeader(boolean useAmPm) {
int min = iStartSlot * Constants.SLOT_LENGTH_MIN + Constants.FIRST_SLOT_TIME_MIN;
int h = min / 60;
int m = min % 60;
if (useAmPm)
return (h > 12 ? h - 12 : h) + ":" + (m < 10 ? "0" : "") + m + (h >= 12 ? "p" : "a");
else
return h + ":" + (m < 10 ? "0" : "") + m;
}
示例4: getEndTimeHeader
/** End time for printing purposes
* @param useAmPm use 12-hour format
* @return end time (e.g., 8:20a)
**/
public String getEndTimeHeader(boolean useAmPm) {
int min = (iStartSlot + iLength) * Constants.SLOT_LENGTH_MIN + Constants.FIRST_SLOT_TIME_MIN - getBreakTime();
int m = min % 60;
int h = min / 60;
if (useAmPm)
return (h > 12 ? h - 12 : h) + ":" + (m < 10 ? "0" : "") + m + (h >= 12 ? "p" : "a");
else
return h + ":" + (m < 10 ? "0" : "") + m;
}
示例5: getEndTimeHeaderNoAdj
/** End time for printing purposes
* @param useAmPm use 12-hour format
* @return end time not counting break time (e.g., 8:30a)
**/
public String getEndTimeHeaderNoAdj(boolean useAmPm) {
int min = (iStartSlot + iLength) * Constants.SLOT_LENGTH_MIN + Constants.FIRST_SLOT_TIME_MIN;
int m = min % 60;
int h = min / 60;
if (useAmPm)
return (h > 12 ? h - 12 : h) + ":" + (m < 10 ? "0" : "") + m + (h >= 12 ? "p" : "a");
else
return h + ":" + (m < 10 ? "0" : "") + m;
}
示例6: time
/**
* Return time index in
* {@link StudentPreferencePenalties#sStudentRequestDistribution} for the
* given slot.
* @param slot time slot
* @return time index
*/
public static int time(int slot) {
int s = slot % Constants.SLOTS_PER_DAY;
int min = (s * Constants.SLOT_LENGTH_MIN + Constants.FIRST_SLOT_TIME_MIN);
if (min < 450)
return 0; // morning
int idx = 1 + (min - 450) / 60;
return (idx > 11 ? 11 : idx); // 11+ is evening
}
示例7: slot2time
protected String slot2time(int slot) {
int minutesSinceMidnight = Constants.SLOT_LENGTH_MIN * slot + Constants.FIRST_SLOT_TIME_MIN;
return sTwoNumbersDF.format(minutesSinceMidnight / 60) + sTwoNumbersDF.format(minutesSinceMidnight % 60);
}