All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.model.transfer.TransferPriority Maven / Gradle / Ivy

There is a newer version: 2.5.0
Show newest version
package org.opentripplanner.model.transfer;

/**
 * Prioritize transfers between to trips. The priority goes from the lowest value NOT_ALLOWED to
 * the highest priority PREFERRED. This follow the NeTEx/Transmodel naming and functionality. In
 * GTFS the priority is mapped using {@code transfer_type}:
 * 
    *
  1. * {@code 0 or empty -> PREFERRED}. Recommended transfer point between routes. *
  2. *
  3. * {@code 1 -> ALLOWED}. Timed transfer point between two routes. The departing vehicle is * expected to wait for the arriving one and leave sufficient time for a rider to transfer * between routes. The transfer is also set as GUARANTEED. *
  4. *
  5. * {@code 3 -> NOT_ALLOWED}. Transfers are not possible * /li> *
*

* Note that for {@code transfer_type=1} the guarantied flag is also set causing it to take * precedence over the priority. A guarantied ALLOWED transfer is preferred over a PREFERRED * none-guarantied transfer. *

* Note that {@code transfer_type=2} is not a constraint, just a regular path transfer. */ public enum TransferPriority { /** * Avoid this transfer if possible. *

* GTFS: 3 - Transfers are not possible. */ NOT_ALLOWED(1000_00), /** * This is the same as a regular transfer. *

* GTFS: 1 - Timed transfer point, 2 - Transfer requires a minimum amount of time. */ ALLOWED(3_00), /** * A recommended transfer, but not as good as preferred. *

* GTFS: Not available in GTFS */ RECOMMENDED(2_00), /** * The highest priority there exist. *

* GTFS: 0 or empty - Recommended transfer point between routes. */ PREFERRED(1_00); private final int cost; TransferPriority(int cost) { this.cost = cost; } /** * The default priority is ALLOWED. All transfers are ALLOWED unless they have the priority * set to something else. */ public boolean isConstrained() { return this != ALLOWED; } /** * This method returns a cost for how good a transfer priority is compared to other transfer * priorities. The cost can only be used to compare transfers and should not be mixed with the * generalized-cost. A regular transfer (without any constraints) has the same cost as ALLOWED. *

*

    *
  1. {@code PREFERRED} - cost: 1 points.
  2. *
  3. {@code RECOMMENDED} - cost: 2 points.
  4. *
  5. {@code ALLOWED} - cost: 3 points.
  6. *
  7. {@code NOT_ALLOWED} - cost: 1000 points.
  8. *
*/ public int cost() { return this.cost; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy