Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.Fare


        }
      }
    }

    Currency currency = Currency.getInstance("USD");
    Fare fare = new Fare();
    fare.addFare(FareType.regular, new WrappedCurrency(currency),
        (int) Math.round(totalFare
            * Math.pow(10, currency.getDefaultFractionDigits())));
    return fare;
  }
View Full Code Here


        if (lowestCost != Float.POSITIVE_INFINITY) {
            int fractionDigits = 2;
            if (currency != null)
                fractionDigits = currency.getDefaultFractionDigits();
            int cents = (int) Math.round(lowestCost * Math.pow(10, fractionDigits));
            Fare fare = new Fare();
            fare.addFare(FareType.regular, wrappedCurrency, cents);
            return fare;
        } else {
            return null;
        }
    }
View Full Code Here

     * It will return the same fare at every invocation.
     */
    private static final class FareServiceStub implements FareService {
        @Override
        public Fare getCost(GraphPath path) {
            Fare fare = new Fare();
            fare.addFare(FareType.regular, new WrappedCurrency(), 0);
            fare.addFare(FareType.student, new WrappedCurrency(), 1);
            fare.addFare(FareType.senior, new WrappedCurrency(), 2);
            fare.addFare(FareType.tram, new WrappedCurrency(), 4);
            fare.addFare(FareType.special, new WrappedCurrency(), 8);
            return fare;
        }
View Full Code Here

        path = spt.getPath(gg.getVertex("Caltrain:Mountain View Caltrain"), true);

        FareService fareService = gg.getService(FareService.class);
       
        Fare cost = fareService.getCost(path);
        assertEquals(cost.getFare(FareType.regular), new Money(new WrappedCurrency("USD"), 425));
    }
View Full Code Here

        path = spt.getPath(gg.getVertex("TriMet:8371"), true);
        assertNotNull(path);

        FareService fareService = gg.getService(FareService.class);
        Fare cost = fareService.getCost(path);
        assertEquals(new Money(new WrappedCurrency("USD"), 200), cost.getFare(FareType.regular));

        // long trip

        startTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 14, 0, 0);
        options.dateTime = startTime;
View Full Code Here

                }
            }
        }

        if (next == null) {
            Fare fare = new Fare();
            fare.addFare(FareType.regular, new WrappedCurrency(Currency.getInstance(currency)),
                    cost);
            return fare;
        }
        if (cost == 0) {
            return next.getCost(path);
        }

        Fare fare = next.getCost(path);
        if (fare == null) {
            fare = new Fare();
            fare.addFare(FareType.regular, new WrappedCurrency(Currency.getInstance(currency)),
                    cost);
            return fare;
        }
        fare.addCost(cost);
        return fare;
    }
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.core.Fare

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.