def __generate_train_mode():
    """
    :rtype list[TransportationMode]
    :return:
    """
    mode_list = []
    train_route_list = train_route_accessor.get_all_train_routes()
    """:type :list[TrainRoute]"""
    for train_route in train_route_list:
        station_list = train_route.stations
        line_name = train_route.line_name
        origin_list = station_list[:-1]
        destination_list = station_list[1:]
        for origin, destination in zip(origin_list, destination_list):
            # TODO remove this eta hack!
            eta = 3
            transportation_mode = TransportationMode()
            transportation_mode.eta = eta
            transportation_mode.name = ' '.join(['KRL ', train_route.line_name])
            transportation_mode.origin = origin
            transportation_mode.destination = destination
            # TODO remove this price hack
            transportation_mode.price = 500
            transportation_mode.heading_from = station_list[0]
            transportation_mode.heading_to = station_list[-1]
            mode_list.append(transportation_mode)

        for destination, origin in zip(origin_list, destination_list):
            # TODO remove this eta hack!
            eta = 3
            transportation_mode = TransportationMode()
            transportation_mode.eta = eta
            transportation_mode.name = ' '.join(['KRL ', train_route.line_name])
            transportation_mode.origin = origin
            transportation_mode.destination = destination
            # TODO remove this price hack
            transportation_mode.price = 500
            transportation_mode.heading_from = station_list[-1]
            transportation_mode.heading_to = station_list[0]
            mode_list.append(transportation_mode)
    return mode_list
def __generate_busway_transfer_mode():
    """
    :rtype list[TransportationMode]
    :return:
    """
    mode_list = []
    busway_transfer_list = busway_transfer_accessor.get_all_busway_transfers()
    for busway_transfer in busway_transfer_list:
        origin = busway_transfer.from_station
        destination = busway_transfer.to_station
        transportation_mode = TransportationMode()
        transportation_mode.eta = 3
        transportation_mode.name = 'Jalan Santai'
        transportation_mode.origin = origin
        transportation_mode.destination = destination
        transportation_mode.price = 0
        transportation_mode.heading_from = origin
        transportation_mode.heading_to = destination
        mode_list.append(transportation_mode)

    for busway_transfer in busway_transfer_list:
        origin = busway_transfer.to_station
        destination = busway_transfer.from_station
        transportation_mode = TransportationMode()
        transportation_mode.eta = 3
        transportation_mode.name = 'Jalan Santai'
        transportation_mode.origin = origin
        transportation_mode.destination = destination
        transportation_mode.price = 0
        transportation_mode.heading_from = origin
        transportation_mode.heading_to = destination
        mode_list.append(transportation_mode)
    return mode_list
def __generate_walk_mode():
    """
    :rtype list[TransportationMode]
    :return:
    """
    mode_list = []
    walk_route_list = walk_route_accessor.get_all_walk_routes()
    """ :type :list[WalkRoute]"""
    for walk_route in walk_route_list:
        origin = walk_route.walk_from
        destination = walk_route.walk_to
        transportation_mode = TransportationMode()
        # TODO remove this hack!
        transportation_mode.eta = 2
        transportation_mode.name = 'Jalan Santai'
        transportation_mode.origin = origin
        transportation_mode.destination = destination
        transportation_mode.price = 0
        transportation_mode.heading_from = origin
        transportation_mode.heading_to = destination
        mode_list.append(transportation_mode)

    for walk_route in walk_route_list:
        origin = walk_route.walk_to
        destination = walk_route.walk_from
        transportation_mode = TransportationMode()
        # TODO remove this hack!
        transportation_mode.eta = 2
        transportation_mode.name = 'Jalan Santai'
        transportation_mode.origin = origin
        transportation_mode.destination = destination
        transportation_mode.price = 0
        transportation_mode.heading_from = origin
        transportation_mode.heading_to = destination
        mode_list.append(transportation_mode)
    return mode_list
Exemple #4
0
def __generate_train_mode():
    """
    :rtype list[TransportationMode]
    :return:
    """
    mode_list = []
    train_route_list = train_route_accessor.get_all_train_routes()
    """:type :list[TrainRoute]"""
    for train_route in train_route_list:
        station_list = train_route.stations
        line_name = train_route.line_name
        origin_list = station_list[:-1]
        destination_list = station_list[1:]
        for origin, destination in zip(origin_list, destination_list):
            # TODO remove this eta hack!
            eta = 3
            transportation_mode = TransportationMode()
            transportation_mode.eta = eta
            transportation_mode.name = ' '.join(
                ['KRL ', train_route.line_name])
            transportation_mode.origin = origin
            transportation_mode.destination = destination
            # TODO remove this price hack
            transportation_mode.price = 500
            transportation_mode.heading_from = station_list[0]
            transportation_mode.heading_to = station_list[-1]
            mode_list.append(transportation_mode)

        for destination, origin in zip(origin_list, destination_list):
            # TODO remove this eta hack!
            eta = 3
            transportation_mode = TransportationMode()
            transportation_mode.eta = eta
            transportation_mode.name = ' '.join(
                ['KRL ', train_route.line_name])
            transportation_mode.origin = origin
            transportation_mode.destination = destination
            # TODO remove this price hack
            transportation_mode.price = 500
            transportation_mode.heading_from = station_list[-1]
            transportation_mode.heading_to = station_list[0]
            mode_list.append(transportation_mode)
    return mode_list
Exemple #5
0
def __generate_busway_transfer_mode():
    """
    :rtype list[TransportationMode]
    :return:
    """
    mode_list = []
    busway_transfer_list = busway_transfer_accessor.get_all_busway_transfers()
    for busway_transfer in busway_transfer_list:
        origin = busway_transfer.from_station
        destination = busway_transfer.to_station
        transportation_mode = TransportationMode()
        transportation_mode.eta = 3
        transportation_mode.name = 'Jalan Santai'
        transportation_mode.origin = origin
        transportation_mode.destination = destination
        transportation_mode.price = 0
        transportation_mode.heading_from = origin
        transportation_mode.heading_to = destination
        mode_list.append(transportation_mode)

    for busway_transfer in busway_transfer_list:
        origin = busway_transfer.to_station
        destination = busway_transfer.from_station
        transportation_mode = TransportationMode()
        transportation_mode.eta = 3
        transportation_mode.name = 'Jalan Santai'
        transportation_mode.origin = origin
        transportation_mode.destination = destination
        transportation_mode.price = 0
        transportation_mode.heading_from = origin
        transportation_mode.heading_to = destination
        mode_list.append(transportation_mode)
    return mode_list
Exemple #6
0
def __generate_walk_mode():
    """
    :rtype list[TransportationMode]
    :return:
    """
    mode_list = []
    walk_route_list = walk_route_accessor.get_all_walk_routes()
    """ :type :list[WalkRoute]"""
    for walk_route in walk_route_list:
        origin = walk_route.walk_from
        destination = walk_route.walk_to
        transportation_mode = TransportationMode()
        # TODO remove this hack!
        transportation_mode.eta = 2
        transportation_mode.name = 'Jalan Santai'
        transportation_mode.origin = origin
        transportation_mode.destination = destination
        transportation_mode.price = 0
        transportation_mode.heading_from = origin
        transportation_mode.heading_to = destination
        mode_list.append(transportation_mode)

    for walk_route in walk_route_list:
        origin = walk_route.walk_to
        destination = walk_route.walk_from
        transportation_mode = TransportationMode()
        # TODO remove this hack!
        transportation_mode.eta = 2
        transportation_mode.name = 'Jalan Santai'
        transportation_mode.origin = origin
        transportation_mode.destination = destination
        transportation_mode.price = 0
        transportation_mode.heading_from = origin
        transportation_mode.heading_to = destination
        mode_list.append(transportation_mode)
    return mode_list