Esempio n. 1
0
    def __init__(self, name, nodes):

        if len(nodes) < 2:
            raise Exception("Less than two nodes were given")

        if name is None or not name:
            name = "l-id-" + str(get_new_link_id())

        self.name = name
        self.nodes = nodes
        self.hash = str2sha1("%s#%s" % (self.name, self.nodes))
Esempio n. 2
0
    def __init__(self, locations, aircrafts):

        self.locations = locations
        self.aircrafts = aircrafts

        callsigns = []
        for aircraft in aircrafts:
            callsigns.append(aircraft.callsign)
        callsigns.sort()

        self.hash = str2sha1(
            "%s#%s" % ("#".join(callsigns), "#".join(str(self.locations))))
Esempio n. 3
0
    def __init__(self, name, geo_pos):

        if not is_valid_geo_pos(geo_pos):
            raise Exception("Invalid geo position")

        if name is None or not name:
            name = "n-id-" + str(get_new_node_id())

        self.name = name
        self.geo_pos = geo_pos
        self.hash = str2sha1("%s#%.5f#%.5f" %
                             (name, geo_pos["lat"], geo_pos["lng"]))
Esempio n. 4
0
    def __init__(self, targets=None, unfinished_distance=0):
        # unfinished_distance == 0 means it's
        self.targets = [HoldLink()] if unfinished_distance == 0 else []
        self.targets += targets if targets else []  # links\
        self.backup = deepcopy(targets)
        self.unfinished_distance = unfinished_distance
        self.index, self.distance, self.distance_left = None, None, None
        self.reset()

        self.hash = str2sha1("#".join(str(self.targets)))
        self.uncertainty_delayed_index = []
        self.scheduler_delayed_index = []
Esempio n. 5
0
    def __init__(self, targets=None):

        if targets is None:
            targets = []

        self.targets = targets
        self.backup = deepcopy(targets)
        self.index = 0

        self.hash = str2sha1("#".join(str(self.targets)))
        self.uncertainty_delayed_index = []
        self.scheduler_delayed_index = []
Esempio n. 6
0
    def __init__(self, name, nodes):

        if len(nodes) < 2:
            raise Exception("Less than two nodes were given")

        if name is None or not name:
            name = "l-id-" + str(get_new_link_id())

        self.name = name
        self.nodes = nodes
        self.segment_lengths = [nodes[i].get_distance_to(nodes[i + 1]) for i in range(len(nodes) - 1)]
        self.boundary = self.__calculate_boundary(nodes)
        self.hash = str2sha1("%s#%s" % (self.name, self.nodes))
        self.occupied = False
    def __init__(self, targets=None, unfinished_distance=0):
        # unfinished_distance == 0 means it's
        self.targets = [HoldLink()] if unfinished_distance == 0 else []
        self.targets += targets if targets else []  # links\
        self.backup = deepcopy(targets)
        self.unfinished_distance = unfinished_distance
        # distance: the distance travelled on the link
        # distance_left: the distance left for entire itinerary
        self.index, self.distance, self.distance_left = None, None, None
        self.reset()

        self.hash = str2sha1("#".join(str(self.targets)))
        self.uncertainty_delayed_index = []
        self.scheduler_delayed_index = []
        self.links_this_tick = []