本文整理了Java中java.util.Calendar.complete()
方法的一些代码示例,展示了Calendar.complete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Calendar.complete()
方法的具体详情如下:
包路径:java.util.Calendar
类名称:Calendar
方法名:complete
[英]Computes the time from the fields if the time has not already been set. Computes the fields from the time if the fields are not already set.
[中]如果尚未设置时间,则从字段计算时间。如果尚未设置字段,则从时间开始计算字段。
代码示例来源:origin: robovm/robovm
/**
* Sets the time of this {@code Calendar} to the given Unix time. See {@link Date} for more
* about what this means.
*/
public void setTimeInMillis(long milliseconds) {
if (!isTimeSet || !areFieldsSet || time != milliseconds) {
time = milliseconds;
isTimeSet = true;
areFieldsSet = false;
complete();
}
}
代码示例来源:origin: robovm/robovm
/**
* Returns the value of the given field after computing the field values by
* calling {@code complete()} first.
*
* @throws IllegalArgumentException
* if the fields are not set, the time is not set, and the
* time cannot be computed from the current field values.
* @throws ArrayIndexOutOfBoundsException
* if the field is not inside the range of possible fields.
* The range is starting at 0 up to {@code FIELD_COUNT}.
*/
public int get(int field) {
complete();
return fields[field];
}
代码示例来源:origin: robovm/robovm
/**
* Returns the minimum value of the given field for the current date.
*/
public int getActualMinimum(int field) {
int value, next;
if (getMinimum(field) == (next = getGreatestMinimum(field))) {
return next;
}
complete();
long orgTime = time;
set(field, next);
do {
value = next;
roll(field, false);
next = get(field);
} while (next < value);
time = orgTime;
areFieldsSet = false;
return value;
}
代码示例来源:origin: robovm/robovm
/**
* Returns the maximum value of the given field for the current date.
* For example, the maximum number of days in the current month.
*/
public int getActualMaximum(int field) {
int value, next;
if (getMaximum(field) == (next = getLeastMaximum(field))) {
return next;
}
complete();
long orgTime = time;
set(field, next);
do {
value = next;
roll(field, true);
next = get(field);
} while (next > value);
time = orgTime;
areFieldsSet = false;
return value;
}
代码示例来源:origin: robovm/robovm
/**
* Returns a map of human-readable strings to corresponding values,
* for the given field, style, and locale.
* Returns null if no strings are available.
*
* <p>For example, {@code getDisplayNames(MONTH, ALL_STYLES, Locale.US)} would
* contain mappings from "Jan" and "January" to {@link #JANUARY}, and so on.
*
* @param field the field
* @param style {@code SHORT}, {@code LONG}, or {@code ALL_STYLES}
* @param locale the locale
* @return the display name, or null
* @throws NullPointerException if {@code locale == null}
* @throws IllegalArgumentException if {@code field} or {@code style} is invalid
* @since 1.6
*/
public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) {
checkStyle(style);
complete();
Map<String, Integer> result = new HashMap<String, Integer>();
if (style == SHORT || style == ALL_STYLES) {
insertValuesInMap(result, getDisplayNameArray(field, SHORT, locale));
}
if (style == LONG || style == ALL_STYLES) {
insertValuesInMap(result, getDisplayNameArray(field, LONG, locale));
}
return result.isEmpty() ? null : result;
}
代码示例来源:origin: robovm/robovm
private void writeObject(ObjectOutputStream stream) throws IOException {
complete();
ObjectOutputStream.PutField putFields = stream.putFields();
putFields.put("areFieldsSet", areFieldsSet);
putFields.put("fields", this.fields);
putFields.put("firstDayOfWeek", firstDayOfWeek);
putFields.put("isSet", isSet);
putFields.put("isTimeSet", isTimeSet);
putFields.put("lenient", lenient);
putFields.put("minimalDaysInFirstWeek", minimalDaysInFirstWeek);
putFields.put("nextStamp", 2 /* MINIMUM_USER_STAMP */);
putFields.put("serialVersionOnStream", 1);
putFields.put("time", time);
putFields.put("zone", zone);
stream.writeFields();
}
代码示例来源:origin: ibinti/bugvm
/**
* Sets the time of this {@code Calendar} to the given Unix time. See {@link Date} for more
* about what this means.
*/
public void setTimeInMillis(long milliseconds) {
if (!isTimeSet || !areFieldsSet || time != milliseconds) {
time = milliseconds;
isTimeSet = true;
areFieldsSet = false;
complete();
}
}
代码示例来源:origin: MobiVM/robovm
/**
* Sets the time of this {@code Calendar} to the given Unix time. See {@link Date} for more
* about what this means.
*/
public void setTimeInMillis(long milliseconds) {
if (!isTimeSet || !areFieldsSet || time != milliseconds) {
time = milliseconds;
isTimeSet = true;
areFieldsSet = false;
complete();
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Sets the time of this {@code Calendar} to the given Unix time. See {@link Date} for more
* about what this means.
*/
public void setTimeInMillis(long milliseconds) {
if (!isTimeSet || !areFieldsSet || time != milliseconds) {
time = milliseconds;
isTimeSet = true;
areFieldsSet = false;
complete();
}
}
代码示例来源:origin: com.jtransc/jtransc-rt
/**
* Sets the time of this {@code Calendar} to the given Unix time. See {@link Date} for more
* about what this means.
*/
public void setTimeInMillis(long milliseconds) {
if (!isTimeSet || !areFieldsSet || time != milliseconds) {
time = milliseconds;
isTimeSet = true;
areFieldsSet = false;
complete();
}
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Sets the time of this {@code Calendar} to the given Unix time. See {@link Date} for more
* about what this means.
*/
public void setTimeInMillis(long milliseconds) {
if (!isTimeSet || !areFieldsSet || time != milliseconds) {
time = milliseconds;
isTimeSet = true;
areFieldsSet = false;
complete();
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Sets the time of this {@code Calendar} to the given Unix time. See {@link Date} for more
* about what this means.
*/
public void setTimeInMillis(long milliseconds) {
if (!isTimeSet || !areFieldsSet || time != milliseconds) {
time = milliseconds;
isTimeSet = true;
areFieldsSet = false;
complete();
}
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Sets the time of this {@code Calendar} to the given Unix time. See {@link Date} for more
* about what this means.
*/
public void setTimeInMillis(long milliseconds) {
if (!isTimeSet || !areFieldsSet || time != milliseconds) {
time = milliseconds;
isTimeSet = true;
areFieldsSet = false;
complete();
}
}
代码示例来源:origin: com.jtransc/jtransc-rt
/**
* Returns the value of the given field after computing the field values by
* calling {@code complete()} first.
*
* @throws IllegalArgumentException if the fields are not set, the time is not set, and the
* time cannot be computed from the current field values.
* @throws ArrayIndexOutOfBoundsException if the field is not inside the range of possible fields.
* The range is starting at 0 up to {@code FIELD_COUNT}.
*/
public int get(int field) {
complete();
return fields[field];
}
代码示例来源:origin: MobiVM/robovm
/**
* Returns the value of the given field after computing the field values by
* calling {@code complete()} first.
*
* @throws IllegalArgumentException
* if the fields are not set, the time is not set, and the
* time cannot be computed from the current field values.
* @throws ArrayIndexOutOfBoundsException
* if the field is not inside the range of possible fields.
* The range is starting at 0 up to {@code FIELD_COUNT}.
*/
public int get(int field) {
complete();
return fields[field];
}
代码示例来源:origin: ibinti/bugvm
/**
* Returns the value of the given field after computing the field values by
* calling {@code complete()} first.
*
* @throws IllegalArgumentException
* if the fields are not set, the time is not set, and the
* time cannot be computed from the current field values.
* @throws ArrayIndexOutOfBoundsException
* if the field is not inside the range of possible fields.
* The range is starting at 0 up to {@code FIELD_COUNT}.
*/
public int get(int field) {
complete();
return fields[field];
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Returns the value of the given field after computing the field values by
* calling {@code complete()} first.
*
* @throws IllegalArgumentException
* if the fields are not set, the time is not set, and the
* time cannot be computed from the current field values.
* @throws ArrayIndexOutOfBoundsException
* if the field is not inside the range of possible fields.
* The range is starting at 0 up to {@code FIELD_COUNT}.
*/
public int get(int field) {
complete();
return fields[field];
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Returns the value of the given field after computing the field values by
* calling {@code complete()} first.
*
* @throws IllegalArgumentException
* if the fields are not set, the time is not set, and the
* time cannot be computed from the current field values.
* @throws ArrayIndexOutOfBoundsException
* if the field is not inside the range of possible fields.
* The range is starting at 0 up to {@code FIELD_COUNT}.
*/
public int get(int field) {
complete();
return fields[field];
}
代码示例来源:origin: stackoverflow.com
java.lang.IllegalArgumentException: DAY_OF_MONTH
at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2316)
at java.util.Calendar.updateTime(Calendar.java:2260)
at java.util.Calendar.complete(Calendar.java:1305)
at java.util.Calendar.get(Calendar.java:1088)
代码示例来源:origin: MobiVM/robovm
private void writeObject(ObjectOutputStream stream) throws IOException {
complete();
ObjectOutputStream.PutField putFields = stream.putFields();
putFields.put("areFieldsSet", areFieldsSet);
putFields.put("fields", this.fields);
putFields.put("firstDayOfWeek", firstDayOfWeek);
putFields.put("isSet", isSet);
putFields.put("isTimeSet", isTimeSet);
putFields.put("lenient", lenient);
putFields.put("minimalDaysInFirstWeek", minimalDaysInFirstWeek);
putFields.put("nextStamp", 2 /* MINIMUM_USER_STAMP */);
putFields.put("serialVersionOnStream", 1);
putFields.put("time", time);
putFields.put("zone", zone);
stream.writeFields();
}
内容来源于网络,如有侵权,请联系作者删除!