예제 #1
0
    def __str__(self):
        if isinstance(self.arrival, list):
            start = merge_with(self.start, '&')
            arrival = merge_with(self.arrival, '&')
        else:
            start = self.start
            arrival = self.arrival

        return self.event + ': ' + start + ' -> ' + arrival
예제 #2
0
def print_deadlock_states(synchronized_class):
    states = detect_deadlock_states(synchronized_class)

    if states:
        print("Deadlocks found for the following states:")

        for state in states:
            print("\t" + merge_with(state, "&"))
    else:
        print("No deadlocks found")
예제 #3
0
def print_deadlock_states(synchronized_class):
    states = detect_deadlock_states(synchronized_class)

    if states:
        print('Deadlocks found for the following states:')

        for state in states:
            print('\t' + merge_with(state, '&'))
    else:
        print('No deadlocks found')
예제 #4
0
    def __str__(self):
        res = 'class ' + self.name + '\n'

        basic_block_res = 'state '

        if isinstance(self.states[0], list):
            for state in self.states:
                basic_block_res += merge_with(state, '&') + ', '
            basic_block_res = basic_block_res.strip(', ')
        else:
            basic_block_res += ', '.join(self.states)

        basic_block_res += ';\n' + events_to_str(self.events) + '\n'
        basic_block_res += transitions_and_observers_to_str(self.transitions, self.observers)

        for line in str(basic_block_res).split('\n'):
            res += '\t' + line + '\n'

        res += 'end\n'

        return res
예제 #5
0
    def __str__(self):
        res = 'class ' + self.name + '\n'

        basic_block_res = 'state '

        if isinstance(self.states[0], list):
            for state in self.states:
                basic_block_res += merge_with(state, '&') + ', '
            basic_block_res = basic_block_res.strip(', ')
        else:
            basic_block_res += ', '.join(self.states)

        basic_block_res += ';\n' + events_to_str(self.events) + '\n'
        basic_block_res += transitions_and_observers_to_str(
            self.transitions, self.observers)

        for line in str(basic_block_res).split('\n'):
            res += '\t' + line + '\n'

        res += 'end\n'

        return res