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

org.opentripplanner.routing.alertpatch.TimePeriod Maven / Gradle / Ivy

There is a newer version: 2.5.0
Show newest version
package org.opentripplanner.routing.alertpatch;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * Represents a period of time, in terms of seconds in [start, end)
 * @author novalis
 *
 */
public class TimePeriod {
    // TODO OTP2 - This class is used both for internal and external API representation,
    //           - a external API version should be created to decouple the internal model
    //           - from any API usage.

    public TimePeriod(long start, long end) {
        this.startTime = start;
        this.endTime = end;
    }

    public TimePeriod() {
    }

    @JsonSerialize
    public long startTime;

    @JsonSerialize
    public long endTime;

    public boolean equals(Object o) {
        if (!(o instanceof TimePeriod)) {
            return false;
        }
        TimePeriod other = (TimePeriod) o;
        return other.startTime == startTime && other.endTime == endTime;
    }

    public int hashCode() {
        return (int) ((startTime & 0x7fff) + (endTime & 0x7fff));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy