def invert(self):
        """Inverts the DFA final states"""
        for state in self.states:
            if state.final:
                state.final = False
            else:
                state.final = True