Skip to content

Commit

Permalink
fix(fares): throw UnsupportedOperationException when tightenExpiratio…
Browse files Browse the repository at this point in the history
…n called in superclass, adresses conveyal#595.
  • Loading branch information
mattwigway committed Nov 13, 2020
1 parent a525d30 commit 1e3d69d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,18 @@ public int payDifference(int grossFare){
public TransferAllowance tightenExpiration(int maxClockTime){
// cap expiration time of transfer at max clock time of search, so that transfer slips that technically have more time
// remaining, but that time cannot be used within the constraints of this search, can be pruned.
return new TransferAllowance(this.value, this.number, Math.min(this.expirationTime, maxClockTime));

// THIS METHOD SHOULD NOT BE USED BECAUSE IT INADVERTNELTY CONVERTS SUBCLASSES INTO REGULAR TRANSFERALLOWANCES
// CAUSING PATHS THAT SHOULD NOT BE DISCARDED TO BE DISCARDED!
throw new UnsupportedOperationException("tightenExpiration called unsafely. Override in subclasses.");

//return new TransferAllowance(this.value, this.number, Math.min(this.expirationTime, maxClockTime));

}

/**
* Is this transfer allowance as good as or better than another transfer allowance? This does not consider the fare
* paid so fare, and can be thought of as follows. If you are standing at a stop, and a perfectly trustworthy person
* paid so far, and can be thought of as follows. If you are standing at a stop, and a perfectly trustworthy person
* comes up to you and offers you two tickets, one with this transfer allowance, and one with the other transfer
* allowance, is this one as good as or better than the other one for any trip that you might make? (Assume you have
* no moral scruples about obtaining a transfer slip from someone else who is probably not supposed to be giving
Expand Down

0 comments on commit 1e3d69d

Please sign in to comment.