1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.themis.xanalysis.solver.proj;
18
19 import io.github.tonywasher.joceanus.themis.xanalysis.parser.proj.ThemisXAnalysisFile;
20 import io.github.tonywasher.joceanus.themis.xanalysis.parser.proj.ThemisXAnalysisPackage;
21 import io.github.tonywasher.joceanus.themis.xanalysis.solver.proj.ThemisXAnalysisSolverDef.ThemisXAnalysisSolverModuleDef;
22 import io.github.tonywasher.joceanus.themis.xanalysis.solver.proj.ThemisXAnalysisSolverDef.ThemisXAnalysisSolverPackageDef;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27
28
29
30 public class ThemisXAnalysisSolverPackage
31 implements ThemisXAnalysisSolverPackageDef {
32
33
34
35 private final ThemisXAnalysisSolverModuleDef theModule;
36
37
38
39
40 private final ThemisXAnalysisPackage thePackage;
41
42
43
44
45 private final List<ThemisXAnalysisSolverFile> theFiles;
46
47
48
49
50 private final List<ThemisXAnalysisSolverPackage> theReferenced;
51
52
53
54
55 private boolean isCircular;
56
57
58
59
60
61
62
63 ThemisXAnalysisSolverPackage(final ThemisXAnalysisSolverModuleDef pModule,
64 final ThemisXAnalysisPackage pPackage) {
65
66 theModule = pModule;
67 thePackage = pPackage;
68 theReferenced = new ArrayList<>();
69
70
71 theFiles = new ArrayList<>();
72 for (ThemisXAnalysisFile myFile : thePackage.getFiles()) {
73 final ThemisXAnalysisSolverFile mySolverFile = new ThemisXAnalysisSolverFile(this, myFile);
74 theFiles.add(mySolverFile);
75 }
76 }
77
78 @Override
79 public ThemisXAnalysisSolverModuleDef getOwningModule() {
80 return theModule;
81 }
82
83 @Override
84 public ThemisXAnalysisPackage getUnderlyingPackage() {
85 return thePackage;
86 }
87
88
89
90
91
92
93 public String getPackageName() {
94 return thePackage.getPackage();
95 }
96
97
98
99
100
101
102 public List<ThemisXAnalysisSolverFile> getFiles() {
103 return theFiles;
104 }
105
106
107
108
109
110
111 public List<ThemisXAnalysisSolverPackage> getReferenced() {
112 return theReferenced;
113 }
114
115
116
117
118
119
120 public boolean isCircular() {
121 return isCircular;
122 }
123
124
125
126
127 public void markCircular() {
128 isCircular = true;
129 }
130
131 @Override
132 public boolean equals(final Object pThat) {
133
134 if (this == pThat) {
135 return true;
136 }
137 if (pThat == null) {
138 return false;
139 }
140
141
142 if (!(pThat instanceof ThemisXAnalysisSolverPackage myThat)) {
143 return false;
144 }
145
146
147 return getPackageName().equals(myThat.getPackageName());
148 }
149
150 @Override
151 public int hashCode() {
152 return getPackageName().hashCode();
153 }
154
155 @Override
156 public String toString() {
157 return thePackage.toString();
158 }
159 }