Exemplo n.º 1
0
 /**
  * Returns the Route object for this trip. This object is determined and cached when first
  * accessed. Uses value read in from database using Core, which means that it won't be available
  * when processing GTFS data since that doesn't have core object.
  *
  * @return The route or null if no Core object available
  */
 public Route getRoute() {
   if (route == null) {
     DbConfig dbConfig = Core.getInstance().getDbConfig();
     if (dbConfig == null) return null;
     route = dbConfig.getRouteById(routeId);
   }
   return route;
 }
Exemplo n.º 2
0
  /**
   * Returns the Block that the Trip is associated with. Only valid when running the core
   * application where can use Core.getInstance(). Otherwise returns null.
   *
   * @return
   */
  public Block getBlock() {
    // If not part of the core project where DbConfig is available
    // then just return null.
    Core core = Core.getInstance();
    if (core == null) return null;
    DbConfig dbConfig = core.getDbConfig();
    if (dbConfig == null) return null;

    // Part of core project so return the Block
    return dbConfig.getBlock(serviceId, blockId);
  }
Exemplo n.º 3
0
 /**
  * Returns the Route object for this trip. This object is determined and cached when first
  * accessed. Uses value read in from database using Core, which means that it won't be available
  * when processing GTFS data since that doesn't have core object.
  *
  * @return The route or null if no Core object available
  */
 public Route getRoute() {
   if (route == null) {
     if (Core.isCoreApplication()) {
       DbConfig dbConfig = Core.getInstance().getDbConfig();
       if (dbConfig == null) return null;
       route = dbConfig.getRouteById(routeId);
     } else {
       return null;
     }
   }
   return route;
 }