java.util.Calendar.computeFields()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中java.util.Calendar.computeFields()方法的一些代码示例,展示了Calendar.computeFields()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Calendar.computeFields()方法的具体详情如下:
包路径:java.util.Calendar
类名称:Calendar
方法名:computeFields

Calendar.computeFields介绍

[英]Computes the Calendar fields from time.
[中]从时间开始计算日历字段。

代码示例

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Computes the time from the fields if the time has not already been set.
  3. * Computes the fields from the time if the fields are not already set.
  4. *
  5. * @throws IllegalArgumentException
  6. * if the time is not set and the time cannot be computed
  7. * from the current field values.
  8. */
  9. protected void complete() {
  10. if (!isTimeSet) {
  11. computeTime();
  12. isTimeSet = true;
  13. }
  14. if (!areFieldsSet) {
  15. computeFields();
  16. areFieldsSet = true;
  17. }
  18. }

代码示例来源:origin: org.apidesign.bck2brwsr/emul

  1. /**
  2. * Sets this Calendar's current time from the given long value.
  3. *
  4. * @param millis the new time in UTC milliseconds from the epoch.
  5. * @see #setTime(Date)
  6. * @see #getTimeInMillis()
  7. */
  8. public void setTimeInMillis(long millis) {
  9. // If we don't need to recalculate the calendar field values,
  10. // do nothing.
  11. // if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet
  12. // && (zone instanceof ZoneInfo) && !((ZoneInfo)zone).isDirty()) {
  13. // return;
  14. // }
  15. time = millis;
  16. isTimeSet = true;
  17. areFieldsSet = false;
  18. computeFields();
  19. areAllFieldsSet = areFieldsSet = true;
  20. }

代码示例来源:origin: jtulach/bck2brwsr

  1. /**
  2. * Sets this Calendar's current time from the given long value.
  3. *
  4. * @param millis the new time in UTC milliseconds from the epoch.
  5. * @see #setTime(Date)
  6. * @see #getTimeInMillis()
  7. */
  8. public void setTimeInMillis(long millis) {
  9. // If we don't need to recalculate the calendar field values,
  10. // do nothing.
  11. // if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet
  12. // && (zone instanceof ZoneInfo) && !((ZoneInfo)zone).isDirty()) {
  13. // return;
  14. // }
  15. time = millis;
  16. isTimeSet = true;
  17. areFieldsSet = false;
  18. computeFields();
  19. areAllFieldsSet = areFieldsSet = true;
  20. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. /**
  2. * Computes the time from the fields if the time has not already been set.
  3. * Computes the fields from the time if the fields are not already set.
  4. *
  5. * @throws IllegalArgumentException if the time is not set and the time cannot be computed
  6. * from the current field values.
  7. */
  8. protected void complete() {
  9. if (!isTimeSet) {
  10. computeTime();
  11. isTimeSet = true;
  12. }
  13. if (!areFieldsSet) {
  14. computeFields();
  15. areFieldsSet = true;
  16. }
  17. }

代码示例来源:origin: org.apidesign.bck2brwsr/emul

  1. /**
  2. * Fills in any unset fields in the calendar fields. First, the {@link
  3. * #computeTime()} method is called if the time value (millisecond offset
  4. * from the <a href="#Epoch">Epoch</a>) has not been calculated from
  5. * calendar field values. Then, the {@link #computeFields()} method is
  6. * called to calculate all calendar field values.
  7. */
  8. protected void complete()
  9. {
  10. if (!isTimeSet)
  11. updateTime();
  12. if (!areFieldsSet || !areAllFieldsSet) {
  13. computeFields(); // fills in unset fields
  14. areAllFieldsSet = areFieldsSet = true;
  15. }
  16. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. /**
  2. * Computes the time from the fields if the time has not already been set.
  3. * Computes the fields from the time if the fields are not already set.
  4. *
  5. * @throws IllegalArgumentException
  6. * if the time is not set and the time cannot be computed
  7. * from the current field values.
  8. */
  9. protected void complete() {
  10. if (!isTimeSet) {
  11. computeTime();
  12. isTimeSet = true;
  13. }
  14. if (!areFieldsSet) {
  15. computeFields();
  16. areFieldsSet = true;
  17. }
  18. }

代码示例来源:origin: MobiVM/robovm

  1. /**
  2. * Computes the time from the fields if the time has not already been set.
  3. * Computes the fields from the time if the fields are not already set.
  4. *
  5. * @throws IllegalArgumentException
  6. * if the time is not set and the time cannot be computed
  7. * from the current field values.
  8. */
  9. protected void complete() {
  10. if (!isTimeSet) {
  11. computeTime();
  12. isTimeSet = true;
  13. }
  14. if (!areFieldsSet) {
  15. computeFields();
  16. areFieldsSet = true;
  17. }
  18. }

代码示例来源:origin: jtulach/bck2brwsr

  1. /**
  2. * Fills in any unset fields in the calendar fields. First, the {@link
  3. * #computeTime()} method is called if the time value (millisecond offset
  4. * from the <a href="#Epoch">Epoch</a>) has not been calculated from
  5. * calendar field values. Then, the {@link #computeFields()} method is
  6. * called to calculate all calendar field values.
  7. */
  8. protected void complete()
  9. {
  10. if (!isTimeSet)
  11. updateTime();
  12. if (!areFieldsSet || !areAllFieldsSet) {
  13. computeFields(); // fills in unset fields
  14. areAllFieldsSet = areFieldsSet = true;
  15. }
  16. }

代码示例来源:origin: ibinti/bugvm

  1. /**
  2. * Computes the time from the fields if the time has not already been set.
  3. * Computes the fields from the time if the fields are not already set.
  4. *
  5. * @throws IllegalArgumentException
  6. * if the time is not set and the time cannot be computed
  7. * from the current field values.
  8. */
  9. protected void complete() {
  10. if (!isTimeSet) {
  11. computeTime();
  12. isTimeSet = true;
  13. }
  14. if (!areFieldsSet) {
  15. computeFields();
  16. areFieldsSet = true;
  17. }
  18. }

代码示例来源:origin: FlexoVM/flexovm

  1. /**
  2. * Computes the time from the fields if the time has not already been set.
  3. * Computes the fields from the time if the fields are not already set.
  4. *
  5. * @throws IllegalArgumentException
  6. * if the time is not set and the time cannot be computed
  7. * from the current field values.
  8. */
  9. protected void complete() {
  10. if (!isTimeSet) {
  11. computeTime();
  12. isTimeSet = true;
  13. }
  14. if (!areFieldsSet) {
  15. computeFields();
  16. areFieldsSet = true;
  17. }
  18. }

代码示例来源:origin: com.bugvm/bugvm-rt

  1. /**
  2. * Computes the time from the fields if the time has not already been set.
  3. * Computes the fields from the time if the fields are not already set.
  4. *
  5. * @throws IllegalArgumentException
  6. * if the time is not set and the time cannot be computed
  7. * from the current field values.
  8. */
  9. protected void complete() {
  10. if (!isTimeSet) {
  11. computeTime();
  12. isTimeSet = true;
  13. }
  14. if (!areFieldsSet) {
  15. computeFields();
  16. areFieldsSet = true;
  17. }
  18. }

代码示例来源:origin: com.gluonhq/robovm-rt

  1. /**
  2. * Computes the time from the fields if the time has not already been set.
  3. * Computes the fields from the time if the fields are not already set.
  4. *
  5. * @throws IllegalArgumentException
  6. * if the time is not set and the time cannot be computed
  7. * from the current field values.
  8. */
  9. protected void complete() {
  10. if (!isTimeSet) {
  11. computeTime();
  12. isTimeSet = true;
  13. }
  14. if (!areFieldsSet) {
  15. computeFields();
  16. areFieldsSet = true;
  17. }
  18. }

代码示例来源:origin: jtulach/bck2brwsr

  1. /**
  2. * Sets the given calendar field to the given value. The value is not
  3. * interpreted by this method regardless of the leniency mode.
  4. *
  5. * @param field the given calendar field.
  6. * @param value the value to be set for the given calendar field.
  7. * @throws ArrayIndexOutOfBoundsException if the specified field is out of range
  8. * (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
  9. * in non-lenient mode.
  10. * @see #set(int,int,int)
  11. * @see #set(int,int,int,int,int)
  12. * @see #set(int,int,int,int,int,int)
  13. * @see #get(int)
  14. */
  15. public void set(int field, int value)
  16. {
  17. // If the fields are partially normalized, calculate all the
  18. // fields before changing any fields.
  19. if (areFieldsSet && !areAllFieldsSet) {
  20. computeFields();
  21. }
  22. internalSet(field, value);
  23. isTimeSet = false;
  24. areFieldsSet = false;
  25. isSet[field] = true;
  26. stamp[field] = nextStamp++;
  27. if (nextStamp == Integer.MAX_VALUE) {
  28. adjustStamp();
  29. }
  30. }

代码示例来源:origin: org.apidesign.bck2brwsr/emul

  1. /**
  2. * Sets the given calendar field to the given value. The value is not
  3. * interpreted by this method regardless of the leniency mode.
  4. *
  5. * @param field the given calendar field.
  6. * @param value the value to be set for the given calendar field.
  7. * @throws ArrayIndexOutOfBoundsException if the specified field is out of range
  8. * (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
  9. * in non-lenient mode.
  10. * @see #set(int,int,int)
  11. * @see #set(int,int,int,int,int)
  12. * @see #set(int,int,int,int,int,int)
  13. * @see #get(int)
  14. */
  15. public void set(int field, int value)
  16. {
  17. // If the fields are partially normalized, calculate all the
  18. // fields before changing any fields.
  19. if (areFieldsSet && !areAllFieldsSet) {
  20. computeFields();
  21. }
  22. internalSet(field, value);
  23. isTimeSet = false;
  24. areFieldsSet = false;
  25. isSet[field] = true;
  26. stamp[field] = nextStamp++;
  27. if (nextStamp == Integer.MAX_VALUE) {
  28. adjustStamp();
  29. }
  30. }

相关文章