-
Notifications
You must be signed in to change notification settings - Fork 1
/
runnable.py
43 lines (39 loc) · 1.4 KB
/
runnable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from os import path
from javadoc_parser import *
from wikibuilder import *
if __name__ == "__main__":
APPNAME = 'mhacks-demo'
REPODIR = os.path.expanduser('~/mhacks-demo')
wikidir = os.path.expanduser('~/mhacks-demo.wiki')
graph = JavadocGraph(REPODIR)
wiki = Wiki(APPNAME, REPODIR, graph, wikidir)
def genClass(classNode, pre):
def sourceSort(a, b):
aVal = 1
bVal = 1
if "private" in a.getModifiers():
aVal = 2
if "private" in b.getModifiers():
bVal = 2
if "public" in a.getModifiers():
aVal = 0
if "public" in b.getModifiers():
bVal = 0
return aVal - bVal
fields = list(graph.getFields(classNode))
fields.sort(sourceSort)
for field in fields:
wiki.buildField(field)
methods = list(graph.getMethods(classNode))
methods.sort(sourceSort)
for method in methods:
wiki.buildMethod(method)
innerClasses = list(graph.getInnerClasses(classNode))
innerClasses.sort(sourceSort)
for innerClass in innerClasses:
wiki.buildInnerClass(innerClass)
genClass(innerClass, "{}\t".format(pre))
for topLevelClass in graph.getTopLevelClasses():
wiki.buildClass(topLevelClass)
genClass(topLevelClass, '')
wiki.createPage()