本文整理匯總了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);
}