Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function query(TemporalQuery $query)
 {
     if ($query == TemporalQueries::precision()) {
         return ChronoUnit::ERAS();
     }
     return parent::query($query);
 }
 public function test_query_precision()
 {
     $this->assertEquals($this->TEST_DATE_TIME->query(TemporalQueries::precision()), CU::NANOS());
     $this->assertEquals(TemporalQueries::precision()->queryFrom($this->TEST_DATE_TIME), CU::NANOS());
 }
Esempio n. 3
0
 /**
  * Queries this instant using the specified query.
  * <p>
  * This queries this instant using the specified query strategy object.
  * The {@code TemporalQuery} object defines the logic to be used to
  * obtain the result. Read the documentation of the query to understand
  * what the result of this method will be.
  * <p>
  * The result of this method is obtained by invoking the
  * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
  * specified query passing {@code this} as the argument.
  *
  * @param <R> the type of the result
  * @param query TemporalQuery the query to invoke, not null
  * @return mixed the query result, null may be returned (defined by the query)
  * @throws DateTimeException if unable to query (defined by the query)
  * @throws ArithmeticException if numeric overflow occurs (defined by the query)
  */
 public function query(TemporalQuery $query)
 {
     if ($query == TemporalQueries::precision()) {
         return ChronoUnit::NANOS();
     }
     // inline TemporalAccessor.super.query(query) as an optimization
     if ($query == TemporalQueries::chronology() || $query == TemporalQueries::zoneId() || $query == TemporalQueries::zone() || $query == TemporalQueries::offset() || $query == TemporalQueries::localDate() || $query == TemporalQueries::localTime()) {
         return null;
     }
     return $query->queryFrom($this);
 }
 function data_query()
 {
     return [[self::TEST_200707_15_12_30_40_987654321(), TemporalQueries::chronology(), IsoChronology::INSTANCE()], [self::TEST_200707_15_12_30_40_987654321(), TemporalQueries::zoneId(), null], [self::TEST_200707_15_12_30_40_987654321(), TemporalQueries::precision(), CU::NANOS()], [self::TEST_200707_15_12_30_40_987654321(), TemporalQueries::zone(), null], [self::TEST_200707_15_12_30_40_987654321(), TemporalQueries::offset(), null], [self::TEST_200707_15_12_30_40_987654321(), TemporalQueries::localDate(), LocalDate::of(2007, 7, 15)], [self::TEST_200707_15_12_30_40_987654321(), TemporalQueries::localTime(), LocalTime::of(12, 30, 40, 987654321)]];
 }
Esempio n. 5
0
 function data_query()
 {
     return [[self::TEST_2008_06(), TemporalQueries::chronology(), IsoChronology::INSTANCE()], [self::TEST_2008_06(), TemporalQueries::zoneId(), null], [self::TEST_2008_06(), TemporalQueries::precision(), CU::MONTHS()], [self::TEST_2008_06(), TemporalQueries::zone(), null], [self::TEST_2008_06(), TemporalQueries::offset(), null], [self::TEST_2008_06(), TemporalQueries::localDate(), null], [self::TEST_2008_06(), TemporalQueries::localTime(), null]];
 }
Esempio n. 6
0
 /**
  * Queries this year using the specified query.
  * <p>
  * This queries this year using the specified query strategy object.
  * The {@code TemporalQuery} object defines the logic to be used to
  * obtain the result. Read the documentation of the query to understand
  * what the result of this method will be.
  * <p>
  * The result of this method is obtained by invoking the
  * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
  * specified query passing {@code this} as the argument.
  *
  * @param <R> the type of the result
  * @param TemporalQuery $query the query to invoke, not null
  * @return mixed the query result, null may be returned (defined by the query)
  * @throws DateTimeException if unable to query (defined by the query)
  * @throws ArithmeticException if numeric overflow occurs (defined by the query)
  */
 public function query(TemporalQuery $query)
 {
     if ($query == TemporalQueries::chronology()) {
         return IsoChronology::INSTANCE();
     } else {
         if ($query == TemporalQueries::precision()) {
             return ChronoUnit::YEARS();
         }
     }
     return parent::query($query);
 }
 function data_query()
 {
     return [[self::TEST_2008_6_30_11_30_59_000000500(), TemporalQueries::chronology(), IsoChronology::INSTANCE()], [self::TEST_2008_6_30_11_30_59_000000500(), TemporalQueries::zoneId(), null], [self::TEST_2008_6_30_11_30_59_000000500(), TemporalQueries::precision(), CU::NANOS()], [self::TEST_2008_6_30_11_30_59_000000500(), TemporalQueries::zone(), self::OFFSET_PONE()], [self::TEST_2008_6_30_11_30_59_000000500(), TemporalQueries::offset(), self::OFFSET_PONE()], [self::TEST_2008_6_30_11_30_59_000000500(), TemporalQueries::localDate(), LocalDate::of(2008, 6, 30)], [self::TEST_2008_6_30_11_30_59_000000500(), TemporalQueries::localTime(), LocalTime::of(11, 30, 59, 500)]];
 }
 function data_query()
 {
     return [[self::TEST_11_30_59_500_PONE(), TemporalQueries::chronology(), null], [self::TEST_11_30_59_500_PONE(), TemporalQueries::zoneId(), null], [self::TEST_11_30_59_500_PONE(), TemporalQueries::precision(), CU::NANOS()], [self::TEST_11_30_59_500_PONE(), TemporalQueries::zone(), self::OFFSET_PONE()], [self::TEST_11_30_59_500_PONE(), TemporalQueries::offset(), self::OFFSET_PONE()], [self::TEST_11_30_59_500_PONE(), TemporalQueries::localDate(), null], [self::TEST_11_30_59_500_PONE(), TemporalQueries::localTime(), LocalTime::of(11, 30, 59, 500)]];
 }
Esempio n. 9
0
 function data_query()
 {
     return [[DayOfWeek::FRIDAY(), TemporalQueries::chronology(), null], [DayOfWeek::FRIDAY(), TemporalQueries::zoneId(), null], [DayOfWeek::FRIDAY(), TemporalQueries::precision(), ChronoUnit::DAYS()], [DayOfWeek::FRIDAY(), TemporalQueries::zone(), null], [DayOfWeek::FRIDAY(), TemporalQueries::offset(), null], [DayOfWeek::FRIDAY(), TemporalQueries::localDate(), null], [DayOfWeek::FRIDAY(), TemporalQueries::localTime(), null]];
 }
Esempio n. 10
0
 /**
  * Queries this offset using the specified query.
  * <p>
  * This queries this offset using the specified query strategy object.
  * The {@code TemporalQuery} object defines the logic to be used to
  * obtain the result. Read the documentation of the query to understand
  * what the result of this method will be.
  * <p>
  * The result of this method is obtained by invoking the
  * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
  * specified query passing {@code this} as the argument.
  *
  * @param <R> the type of the result
  * @param  $query TemporalQuery the query to invoke, not null
  * @return mixed the query result, null may be returned (defined by the query)
  * @throws DateTimeException if unable to query (defined by the query)
  * @throws ArithmeticException if numeric overflow occurs (defined by the query)
  */
 public function query(TemporalQuery $query)
 {
     if ($query == TemporalQueries::offset() || $query == TemporalQueries::zone()) {
         return $this;
     }
     // inlined from \Celest\Temporal\AbstractTemporalAccessor::query
     if ($query == TemporalQueries::zoneId() || $query == TemporalQueries::chronology() || $query == TemporalQueries::precision()) {
         return null;
     }
     return $query->queryFrom($this);
 }
Esempio n. 11
0
 public function query(TemporalQuery $query)
 {
     if ($query == TemporalQueries::zoneId()) {
         return $this->zone;
     } else {
         if ($query == TemporalQueries::chronology()) {
             return $this->chrono;
         } else {
             if ($query == TemporalQueries::localDate()) {
                 return $this->date != null ? LocalDate::from($this->date) : null;
             } else {
                 if ($query == TemporalQueries::localTime()) {
                     return $this->time;
                 } else {
                     if ($query == TemporalQueries::zone() || $query == TemporalQueries::offset()) {
                         return $query->queryFrom($this);
                     } else {
                         if ($query == TemporalQueries::precision()) {
                             return null;
                             // not a complete date/time
                         }
                     }
                 }
             }
         }
     }
     // inline TemporalAccessor.super.query(query) as an optimization
     // non-JDK classes are not permitted to make this optimization
     return $query->queryFrom($this);
 }
Esempio n. 12
0
 function data_query()
 {
     return [[self::$TEST_2008, TemporalQueries::chronology(), IsoChronology::INSTANCE()], [self::$TEST_2008, TemporalQueries::zoneId(), null], [self::$TEST_2008, TemporalQueries::precision(), ChronoUnit::YEARS()], [self::$TEST_2008, TemporalQueries::zone(), null], [self::$TEST_2008, TemporalQueries::offset(), null], [self::$TEST_2008, TemporalQueries::localDate(), null], [self::$TEST_2008, TemporalQueries::localTime(), null]];
 }
Esempio n. 13
0
 function data_query()
 {
     return [[self::TEST_123040987654321(), TemporalQueries::chronology(), null], [self::TEST_123040987654321(), TemporalQueries::zoneId(), null], [self::TEST_123040987654321(), TemporalQueries::precision(), CU::NANOS()], [self::TEST_123040987654321(), TemporalQueries::zone(), null], [self::TEST_123040987654321(), TemporalQueries::offset(), null], [self::TEST_123040987654321(), TemporalQueries::localDate(), null], [self::TEST_123040987654321(), TemporalQueries::localTime(), self::TEST_123040987654321()]];
 }
Esempio n. 14
0
 function data_query()
 {
     return [[Month::JUNE(), TemporalQueries::chronology(), IsoChronology::INSTANCE()], [Month::JUNE(), TemporalQueries::zoneId(), null], [Month::JUNE(), TemporalQueries::precision(), ChronoUnit::MONTHS()], [Month::JUNE(), TemporalQueries::zone(), null], [Month::JUNE(), TemporalQueries::offset(), null], [Month::JUNE(), TemporalQueries::localDate(), null], [Month::JUNE(), TemporalQueries::localTime(), null]];
 }
Esempio n. 15
0
 /**
  * Queries this date-time using the specified query.
  * <p>
  * This queries this date-time using the specified query strategy object.
  * The {@code TemporalQuery} object defines the logic to be used to
  * obtain the result. Read the documentation of the query to understand
  * what the result of this method will be.
  * <p>
  * The result of this method is obtained by invoking the
  * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
  * specified query passing {@code this} as the argument.
  *
  * @param <R> the type of the result
  * @param TemporalQuery $query the query to invoke, not null
  * @return mixed the query result, null may be returned (defined by the query)
  * @throws DateTimeException if unable to query (defined by the query)
  * @throws ArithmeticException if numeric overflow occurs (defined by the query)
  */
 public function query(TemporalQuery $query)
 {
     if ($query == TemporalQueries::offset() || $query == TemporalQueries::zone()) {
         return $this->getOffset();
     } else {
         if ($query == TemporalQueries::zoneId()) {
             return null;
         } else {
             if ($query == TemporalQueries::localDate()) {
                 return $this->toLocalDate();
             } else {
                 if ($query == TemporalQueries::localTime()) {
                     return $this->toLocalTime();
                 } else {
                     if ($query == TemporalQueries::chronology()) {
                         return IsoChronology::INSTANCE();
                     } else {
                         if ($query == TemporalQueries::precision()) {
                             return ChronoUnit::NANOS();
                         }
                     }
                 }
             }
         }
     }
     // inline TemporalAccessor.super.query(query) as an optimization
     // non-JDK classes are not permitted to make this optimization
     return $query->queryFrom($this);
 }
Esempio n. 16
0
 public function data_query()
 {
     return [[ZoneOffset::UTC(), TemporalQueries::chronology(), null], [ZoneOffset::UTC(), TemporalQueries::zoneId(), null], [ZoneOffset::UTC(), TemporalQueries::precision(), null], [ZoneOffset::UTC(), TemporalQueries::zone(), ZoneOffset::UTC()], [ZoneOffset::UTC(), TemporalQueries::offset(), ZoneOffset::UTC()], [ZoneOffset::UTC(), TemporalQueries::localDate(), null], [ZoneOffset::UTC(), TemporalQueries::localTime(), null]];
 }
 public function query(TemporalQuery $query)
 {
     if ($query == TemporalQueries::chronology()) {
         return $this->effectiveChrono;
     }
     if ($query == TemporalQueries::zoneId()) {
         return $this->effectiveZone;
     }
     if ($query == TemporalQueries::precision()) {
         return $this->temporal->query($query);
     }
     return $query->queryFrom($this);
 }