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

com.vesoft.nebula.driver.graph.data.NTime Maven / Gradle / Ivy

The newest version!
package com.vesoft.nebula.driver.graph.data;

import com.vesoft.nebula.proto.common.LocalTime;
import java.util.Objects;

public class NTime {
    private final LocalTime localTime;

    public NTime(LocalTime localTime) {
        this.localTime = localTime;
    }

    /**
     * @return utc Time hour
     */
    public int getHour() {
        return localTime.getHour();
    }

    /**
     * @return utc Time minute
     */
    public int getMinute() {
        return localTime.getMinute();
    }

    /**
     * @return utc Time second
     */
    public int getSecond() {
        return localTime.getSec();
    }

    /**
     * @return utc Time microsec
     */
    public int getMicrosec() {
        return localTime.getMicrosec();
    }


    @Override
    public String toString() {
        return String.format("%02d:%02d:%02d.%06d",
                localTime.getHour(), localTime.getMinute(),
                localTime.getSec(), localTime.getMicrosec());
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        NTime that = (NTime) o;
        return localTime.getHour() == that.getHour()
                && localTime.getHour() == that.getMinute()
                && localTime.getSec() == that.getSecond()
                && localTime.getMicrosec() == that.getMicrosec();
    }

    @Override
    public int hashCode() {
        return Objects.hash(localTime);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy