All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.deephaven.engine.table.impl.sources.ConvertibleTimeSource Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
/**
 * Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
 */
package io.deephaven.engine.table.impl.sources;

import io.deephaven.engine.table.ColumnSource;

import java.time.*;

/**
 * An interface for {@link ColumnSource}s that indicate that it both represents a time value, and may be converted
 * between other common time values efficiently.
 */
public interface ConvertibleTimeSource {
    /**
     * Convert this source to a {@link ZonedDateTime} source at the specified {@link ZoneId zone}.
     *
     * @param zone the time zone
     * @return a view of this source as a {@link ZonedDateTime}
     */
    ColumnSource toZonedDateTime(ZoneId zone);

    /**
     * Convert this source to a {@link LocalDate} source at the specified {@link ZoneId zone}.
     *
     * @param zone the time zone
     * @return a view of this source as a {@link LocalDate}
     */
    ColumnSource toLocalDate(ZoneId zone);

    /**
     * Convert this source to a {@link LocalTime} source at the specified {@link ZoneId zone}.
     *
     * @param zone the time zone
     * @return a view of this source as a {@link LocalTime}
     */
    ColumnSource toLocalTime(ZoneId zone);

    /**
     * Convert this source to an {@link Instant} source.
     *
     * @return a view of this source asan {@link Instant}
     */
    ColumnSource toInstant();

    /**
     * Convert this source to a {@code long} source of nanoseconds of epoch.
     *
     * @return a view of this source as a {@link ZonedDateTime}
     */
    ColumnSource toEpochNano();

    /**
     * Check if this class supports time conversion. If false, all other methods will fail.
     *
     * @return true if time conversion is supported.
     */
    boolean supportsTimeConversion();

    interface Zoned {
        ZoneId getZone();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy