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

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

本文整理了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

/**
 * 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.
 *
 * @throws IllegalArgumentException
 *                if the time is not set and the time cannot be computed
 *                from the current field values.
 */
protected void complete() {
  if (!isTimeSet) {
    computeTime();
    isTimeSet = true;
  }
  if (!areFieldsSet) {
    computeFields();
    areFieldsSet = true;
  }
}

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

/**
   * Sets this Calendar's current time from the given long value.
   *
   * @param millis the new time in UTC milliseconds from the epoch.
   * @see #setTime(Date)
   * @see #getTimeInMillis()
   */
  public void setTimeInMillis(long millis) {
    // If we don't need to recalculate the calendar field values,
    // do nothing.
//        if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet
//            && (zone instanceof ZoneInfo) && !((ZoneInfo)zone).isDirty()) {
//            return;
//        }
    time = millis;
    isTimeSet = true;
    areFieldsSet = false;
    computeFields();
    areAllFieldsSet = areFieldsSet = true;
  }

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

/**
   * Sets this Calendar's current time from the given long value.
   *
   * @param millis the new time in UTC milliseconds from the epoch.
   * @see #setTime(Date)
   * @see #getTimeInMillis()
   */
  public void setTimeInMillis(long millis) {
    // If we don't need to recalculate the calendar field values,
    // do nothing.
//        if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet
//            && (zone instanceof ZoneInfo) && !((ZoneInfo)zone).isDirty()) {
//            return;
//        }
    time = millis;
    isTimeSet = true;
    areFieldsSet = false;
    computeFields();
    areAllFieldsSet = areFieldsSet = true;
  }

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

/**
 * 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.
 *
 * @throws IllegalArgumentException if the time is not set and the time cannot be computed
 *                                  from the current field values.
 */
protected void complete() {
  if (!isTimeSet) {
    computeTime();
    isTimeSet = true;
  }
  if (!areFieldsSet) {
    computeFields();
    areFieldsSet = true;
  }
}

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

/**
 * Fills in any unset fields in the calendar fields. First, the {@link
 * #computeTime()} method is called if the time value (millisecond offset
 * from the <a href="#Epoch">Epoch</a>) has not been calculated from
 * calendar field values. Then, the {@link #computeFields()} method is
 * called to calculate all calendar field values.
 */
protected void complete()
{
  if (!isTimeSet)
    updateTime();
  if (!areFieldsSet || !areAllFieldsSet) {
    computeFields(); // fills in unset fields
    areAllFieldsSet = areFieldsSet = true;
  }
}

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

/**
 * 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.
 *
 * @throws IllegalArgumentException
 *                if the time is not set and the time cannot be computed
 *                from the current field values.
 */
protected void complete() {
  if (!isTimeSet) {
    computeTime();
    isTimeSet = true;
  }
  if (!areFieldsSet) {
    computeFields();
    areFieldsSet = true;
  }
}

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

/**
 * 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.
 *
 * @throws IllegalArgumentException
 *                if the time is not set and the time cannot be computed
 *                from the current field values.
 */
protected void complete() {
  if (!isTimeSet) {
    computeTime();
    isTimeSet = true;
  }
  if (!areFieldsSet) {
    computeFields();
    areFieldsSet = true;
  }
}

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

/**
 * Fills in any unset fields in the calendar fields. First, the {@link
 * #computeTime()} method is called if the time value (millisecond offset
 * from the <a href="#Epoch">Epoch</a>) has not been calculated from
 * calendar field values. Then, the {@link #computeFields()} method is
 * called to calculate all calendar field values.
 */
protected void complete()
{
  if (!isTimeSet)
    updateTime();
  if (!areFieldsSet || !areAllFieldsSet) {
    computeFields(); // fills in unset fields
    areAllFieldsSet = areFieldsSet = true;
  }
}

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

/**
 * 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.
 *
 * @throws IllegalArgumentException
 *                if the time is not set and the time cannot be computed
 *                from the current field values.
 */
protected void complete() {
  if (!isTimeSet) {
    computeTime();
    isTimeSet = true;
  }
  if (!areFieldsSet) {
    computeFields();
    areFieldsSet = true;
  }
}

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

/**
 * 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.
 *
 * @throws IllegalArgumentException
 *                if the time is not set and the time cannot be computed
 *                from the current field values.
 */
protected void complete() {
  if (!isTimeSet) {
    computeTime();
    isTimeSet = true;
  }
  if (!areFieldsSet) {
    computeFields();
    areFieldsSet = true;
  }
}

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

/**
 * 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.
 *
 * @throws IllegalArgumentException
 *                if the time is not set and the time cannot be computed
 *                from the current field values.
 */
protected void complete() {
  if (!isTimeSet) {
    computeTime();
    isTimeSet = true;
  }
  if (!areFieldsSet) {
    computeFields();
    areFieldsSet = true;
  }
}

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

/**
 * 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.
 *
 * @throws IllegalArgumentException
 *                if the time is not set and the time cannot be computed
 *                from the current field values.
 */
protected void complete() {
  if (!isTimeSet) {
    computeTime();
    isTimeSet = true;
  }
  if (!areFieldsSet) {
    computeFields();
    areFieldsSet = true;
  }
}

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

/**
 * Sets the given calendar field to the given value. The value is not
 * interpreted by this method regardless of the leniency mode.
 *
 * @param field the given calendar field.
 * @param value the value to be set for the given calendar field.
 * @throws ArrayIndexOutOfBoundsException if the specified field is out of range
 *             (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
 * in non-lenient mode.
 * @see #set(int,int,int)
 * @see #set(int,int,int,int,int)
 * @see #set(int,int,int,int,int,int)
 * @see #get(int)
 */
public void set(int field, int value)
{
  // If the fields are partially normalized, calculate all the
  // fields before changing any fields.
  if (areFieldsSet && !areAllFieldsSet) {
    computeFields();
  }
  internalSet(field, value);
  isTimeSet = false;
  areFieldsSet = false;
  isSet[field] = true;
  stamp[field] = nextStamp++;
  if (nextStamp == Integer.MAX_VALUE) {
    adjustStamp();
  }
}

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

/**
 * Sets the given calendar field to the given value. The value is not
 * interpreted by this method regardless of the leniency mode.
 *
 * @param field the given calendar field.
 * @param value the value to be set for the given calendar field.
 * @throws ArrayIndexOutOfBoundsException if the specified field is out of range
 *             (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
 * in non-lenient mode.
 * @see #set(int,int,int)
 * @see #set(int,int,int,int,int)
 * @see #set(int,int,int,int,int,int)
 * @see #get(int)
 */
public void set(int field, int value)
{
  // If the fields are partially normalized, calculate all the
  // fields before changing any fields.
  if (areFieldsSet && !areAllFieldsSet) {
    computeFields();
  }
  internalSet(field, value);
  isTimeSet = false;
  areFieldsSet = false;
  isSet[field] = true;
  stamp[field] = nextStamp++;
  if (nextStamp == Integer.MAX_VALUE) {
    adjustStamp();
  }
}

相关文章