public class Fare extends Object
Fare is a set of fares for different classes of users.
Modifier and Type | Class and Description |
---|---|
static class |
Fare.FareType |
Modifier and Type | Field and Description |
---|---|
HashMap<Fare.FareType,FareComponent[]> |
details
A mapping from
Fare.FareType to a list of FareComponent . |
HashMap<Fare.FareType,Money> |
fare
A mapping from
Fare.FareType to Money . |
Modifier and Type | Method and Description |
---|---|
void |
addCost(int surcharge) |
void |
addFare(Fare.FareType fareType,
Money money) |
void |
addFare(Fare.FareType fareType,
WrappedCurrency currency,
int cents) |
void |
addFareDetails(Fare.FareType fareType,
List<FareComponent> newDetails) |
List<FareComponent> |
getDetails(Fare.FareType type) |
Money |
getFare(Fare.FareType type) |
String |
toString() |
public HashMap<Fare.FareType,Money> fare
Fare.FareType
to Money
.public HashMap<Fare.FareType,FareComponent[]> details
Fare.FareType
to a list of FareComponent
.
The FareComponents are stored in an array instead of a list because JAXB doesn't know how to deal with
interfaces when serializing a trip planning response, and List is an interface.
See https://stackoverflow.com/a/1119241/778449public Fare()
public Fare(Fare aFare)
public void addFare(Fare.FareType fareType, WrappedCurrency currency, int cents)
public void addFare(Fare.FareType fareType, Money money)
public void addFareDetails(Fare.FareType fareType, List<FareComponent> newDetails)
public Money getFare(Fare.FareType type)
public List<FareComponent> getDetails(Fare.FareType type)
public void addCost(int surcharge)
Copyright © 2019. All rights reserved.