Example #1
0
 /**
  * Gets the range of valid values for the specified field.
  * <p>
  * The range object expresses the minimum and maximum valid values for a field.
  * This instant is used to enhance the accuracy of the returned range.
  * If it is not possible to return the range, because the field is not supported
  * or for some other reason, an exception is thrown.
  * <p>
  * If the field is a {@link ChronoField} then the query is implemented here.
  * The {@link #isSupported(TemporalField) supported fields} will return
  * appropriate range instances.
  * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
  * <p>
  * If the field is not a {@code ChronoField}, then the result of this method
  * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)}
  * passing {@code this} as the argument.
  * Whether the range can be obtained is determined by the field.
  *
  * @param TemporalField $field the field to query the range for, not null
  * @return ValueRange the range of valid values for the field, not null
  * @throws DateTimeException if the range for the field cannot be obtained
  * @throws UnsupportedTemporalTypeException if the field is not supported
  */
 public function range(TemporalField $field)
 {
     return parent::range($field);
 }
Example #2
0
 /**
  * Gets the range of valid values for the specified field.
  * <p>
  * The range object expresses the minimum and maximum valid values for a field.
  * This year is used to enhance the accuracy of the returned range.
  * If it is not possible to return the range, because the field is not supported
  * or for some other reason, an exception is thrown.
  * <p>
  * If the field is a {@link ChronoField} then the query is implemented here.
  * The {@link #isSupported(TemporalField) supported fields} will return
  * appropriate range instances.
  * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
  * <p>
  * If the field is not a {@code ChronoField}, then the result of this method
  * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)}
  * passing {@code this} as the argument.
  * Whether the range can be obtained is determined by the field.
  *
  * @param TemporalField $field the field to query the range for, not null
  * @return ValueRange the range of valid values for the field, not null
  * @throws DateTimeException if the range for the field cannot be obtained
  * @throws UnsupportedTemporalTypeException if the field is not supported
  */
 public function range(TemporalField $field)
 {
     if ($field == ChronoField::YEAR_OF_ERA()) {
         return $this->year <= 0 ? ValueRange::of(1, self::MAX_VALUE + 1) : ValueRange::of(1, self::MAX_VALUE);
     }
     return parent::range($field);
 }
Example #3
0
 /**
  * Gets the range of valid values for the specified field.
  * <p>
  * The range object expresses the minimum and maximum valid values for a field.
  * This day-of-week is used to enhance the accuracy of the returned range.
  * If it is not possible to return the range, because the field is not supported
  * or for some other reason, an exception is thrown.
  * <p>
  * If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the
  * range of the day-of-week, from 1 to 7, will be returned.
  * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
  * <p>
  * If the field is not a {@code ChronoField}, then the result of this method
  * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)}
  * passing {@code this} as the argument.
  * Whether the range can be obtained is determined by the field.
  *
  * @param TemporalField $field the field to query the range for, not null
  * @return ValueRange the range of valid values for the field, not null
  * @throws DateTimeException if the range for the field cannot be obtained
  * @throws UnsupportedTemporalTypeException if the field is not supported
  */
 public function range(TemporalField $field)
 {
     if ($field == ChronoField::DAY_OF_WEEK()) {
         return $field->range();
     }
     return parent::range($field);
 }
Example #4
0
 /**
  * Gets the range of valid values for the specified field.
  * <p>
  * The range object expresses the minimum and maximum valid values for a field.
  * This month-day is used to enhance the accuracy of the returned range.
  * If it is not possible to return the range, because the field is not supported
  * or for some other reason, an exception is thrown.
  * <p>
  * If the field is a {@link ChronoField} then the query is implemented here.
  * The {@link #isSupported(TemporalField) supported fields} will return
  * appropriate range instances.
  * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
  * <p>
  * If the field is not a {@code ChronoField}, then the result of this method
  * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)}
  * passing {@code this} as the argument.
  * Whether the range can be obtained is determined by the field.
  *
  * @param TemporalField $field the field to query the range for, not null
  * @return ValueRange the range of valid values for the field, not null
  * @throws DateTimeException if the range for the field cannot be obtained
  * @throws UnsupportedTemporalTypeException if the field is not supported
  */
 public function range(TemporalField $field)
 {
     if ($field == ChronoField::MONTH_OF_YEAR()) {
         return $field->range();
     } else {
         if ($field == ChronoField::DAY_OF_MONTH()) {
             return ValueRange::ofVariable(1, $this->getMonth()->minLength(), $this->getMonth()->maxLength());
         }
     }
     return parent::range($field);
 }
Example #5
0
 /**
  * Gets the range of valid values for the specified field.
  * <p>
  * The range object expresses the minimum and maximum valid values for a field.
  * This month is used to enhance the accuracy of the returned range.
  * If it is not possible to return the range, because the field is not supported
  * or for some other reason, an exception is thrown.
  * <p>
  * If the field is {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} then the
  * range of the month-of-year, from 1 to 12, will be returned.
  * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
  * <p>
  * If the field is not a {@code ChronoField}, then the result of this method
  * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)}
  * passing {@code this} as the argument.
  * Whether the range can be obtained is determined by the field.
  *
  * @param TemporalField $field the field to query the range for, not null
  * @return ValueRange the range of valid values for the field, not null
  * @throws DateTimeException if the range for the field cannot be obtained
  * @throws UnsupportedTemporalTypeException if the field is not supported
  */
 public function range(TemporalField $field)
 {
     if ($field == ChronoField::MONTH_OF_YEAR()) {
         return $field->range();
     }
     return parent::range($field);
 }