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 = []
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 = []
def __add_delay(self): if self.is_completed: return None self.targets.insert(0, HoldLink()) return self.targets[0]