forked from opentripplanner/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor some aspects of alert handling
- Loading branch information
1 parent
d7e9ecd
commit bfd802b
Showing
4 changed files
with
72 additions
and
87 deletions.
There are no files selected for viewing
19 changes: 3 additions & 16 deletions
19
src/main/java/org/opentripplanner/routing/alertpatch/TimePeriod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,29 @@ | ||
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 static final long OPEN_ENDED = Long.MAX_VALUE; | ||
|
||
@JsonSerialize | ||
public long startTime; | ||
public final long startTime; | ||
|
||
@JsonSerialize | ||
public long endTime; | ||
public final long endTime; | ||
|
||
public TimePeriod(long start, long end) { | ||
this.startTime = start; | ||
this.endTime = end; | ||
} | ||
|
||
public TimePeriod() {} | ||
|
||
public int hashCode() { | ||
return (int) ((startTime & 0x7fff) + (endTime & 0x7fff)); | ||
} | ||
|
||
public boolean equals(Object o) { | ||
if (!(o instanceof TimePeriod)) { | ||
if (!(o instanceof TimePeriod other)) { | ||
return false; | ||
} | ||
TimePeriod other = (TimePeriod) o; | ||
return other.startTime == startTime && other.endTime == endTime; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.