本文整理匯總了Java中java.util.GregorianCalendar.getMinimum方法的典型用法代碼示例。如果您正苦於以下問題:Java GregorianCalendar.getMinimum方法的具體用法?Java GregorianCalendar.getMinimum怎麽用?Java GregorianCalendar.getMinimum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.GregorianCalendar
的用法示例。
在下文中一共展示了GregorianCalendar.getMinimum方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dowTest
import java.util.GregorianCalendar; //導入方法依賴的package包/類
void dowTest(boolean lenient) {
GregorianCalendar cal = new GregorianCalendar();
cal.set(1997, AUGUST, 12); // Wednesday
cal.getTime(); // Force update
cal.setLenient(lenient);
cal.set(1996, DECEMBER, 1); // Set the date to be December 1, 1996
int dow = cal.get(DAY_OF_WEEK);
int min = cal.getMinimum(DAY_OF_WEEK);
int max = cal.getMaximum(DAY_OF_WEEK);
if (dow < min || dow > max) {
errln("FAIL: Day of week " + dow + " out of range");
}
if (dow != SUNDAY) {
errln("FAIL2: Day of week should be SUNDAY; is " + dow + ": " + cal.getTime());
}
if (min != SUNDAY || max != SATURDAY) {
errln("FAIL: Min/max bad");
}
}
示例2: dowTest
import java.util.GregorianCalendar; //導入方法依賴的package包/類
void dowTest(boolean lenient) {
GregorianCalendar cal = new GregorianCalendar();
cal.set(1997, AUGUST, 12); // Wednesday
// cal.getTime(); // Force update
cal.setLenient(lenient);
cal.set(1996, DECEMBER, 1); // Set the date to be December 1, 1996
int dow = cal.get(DAY_OF_WEEK);
int min = cal.getMinimum(DAY_OF_WEEK);
int max = cal.getMaximum(DAY_OF_WEEK);
logln(cal.getTime().toString());
if (min != SUNDAY || max != SATURDAY) {
errln("FAIL: Min/max bad");
}
if (dow < min || dow > max) {
errln("FAIL: Day of week " + dow + " out of range");
}
if (dow != SUNDAY) {
errln("FAIL: Day of week should be SUNDAY Got " + dow);
}
}
示例3: Test5006864
import java.util.GregorianCalendar; //導入方法依賴的package包/類
/**
* 5006864: Define the minimum value of DAY_OF_WEEK_IN_MONTH as 1
*/
public void Test5006864() {
GregorianCalendar cal = new GregorianCalendar();
int min = cal.getMinimum(DAY_OF_WEEK_IN_MONTH);
if (min != 1) {
errln("GregorianCalendar.getMinimum(DAY_OF_WEEK_IN_MONTH) returned "
+ min + ", expected 1.");
}
min = cal.getGreatestMinimum(DAY_OF_WEEK_IN_MONTH);
if (min != 1) {
errln("GregorianCalendar.getGreatestMinimum(DAY_OF_WEEK_IN_MONTH) returned "
+ min + ", expected 1.");
}
}