Refactoring of class hierarchy with artificial intelligence