MCPcopy Index your code
hub / github.com/Persper/code-analytics / get_func_ranges_java

Function get_func_ranges_java

persper/graphs/call_graph/java.py:386–411  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

384
385
386def get_func_ranges_java(root):
387 fids, func_ranges = [], []
388 for class_node in root.xpath('.//srcml:class', namespaces=ns):
389 try:
390 class_name = get_name(class_node)
391 except:
392 print("Class doesn't have name.")
393 continue
394
395 block_node = class_node.find('./srcml:block', ns)
396 for func_node in block_node.findall('./srcml:function', ns):
397 try:
398 func_name = get_name(func_node)
399 fid = generate_fid(class_name, func_name)
400
401 name_node = func_node.find('./srcml:name', ns)
402 block_node = func_node.find('./srcml:block', ns)
403 block_pos_node = block_node.find('./pos:position', ns)
404 start_line = int(name_node.attrib[line_attr])
405 end_line = int(block_pos_node.attrib[line_attr])
406 except:
407 continue
408
409 fids.append(fid)
410 func_ranges.append([start_line, end_line])
411 return fids, func_ranges

Callers 2

_first_phaseMethod · 0.90
_second_phaseMethod · 0.90

Calls 2

get_nameFunction · 0.70
generate_fidFunction · 0.70

Tested by

no test coverage detected