forked from opentripplanner/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #351 from HSLdevcom/DT-4417
DT-4417: Changes to ticket zones
- Loading branch information
Showing
6 changed files
with
163 additions
and
82 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.opentripplanner.common.model; | ||
|
||
/** | ||
* An ordered objects of three (the same type) | ||
* | ||
* @param <E> | ||
*/ | ||
public class P3<E> extends T3<E, E, E> { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public static <E> P3<E> create(E first, E second, E third) { | ||
return new P3<E>(first, second, third); | ||
} | ||
|
||
public P3(E first, E second, E third) { | ||
super(first, second, third); | ||
} | ||
|
||
public P3(E[] entries) { | ||
super(entries[0], entries[1], entries[2]); | ||
if (entries.length != 3) { | ||
throw new IllegalArgumentException("This only takes arrays of 3 arguments"); | ||
} | ||
} | ||
|
||
public String toString() { | ||
return "P3(" + first + ", " + second + ", " + third + ")"; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.opentripplanner.common.model; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* An ordered object of three (potentially different types) | ||
*/ | ||
public class T3<E1, E2, E3> implements Serializable { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public final E1 first; | ||
|
||
public final E2 second; | ||
|
||
public final E3 third; | ||
|
||
public T3(E1 first, E2 second, E3 third) { | ||
this.first = first; | ||
this.second = second; | ||
this.third = third; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return (first != null ? first.hashCode() : 0) + (second != null ? second.hashCode() : 0) + (third != null ? third.hashCode() : 0); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object object) { | ||
if (!(object instanceof T3)) return false; | ||
|
||
T3 other = (T3) object; | ||
|
||
if (first == null) { | ||
if (other.first != null) return false; | ||
} else { | ||
if (!first.equals(other.first)) return false; | ||
} | ||
|
||
if (second == null) { | ||
if (other.second != null) return false; | ||
} else { | ||
if (!second.equals(other.second)) return false; | ||
} | ||
|
||
if (third == null) { | ||
if (other.third != null) return false; | ||
} else { | ||
if (!third.equals(other.third)) return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "T3(" + first + ", " + second + ", " + third + ")"; | ||
} | ||
} |
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
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