我有一個(gè) java 方法,我需要從方法聲明中傳遞給這個(gè)方法的參數(shù)。下面的代碼給出了應(yīng)該提取方法聲明但輸出None我希望將提取的參數(shù)添加到字符串列表中。import ref = open("source_code.txt", "r")source_code = f.read()match = re.match("(public|protected|private|static|\s) +[\w\<\>\[\]]+\s+(\w+) *\([^\)]*\) *(\{?|[^;])", source_code)print(match)我想要這樣的東西:輸入:/** * Adds a subset of the edges of the specified source graph to the specified destination graph. * The behavior of this operation is undefined if either of the graphs is modified while the * operation is in progress. {@link #addEdgeWithVertices} is used for the transfer, so source * vertexes will be added automatically to the target graph. * * @param destination the graph to which edges are to be added * @param source the graph used as a source for edges to add * @param edges the edges to be added * @param <V> the graph vertex type * @param <E> the graph edge type * * @return <tt>true</tt> if this graph changed as a result of the call */public static <V, E> boolean addAllEdges(Graph<? super V, ? super E> destination, Graph<V, E> source, Collection<? extends E> edges) { boolean modified = false; for (E e : edges) { V s = source.getEdgeSource(e); V t = source.getEdgeTarget(e); destination.addVertex(s); destination.addVertex(t); modified |= destination.addEdge(s, t, e); } return modified; }這從方法聲明中提取destination, source, :edgepublic static <V, E> boolean addAllEdges(Graph<? super V, ? super E> destination, Graph<V, E> source, Collection<? extends E> edges)輸出:extracted_arguments = ['destination', 'source', 'edge']
添加回答
舉報(bào)
0/150
提交
取消