def getModules(self): modules = J.call(o, "getModules", "()Ljava/util/List;") if modules is None: return [] module_iterator = J.call(modules, "iterator", "()Ljava/util/Iterator;") return [wrap_module_info(x) for x in J.iterate_java(module_iterator)]
def get_commands(): '''Return a list of the available command strings''' hashtable = J.static_call('ij/Menus', 'getCommands', '()Ljava/util/Hashtable;') if hashtable is None: # # This is a little bogus, but works - trick IJ into initializing # execute_command("pleaseignorethis") hashtable = J.static_call('ij/Menus', 'getCommands', '()Ljava/util/Hashtable;') if hashtable is None: return [] keys = J.call(hashtable, "keys", "()Ljava/util/Enumeration;") keys = J.jenumeration_to_string_list(keys) values = J.call(hashtable, "values", "()Ljava/util/Collection;") values = [ J.to_string(x) for x in J.iterate_java( J.call(values, 'iterator', "()Ljava/util/Iterator;")) ] class CommandList(list): def __init__(self): super(CommandList, self).__init__(keys) self.values = values return CommandList()
def get_commands(): """Return a list of the available command strings""" hashtable = J.static_call('ij/Menus', 'getCommands', '()Ljava/util/Hashtable;') if hashtable is None: # # This is a little bogus, but works - trick IJ into initializing # execute_command("pleaseignorethis") hashtable = J.static_call('ij/Menus', 'getCommands', '()Ljava/util/Hashtable;') if hashtable is None: return [] keys = J.call(hashtable, "keys", "()Ljava/util/Enumeration;") keys = J.jenumeration_to_string_list(keys) values = J.call(hashtable, "values", "()Ljava/util/Collection;") values = [J.to_string(x) for x in J.iterate_java( J.call(values, 'iterator', "()Ljava/util/Iterator;"))] class CommandList(list): def __init__(self): super(CommandList, self).__init__(keys) self.values = values return CommandList()
def dependencies(self): """ Returns all the dependencies. :return: the dependency list :rtype: list """ result = [] iterator = javabridge.iterate_java(javabridge.call(self.jobject, "dependencies", "()Ljava/util/Iterator;")) for c in iterator: result.append(Capability(c)) return result
def fn(): list(javabridge.iterate_java(javabridge.make_list(range(10)).o))