Skip to content

Commit

Permalink
Override default tightenExpiration method
Browse files Browse the repository at this point in the history
  • Loading branch information
ansoncfit committed Nov 8, 2023
1 parent 10fe00f commit 5de0c82
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ private CTAPaceTransferAllowance (int value, int number, int expirationTime) {
this.unlimited = false;
}

private CTAPaceTransferAllowance (int value, int number, int expirationTime, boolean unlimited) {
super(value, number, expirationTime);
this.unlimited = unlimited;
}


private CTAPaceTransferAllowance (boolean unlimited) {
this.unlimited = unlimited;
}
Expand All @@ -67,6 +73,15 @@ private CTAPaceTransferAllowance redeem (int fareToBoard) {
return new CTAPaceTransferAllowance(Math.max(fareToBoard, this.value), this.number - 1, this.expirationTime);
}


@Override
public CTAPaceTransferAllowance tightenExpiration (int maxClockTime) {
// copied from TransferAllowance but need to override so that everything stays a BostonTransferAllowance
int expirationTime = Math.min(this.expirationTime, maxClockTime);
return new CTAPaceTransferAllowance(this.value, this.number, expirationTime, this.unlimited);
}


}

// For now, there are no transfer allowances to/from Metra
Expand Down

0 comments on commit 5de0c82

Please sign in to comment.