1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.themis.lethe.analysis;
18
19 import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
20 import io.github.tonywasher.joceanus.themis.lethe.analysis.ThemisAnalysisContainer.ThemisAnalysisAdoptable;
21
22 import java.util.ArrayDeque;
23 import java.util.Deque;
24
25
26
27
28 public class ThemisAnalysisMethodBody
29 implements ThemisAnalysisContainer, ThemisAnalysisAdoptable {
30
31
32
33 static final String ARRAYINIT = "= " + ThemisAnalysisChar.BRACE_OPEN;
34
35
36
37
38 private ThemisAnalysisContainer theParent;
39
40
41
42
43 private final ThemisAnalysisLine theHeader;
44
45
46
47
48 private final Deque<ThemisAnalysisElement> theContents;
49
50
51
52
53
54
55
56
57 ThemisAnalysisMethodBody(final ThemisAnalysisParser pParser,
58 final ThemisAnalysisLine pLine) throws OceanusException {
59
60 theHeader = pLine;
61
62
63 theParent = pParser.getParent();
64
65
66 final Deque<ThemisAnalysisElement> myLines = ThemisAnalysisBuilder.processBody(pParser);
67
68
69 theContents = new ArrayDeque<>();
70 final ThemisAnalysisParser myParser = new ThemisAnalysisParser(myLines, theContents, this);
71
72
73 myParser.processLines();
74 }
75
76
77
78
79
80
81 ThemisAnalysisLine getHeader() {
82 return theHeader;
83 }
84
85 @Override
86 public Deque<ThemisAnalysisElement> getContents() {
87 return theContents;
88 }
89
90 @Override
91 public ThemisAnalysisContainer getParent() {
92 return theParent;
93 }
94
95 @Override
96 public void setParent(final ThemisAnalysisContainer pParent) {
97 theParent = pParent;
98 }
99
100 @Override
101 public void postProcessLines() {
102
103 }
104
105 @Override
106 public int getNumLines() {
107 return theContents.size();
108 }
109
110
111
112
113
114
115
116 static boolean checkMethodBody(final ThemisAnalysisLine pLine) {
117
118 return pLine.endsWithChar(ThemisAnalysisChar.BRACE_OPEN);
119 }
120 }